SlideShare a Scribd company logo
Hardware Hacking
  and Arduinos
Howard Mao and Mason Silber
Downloading the Arduino IDE

● Go to www.arduino.cc/en/main/software
  ○ Download whichever software fits your Operating
    System
● Linux users: find the "arduino" package in
  your distro's repository
● OSX users: make sure to also install USB
  FTDI drivers
  ○ http://www.ftdichip.com/Drivers/VCP.htm
What you have in front of you:
●   Arduino Duemilanove
●   USB Cable
●   Breadboard
●   Box of jumper wires
●   4 1k-ohm resistors (Brown-Black-Red)
●   1 100k-ohm resistor (Brown-Black-Yellow)
●   1 100k-ohm potentiometer
●   4 Light Emitting Diodes (LEDs)
●   1 push button switch
LED
● Light-emitting Diode
● Produces light when current flows through
● Current can only flow one way
Rules for LEDs
● Always use inline resistor
● Make sure direction is right (long pin is +)
Digital Output
Voltage can be HIGH (+5 V) or LOW (0 V)
pinMode(pin, OUTPUT) sets pin to output
digitalWrite(pin, HIGH) sets voltage high
digitalWrite(pin, LOW) sets voltage low
Breadboards
              ● Red channel for power
              ● Blue channel for ground
              ● Slots on horizontal channels all
                connected together internally
              ● Except break in middle of
                board
              ● Bridge two unconnected lines
                of breadboard to build your
                circuit
Basic Arduino Program Structure
void setup()
{
   //All initial settings go here
}

void loop()
{
   //Runs indefinitely after setup has completed
}
Lab 1: LED sweep
● Connect LEDs to Arduino pins 8, 9, 10, 11
● Turn only one on at a time
● Sweep left and then right
"Analog Output" : PWM
● Higher voltage gives brighter LED
● Use PWM to approximate lower voltages
● More time spent high (duty cycle) means
  higher average voltage
● analogWrite(pin, level) sets PWM duty cycle
● Levels are from 0 to 255 (8 bits)

                                   Duty Cycle = th / T


         th
              T
Lab 2: Analog LED Sweep
● Sweep left and right as before
● But keep a trail of dimmer LEDs behind
● Divide the level of secondary LEDs down by
  two after each step
Voltage Division




         Vout = R2 / (R1 + R2) * Vin
Analog Input
●   Arduino has an Analog-to-Digital Converter
●   Pins A0 - A5
●   Use analogRead(pin) to get voltage level
●   Levels go from 0 to 1023 (10 bits)
Lab 3: Variable Speed
● Use potentiometer (variable resistor) and
  resistor to form variable voltage divider
● Connect output of voltage divider to pin A0
● Read output voltage and use it to control
  delay time
Buttons and Switches
● Two kinds of switches
  ○ Single Throw - open or closed
  ○ Double Throw - one branch or another
● Closed switch has 0 resistance
  ○ Acts as a wire
● Open switch has infinite resistance
  ○ No current can flow
Pull-up Resistors
● Open switch with no voltage driver is an
  antenna, not necessarily ground
● Use pull-up resistors when combining single-
  throw switches and digital logic
Interrupts
● Tell the Arduino that a digital input has
  changed
● attachInterrupt(interrupt, function, mode)
  sets function to be run on interrupts
● Interrupt 0 -> pin 2, Interrupt 1 -> pin 3
● Modes are CHANGE, RISING, FALLING,
  LOW
Lab 4: Pause Button
● Connect push button to Arduino pin 2
● Set pin mode to INPUT_PULLUP
● Attach interrupt for pin 2
● When button pressed (switch closed), pause
  the sweeping
● When button released (switch open), resume
  the sweeping
Congratulations! You did it!
Some safety rules to remember
● Do not use very high voltages
  ○ microcontrollers like Arduino use either 5 V or 3.3 V
● Do not short power to ground
● Do not touch small resistor (< 100 Ohm)
  after voltage is applied
  ○ power is inversely proportional to resistance
  ○ power in resistor is dissipated as heat
  ○ small resistor + normal voltage = hot! hot! hot!
● Make sure directional components are in
  right direction
Learning More
● Arduino website (http://arduino.cc) has many
  good tutorials and resources
The End
Have fun at HackNY

More Related Content

What's hot

Arduino maze solving robot
Arduino maze solving robotArduino maze solving robot
Arduino maze solving robot
Mahmoud Salheen
 
TTL classification and TTL XOR Gate
TTL classification and TTL XOR GateTTL classification and TTL XOR Gate
TTL classification and TTL XOR Gate
Priyanka Shrestha
 
Digital Electronics - TTL (Transistor Transistor Logic)
Digital Electronics - TTL (Transistor Transistor Logic)Digital Electronics - TTL (Transistor Transistor Logic)
Digital Electronics - TTL (Transistor Transistor Logic)
Radharaman Group Of Institutes,Bhopal,M.P.
 
Digital stop watch
Digital stop watchDigital stop watch
Digital stop watch
Sai Malleswar
 
transistor transistor logic
transistor transistor logictransistor transistor logic
transistor transistor logic
mansi acharya
 
Introduction to Integrated Circuits
Introduction to Integrated CircuitsIntroduction to Integrated Circuits
Introduction to Integrated Circuits
Gurpawan Mand
 
555 timer-digital-clock
555 timer-digital-clock555 timer-digital-clock
555 timer-digital-clock
Gaditek
 
Transistor Transistor Logic
Transistor Transistor LogicTransistor Transistor Logic
Transistor Transistor Logic
surat murthy
 
SIEMENS RWD CONTROLLER SERIES
SIEMENS RWD  CONTROLLER SERIES SIEMENS RWD  CONTROLLER SERIES
SIEMENS RWD CONTROLLER SERIES
CONTROLS & SYSTEMS
 
Logic families ppt eceb srp
Logic families ppt eceb srpLogic families ppt eceb srp
Logic families ppt eceb srp
Saikat Dutt
 
Comparison of logic families using nand gate
Comparison of logic families using nand gateComparison of logic families using nand gate
Comparison of logic families using nand gate
eSAT Journals
 
Week 8 1_introduction_to_electro_pneumatics
Week 8 1_introduction_to_electro_pneumaticsWeek 8 1_introduction_to_electro_pneumatics
Week 8 1_introduction_to_electro_pneumatics
akmal ariffin
 
9) Switches
9) Switches9) Switches
9) Switches
Mand Labs
 
Lm35
Lm35Lm35
Automatic DC Fan using LM35 (english version)
Automatic DC Fan using LM35 (english version)Automatic DC Fan using LM35 (english version)
Automatic DC Fan using LM35 (english version)
Nurlatifa Haulaini
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
MdAshrafulAlam47
 
Buy Arduino Uno r3 india
Buy Arduino Uno r3 indiaBuy Arduino Uno r3 india
Buy Arduino Uno r3 india
Robomart India
 

What's hot (19)

Arduino maze solving robot
Arduino maze solving robotArduino maze solving robot
Arduino maze solving robot
 
TTL classification and TTL XOR Gate
TTL classification and TTL XOR GateTTL classification and TTL XOR Gate
TTL classification and TTL XOR Gate
 
Digital Electronics - TTL (Transistor Transistor Logic)
Digital Electronics - TTL (Transistor Transistor Logic)Digital Electronics - TTL (Transistor Transistor Logic)
Digital Electronics - TTL (Transistor Transistor Logic)
 
Digital stop watch
Digital stop watchDigital stop watch
Digital stop watch
 
transistor transistor logic
transistor transistor logictransistor transistor logic
transistor transistor logic
 
Encoder
EncoderEncoder
Encoder
 
Introduction to Integrated Circuits
Introduction to Integrated CircuitsIntroduction to Integrated Circuits
Introduction to Integrated Circuits
 
555 timer-digital-clock
555 timer-digital-clock555 timer-digital-clock
555 timer-digital-clock
 
Transistor Transistor Logic
Transistor Transistor LogicTransistor Transistor Logic
Transistor Transistor Logic
 
SIEMENS RWD CONTROLLER SERIES
SIEMENS RWD  CONTROLLER SERIES SIEMENS RWD  CONTROLLER SERIES
SIEMENS RWD CONTROLLER SERIES
 
Logic families ppt eceb srp
Logic families ppt eceb srpLogic families ppt eceb srp
Logic families ppt eceb srp
 
Comparison of logic families using nand gate
Comparison of logic families using nand gateComparison of logic families using nand gate
Comparison of logic families using nand gate
 
Week 8 1_introduction_to_electro_pneumatics
Week 8 1_introduction_to_electro_pneumaticsWeek 8 1_introduction_to_electro_pneumatics
Week 8 1_introduction_to_electro_pneumatics
 
9) Switches
9) Switches9) Switches
9) Switches
 
Lm35
Lm35Lm35
Lm35
 
Lm35
Lm35Lm35
Lm35
 
Automatic DC Fan using LM35 (english version)
Automatic DC Fan using LM35 (english version)Automatic DC Fan using LM35 (english version)
Automatic DC Fan using LM35 (english version)
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
 
Buy Arduino Uno r3 india
Buy Arduino Uno r3 indiaBuy Arduino Uno r3 india
Buy Arduino Uno r3 india
 

Similar to Hardware Hacking and Arduinos

Microcontroller_basics_lesson1_2019 (1).pptx
Microcontroller_basics_lesson1_2019 (1).pptxMicrocontroller_basics_lesson1_2019 (1).pptx
Microcontroller_basics_lesson1_2019 (1).pptx
HebaEng
 
Arduino Family
Arduino FamilyArduino Family
Arduino Family
mahalakshmimalini
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
Qtechknow
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
SanthanaMari11
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!
Makers of India
 
Integrated circuit
Integrated circuitIntegrated circuit
Integrated circuit
cooljunk
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote control
VilayatAli5
 
Arduino microcontroller ins and outs with pin diagram
Arduino microcontroller ins and outs with pin diagramArduino microcontroller ins and outs with pin diagram
Arduino microcontroller ins and outs with pin diagram
ArifatunNesa
 
IOT ARDUINO UNO.pptx
IOT ARDUINO UNO.pptxIOT ARDUINO UNO.pptx
IOT ARDUINO UNO.pptx
SanaMateen7
 
Neno Project.docx
Neno Project.docxNeno Project.docx
Neno Project.docx
AditiBhushan3
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
HebaEng
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
John Breslin
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
Ravikumar Tiwari
 
speedcontrol of dc motor using inverters
speedcontrol of dc motor using invertersspeedcontrol of dc motor using inverters
speedcontrol of dc motor using inverters
bhavyarkrishnan2000
 
Rebooting Computing chalkwell
Rebooting Computing chalkwellRebooting Computing chalkwell
Rebooting Computing chalkwell
rebooting_computing
 
arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
sunilkumar652338
 
ARDUINO (1).pdf
ARDUINO (1).pdfARDUINO (1).pdf
ARDUINO (1).pdf
SoumikBanerjee43
 

Similar to Hardware Hacking and Arduinos (20)

Lab2ppt
Lab2pptLab2ppt
Lab2ppt
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Microcontroller_basics_lesson1_2019 (1).pptx
Microcontroller_basics_lesson1_2019 (1).pptxMicrocontroller_basics_lesson1_2019 (1).pptx
Microcontroller_basics_lesson1_2019 (1).pptx
 
Arduino Family
Arduino FamilyArduino Family
Arduino Family
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!
 
Integrated circuit
Integrated circuitIntegrated circuit
Integrated circuit
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote control
 
Arduino microcontroller ins and outs with pin diagram
Arduino microcontroller ins and outs with pin diagramArduino microcontroller ins and outs with pin diagram
Arduino microcontroller ins and outs with pin diagram
 
IOT ARDUINO UNO.pptx
IOT ARDUINO UNO.pptxIOT ARDUINO UNO.pptx
IOT ARDUINO UNO.pptx
 
Neno Project.docx
Neno Project.docxNeno Project.docx
Neno Project.docx
 
Arduino workshop sensors
Arduino workshop sensorsArduino workshop sensors
Arduino workshop sensors
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
speedcontrol of dc motor using inverters
speedcontrol of dc motor using invertersspeedcontrol of dc motor using inverters
speedcontrol of dc motor using inverters
 
Rebooting Computing chalkwell
Rebooting Computing chalkwellRebooting Computing chalkwell
Rebooting Computing chalkwell
 
arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
 
ARDUINO (1).pdf
ARDUINO (1).pdfARDUINO (1).pdf
ARDUINO (1).pdf
 

Recently uploaded

Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 

Recently uploaded (20)

Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 

Hardware Hacking and Arduinos

  • 1. Hardware Hacking and Arduinos Howard Mao and Mason Silber
  • 2. Downloading the Arduino IDE ● Go to www.arduino.cc/en/main/software ○ Download whichever software fits your Operating System ● Linux users: find the "arduino" package in your distro's repository ● OSX users: make sure to also install USB FTDI drivers ○ http://www.ftdichip.com/Drivers/VCP.htm
  • 3. What you have in front of you: ● Arduino Duemilanove ● USB Cable ● Breadboard ● Box of jumper wires ● 4 1k-ohm resistors (Brown-Black-Red) ● 1 100k-ohm resistor (Brown-Black-Yellow) ● 1 100k-ohm potentiometer ● 4 Light Emitting Diodes (LEDs) ● 1 push button switch
  • 4. LED ● Light-emitting Diode ● Produces light when current flows through ● Current can only flow one way
  • 5. Rules for LEDs ● Always use inline resistor ● Make sure direction is right (long pin is +)
  • 6. Digital Output Voltage can be HIGH (+5 V) or LOW (0 V) pinMode(pin, OUTPUT) sets pin to output digitalWrite(pin, HIGH) sets voltage high digitalWrite(pin, LOW) sets voltage low
  • 7. Breadboards ● Red channel for power ● Blue channel for ground ● Slots on horizontal channels all connected together internally ● Except break in middle of board ● Bridge two unconnected lines of breadboard to build your circuit
  • 8. Basic Arduino Program Structure void setup() { //All initial settings go here } void loop() { //Runs indefinitely after setup has completed }
  • 9. Lab 1: LED sweep ● Connect LEDs to Arduino pins 8, 9, 10, 11 ● Turn only one on at a time ● Sweep left and then right
  • 10. "Analog Output" : PWM ● Higher voltage gives brighter LED ● Use PWM to approximate lower voltages ● More time spent high (duty cycle) means higher average voltage ● analogWrite(pin, level) sets PWM duty cycle ● Levels are from 0 to 255 (8 bits) Duty Cycle = th / T th T
  • 11. Lab 2: Analog LED Sweep ● Sweep left and right as before ● But keep a trail of dimmer LEDs behind ● Divide the level of secondary LEDs down by two after each step
  • 12. Voltage Division Vout = R2 / (R1 + R2) * Vin
  • 13. Analog Input ● Arduino has an Analog-to-Digital Converter ● Pins A0 - A5 ● Use analogRead(pin) to get voltage level ● Levels go from 0 to 1023 (10 bits)
  • 14. Lab 3: Variable Speed ● Use potentiometer (variable resistor) and resistor to form variable voltage divider ● Connect output of voltage divider to pin A0 ● Read output voltage and use it to control delay time
  • 15. Buttons and Switches ● Two kinds of switches ○ Single Throw - open or closed ○ Double Throw - one branch or another ● Closed switch has 0 resistance ○ Acts as a wire ● Open switch has infinite resistance ○ No current can flow
  • 16. Pull-up Resistors ● Open switch with no voltage driver is an antenna, not necessarily ground ● Use pull-up resistors when combining single- throw switches and digital logic
  • 17. Interrupts ● Tell the Arduino that a digital input has changed ● attachInterrupt(interrupt, function, mode) sets function to be run on interrupts ● Interrupt 0 -> pin 2, Interrupt 1 -> pin 3 ● Modes are CHANGE, RISING, FALLING, LOW
  • 18. Lab 4: Pause Button ● Connect push button to Arduino pin 2 ● Set pin mode to INPUT_PULLUP ● Attach interrupt for pin 2 ● When button pressed (switch closed), pause the sweeping ● When button released (switch open), resume the sweeping
  • 20. Some safety rules to remember ● Do not use very high voltages ○ microcontrollers like Arduino use either 5 V or 3.3 V ● Do not short power to ground ● Do not touch small resistor (< 100 Ohm) after voltage is applied ○ power is inversely proportional to resistance ○ power in resistor is dissipated as heat ○ small resistor + normal voltage = hot! hot! hot! ● Make sure directional components are in right direction
  • 21. Learning More ● Arduino website (http://arduino.cc) has many good tutorials and resources
  • 22. The End Have fun at HackNY