Reading Analog Sensors

Parts You'll Need for This Chapter

Arduino Uno

Small breadboard

Jumper wires

10kΩ potentiometer

10kΩ resistor (×2)

220Ω resistor (×3)

USB cable


TMP36 temperature sensor (or any other 5V analog sensor)

5mm common-cathode RGB LED


Code downloads, video, and other digital content for this chapter can be found at

In addition, all code can be found at on the Download Code tab. The code is in the chapter 03 download and individually named according to the names throughout the chapter.

The world around you is analog. Even though you might hear that the world is “going digital,” the majority of observable features in your environment will always be analog in nature. The world can assume an infinite number of potential states, whether you are considering the color of sunlight, the temperature of the ocean, or the concentration of contaminants in the air. This chapter focuses on developing techniques for discretizing these infinite possibilities into palatable digital values that can be analyzed with a microcontroller system like the Arduino.

In this chapter, you will learn about the differences between analog and digital signals and how to convert between the two, as well as a handful of the analog sensors that you can interface with your Arduino. Using skills that you acquired in the preceding chapter, you will add light sensors ...

Get Exploring Arduino: Tools and Techniques for Engineering Wizardry now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.