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 a photoresistor to an analog input pin

Now, we will use a photoresistor, that is, a light sensor, specifically, an electronic component that provides a variable resistor that changes the resistor value based on the incident light intensity. As the incident light intensity increases, the resistance of the photoresistor decreases, and vice versa.

Tip

A photoresistor is also known as an LDR (short for Light-Dependent Resistor) or photocell. Bear in mind that pohotoresistors are not the best components to sense light with great accuracy. However, they are extremely useful to easily determine whether we are in a dark environment when we don't have problems with latencies that can reach one second.

We cannot measure a resistance value with our board. ...

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