If you are looking for the Chapter 3 content for the 2nd Edition of Exploring Arduino, please click here.
Reading Analog Sensors
Parts List
- Arduino Uno
- USB A-B Cable
- Small Breadboard
- Jumper Wires
- 10kΩ potentiometer
- 10kΩ resistor (x2)
- 220Ω resistor (x3)
- Photoresistor
- TMP36 Temperature Sensor
- Common-cathode RGB LED (make sure it isn’t common-anode!)
Optional Parts:
Code
Download Code (1st Edition, Chapter 3)
(Also available on GitHub)
Useful Links
- Arduino Analog Input Pin Reference Page
- Arduino analogReference() Command Page
- Arduino analogRead() Command Page
- SudoGlove Gesture Controller
- TMP36 Datasheet (PDF)
Errata
- On page 57, it should be noted that the reading from the photoresistor will change once the LED is programmed to turn on. In an otherwise dark room, the light from the LED will impact the reading from the photoresistor. You can compensate for this by adjusting your thresholds in code or by putting a paper cone around the photoresistor to block out stray light that isn’t coming from overhead.
(Issue reported by Aaron Williams)
Color Wiring Diagrams
Videos
Follow along with a video to learn about reading analog inputs with your Arduino:
This video explains the basic differences between analog and digital signals: