Circuits guide series
Why use a voltage divider with a photoresistor?
A common question is "why not connect a photoresistor directly to one of Arduino's analog pins, instead of connecting it via a voltage divider?".
Voltage dividers tend to confuse people that are new electronics.
Let's take a photoresistor, as an example.
A common question is "why not connect a photoresistor directly to one of Arduino's analog pins, instead of connecting it via a voltage divider?"
It is a fair question.
The voltage that the Arduino measures on its analog pin depends on the impedance (resistance) of the photoresistor. Since the impedance of the photoresistor depends on the light intensity, we should be able to use the direct connection instead of the voltage divider.
But, it doesn't work like that.
If you have a multimeter handy, try a simple experiment.
Connect the pins of your photoresistor to the electrodes of the multimeter. Set the multiumeter to measure resistance (ohm-meter). This will allow you to measure the impedance (resistance) of a photoresistor.
Take a few measurements, under different light conditions. You will see that the impedance varies, but is always very high. For most common photoresistors, the measured resistance can go from 100KΩ to 1MΩ.
Because of this high impedance, if you connect the photoresistor between, say, the Arduino 5V pin and A0, the current that will flow through this component will be very small. As a result, the voltage drop on the photoresistor will be barely noticeable by the Arduino.
On pin A0, the Arduino will measure close to 5V no matter how much light is hitting the photoresistor.
That's not very useful!
Here is a measurement of the impedance of a photoresistor, when directed towards a light source. It is around 10KΩ, a value that is more suitable to a pull-up or pull-down resistor. At 5V, you will not get much current from this device (just ~0.0005A in this case).
I have used my circuit simulator to compare the two ways of connecting a photoresistor to the Arduino. Without a voltage divider (left), and with a voltage divider (right). The simulator allows me to test the photoresistor at arbitrary lux levels.
At three different lux levels on the photoresistor(around 1klux is the light intensity in a low-lit room), the measured voltage on the left circuit didn't budge from the 5V. On the right side, with the voltage divider fixed resistor, we received three different readings.
As you can see, with the help of a suitable voltage divider, the photoresistor becomes a useful sensor for light intensity.
On the left side, you can also see that regardless of the current that flows through the photoresistor, the voltmeter measures the voltage across the DC power supply, which is constant at 5V. There is simply no other way to connect the photoresistor so that it can operate on its own and still provide a meaningful reading in proportion to the intensity of the light that hits it. Notice that this is an ideal circuit, without any impedance in the wires. In real life, there is impedance in the wires, and the circuit is more like this:
The impedance in the wires is around 0.11OΩ, for a 10cm jumper wire. This could produce a voltage reading of 4.998V in the voltmeter on the circuit on the left. And that reading would not vary much as the photoresistor's impedance changes since that impedance is so large in comparison.
By using a fixed resistor that is much smaller than the minimum impedance of the sensor, we are able to create a voltage drop that it depends a lot more on the smaller component, but still influenced by the larger components (larger, in terms of impedance).
Another benefit is this: because photoresistors come from different manufacturers with different characteristics, by using a fixed resistor in a voltage divider configuration we can reduce the effect of these variances. Therefore, our circuit becomes less dependent on the photoresistor's peculiarities.
Jump to another article.
1. Pull-up & pull-down resistors
2. What is a bypass/decoupling capacitor?
3. What is the purpose of the diodes in a keypad circuit?
4. Logic level shifting
5. Why should you use a diode in a relay driver circuit?
6. Why use a voltage divider with a photoresistor?
7. Optoisolator: a simple way to electrically separate parts of a circuit
8. Use MOSFETs to drive large(ish) loads
The Tech Explorations Subscription program
Subscribe and access all of our video courses immediately.
With a catalog of 25+ premium video courses (and growing), this subscription gives you an amazing resource to boost your learning.
New to the Arduino?
Arduino Step by Step Getting Started is our most popular course for beginners.
This course is packed with high-quality video, mini-projects, and everything you need to learn Arduino from the ground up. We'll help you get started and at every step with top-notch instruction and our super-helpful course discussion space.
Done with the basics? Looking for more advanced topics?
Arduino Step by Step Getting Serious is our comprehensive Arduino course for people ready to go to the next level.
Learn about Wifi, BLE and radio, motors (servo, DC and stepper motors with various controllers), LCD, OLED and TFT screens with buttons and touch interfaces, control large loads like relays and lights, and much much MUCH more.