Chapter 3

Reading Analog Sensors

Chapter Summary

This chapter covered the following concepts:

  • The differences between analog and digital signals
  • How to convert analog signals to digital signals
  • How to read an analog signal from a potentiometer
  • How to display data using the serial monitor
  • How to interface with packaged analog sensors
  • How to create your own analog sensors
  • How to map and constrain analog readings to drive analog outputs

Parts List

Optional Parts:

Useful Links


  • On page 84, 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


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:


Chapter 3 Code Download

All code is licensed via the GNU GPL v3. Code is maintained and updated on GitHub. The download zip linked above always contains the most recent version of the code examples that have been pushed to the GitHub Code Repository.

References & Credits

  • Figure 3-7: TMP36 Temp/Voltage Graph Credit: Analog Devices, Inc., (source, PDF)
  • Figure 3-10: Photoresistor Photo Credit: courtesy element14 (source)