O'Reilly logo

Internet of Things with Python by Gastón C. Hillar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Wiring an analog input pin with a voltage source

The easiest way to understand how to read the values from analog pins and map these values back to voltage values is to work with a very simple example. We will connect a power source to one of the analog input pins, specifically a pack with two AA or AAA 1.25 V rechargeable batteries in series. It is also possible to use AA or AAA 1.5 V standard batteries in series. Note that the maximum voltage with the two rechargeable batteries in series will be 2.5 V (1.25 V * 2), while the maximum voltage with the two standard batteries in series will be 3 V (1.5 V * 2).

We will use the analog pin labeled A0 to connect to the positive side (+) of the battery pack. Don't forget that the positive side (+) of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required