Watch on Instagram

Circuit Bytes · Episode 46 · Electronics · Sensors

"Sensors"

A chip can't feel anything; it only reads voltage. A light-dependent resistor's resistance drops as light rises, and paired with a 10 kΩ resistor in a voltage divider across 5 V it turns light into a voltage: at 40 kΩ in dim light, it gets 4 of the 5 volts. That's a sensor, a part that turns heat, light or touch into a signal a chip can read.

Posted · About a 1 minute watch, 3 minute read · Take the quiz

A chip only reads voltage

A microcontroller has no eyes, skin or nerves. All its input pins can do is measure electricity, usually a voltage between 0 V and the supply. So to "feel" the world, a circuit needs a part whose electrical behaviour changes when the world changes.

The light-dependent resistor

A light-dependent resistor (also called a photocell or photoresistor) is a resistor whose resistance depends on light. In dim light its resistance is high. Shine light on it and its resistance drops. In full darkness a real photocell can read around a megohm or more; in bright light it can fall to a few kilohms.

Turning resistance into voltage

A chip can't measure resistance directly, so we put the sensor in a voltage divider: a fixed resistor and the sensor in series across the supply. The two resistors share the supply voltage in proportion to their resistance:

voltage across sensor = supply × sensor ÷ (fixed + sensor)

With a 10 kΩ fixed resistor on top, the sensor in the bottom leg, and a 5 V supply, a sensor reading 40 kΩ in dim light gets:

5 V × 40 ÷ (10 + 40) = 4 V

The wire between the two resistors goes to the chip's pin, so the chip reads 4 V. When the light changes, the sensor's resistance changes, and so does that voltage. (Swap the two positions and the voltage moves the other way as light changes.)

The same trick everywhere

  • A thermistor is a resistor whose resistance changes with temperature. A common NTC thermistor drops in resistance as it warms and is rated 10 kΩ at 25 °C. It's read with the same kind of divider.
  • A phone's touch screen is capacitive: your finger changes the charge on a grid of tiny electrodes, and a controller measures that electrically. It isn't a resistor divider, but the idea is the same: a physical change becomes an electrical change.

That's a sensor: a part that turns heat, light or touch into a signal a chip can read.

Try it yourself

Use voltage across sensor = supply × sensor ÷ (fixed + sensor). With a 10 kΩ fixed resistor and a 5 V supply, a sensor reading 15 kΩ gets 5 V × 15 ÷ (10 + 15) = 3 V. Now try a sensor reading 90 kΩ and check that you get 4.5 V.

Good to know

  • The 40 kΩ and 10 kΩ values in this lesson are round example numbers; real photocells vary a lot from one part to the next.
  • Some sensors skip the divider and send digital data straight to the chip.
  • The chip turns the voltage into a number with an analog-to-digital converter, which is the next episode.
  • Battery or low-voltage supplies only; leave wall wiring to a licensed electrician.

Answer to the comment question

Same circuit, but in bright light the sensor drops to ten kilohms. What voltage does the chip read? 2.5 volts. The two resistors are now equal, so they split the supply in half: 5 V × 10 ÷ (10 + 10) = 2.5 V.

Test your knowledge

Quick quiz: "Sensors"

4 multiple-choice questions. Pick one answer for each, then check how you did.

1What happens to a light-dependent resistor's resistance when you shine light on it?
2Why put a sensor in a voltage divider?
3A 10 kΩ fixed resistor sits above a sensor reading 40 kΩ, across 5 V. What voltage does the chip read across the sensor?
4How does a phone's touch screen sense your finger?

Sources

Video transcript

How does a circuit feel heat, light and touch?

A chip can't feel anything. It only reads voltage.

Take a light-dependent resistor. In dim light its resistance is high. Shine light on it and its resistance drops.

Pair it with a ten-kilohm resistor in a voltage divider across five volts. In dim light, at forty kilohms, it gets four of the five volts.

Heat sensors and touch screens use the same trick. Something in the world changes, and the voltage changes with it.

That's a sensor: a part that turns heat, light or touch into a signal a chip can read.

Same circuit, but in bright light the sensor drops to ten kilohms. What voltage does the chip read? Comment your answer below!

That's your byte.

More from Circuit Bytes

All Circuit Bytes lessons