Circuit 3D

Types of sensors

A sensor turns something physical, such as light, heat, force, distance or moisture, into an electrical signal a circuit can read. Many are resistors whose value changes, read through a voltage divider, so a sensor reading 10 kΩ under a fixed 10 kΩ on 5 V gives 2.5 V.

Vout = Vin × Rsensor ÷ (Rfixed + Rsensor)

so a sensor reading 10 kΩ under a fixed 10 kΩ on 5 V gives 2.5 V.

Others give a voltage directly, a timed pulse, or a digital HIGH or LOW.

What is a sensor?

A sensor is a device that responds to something in the physical world and turns it into an electrical signal, such as a changing resistance, a voltage or a pulse.

Paired with a circuit or microcontroller, sensors let a device react: a night light that comes on at dusk, a fan that speeds up as a room warms. In Figure 1, the lab’s light sensor runs its night light.

Dim: the light sensor reads 25 kΩ, so the divider with 22 kΩ gives 1.6 V, past the 0.7 V its transistor needs, so the lamp comes on.

Figure 1. Parts of the lab’s Automatic Night Light: its light sensor, the 22 kΩ resistor above it in the divider, and the green lamp that a transistor switches on, on 3 V.

What are the main types of sensors?

Sensors are grouped by what they sense: light, temperature, force and pressure, distance and proximity, motion, moisture, and sound are the ones hobby circuits use most.

Each has its own page here: thermistors and other temperature sensors for heat, force sensing resistors for presses, load cells for weight, and Wheatstone bridges for strain gauges. Figure 2 sums up eight kinds.

Light Heat Force Pressure Distance Motion Moisture Sound

Heat: a thermistor senses temperature and gives a resistance that falls as it warms, for the common NTC kind.

Figure 2. Eight common sensors for hobby electronics, what each senses and the signal it gives a circuit.

What is the difference between analog and digital sensors?

An analog sensor gives a signal that varies smoothly with what it senses; a digital sensor gives only HIGH or LOW, or sends its reading as data.

Analog outputs go to an analog input, such as an Arduino’s A0; digital ones go to an ordinary pin. Many sensor modules offer both, as Figure 3 shows.

high low the room warming from 15 °C to 30 °C

Analog: the output voltage follows the temperature smoothly, so an analog input or meter can read any value in between.

Figure 3. A temperature sensor’s output as a room warms: an analog voltage, or a digital switch set at 22 °C.

How does a proximity sensor work?

A proximity sensor detects a nearby object without touching it, usually by sending out light, sound or a field and measuring what comes back.

Infrared sensors measure reflected light, ultrasonic sensors time an echo, Hall sensors feel a magnet, inductive sensors sense metal through a coil’s field, and capacitive sensors sense anything that changes their capacitance, like a finger on a phone screen.

What is a pressure sensor?

A pressure sensor measures the push of a gas or liquid, usually with strain gauges on a thin diaphragm wired as a Wheatstone bridge.

The pressure flexes the diaphragm, the gauges’ resistance changes slightly, and the bridge turns that into a few millivolts that an amplifier boosts. Digital pressure sensors do all this inside and send the reading as data.

How does a soil moisture sensor work?

A soil moisture sensor measures how much water is in soil, either by passing a small current between two probes or by sensing the soil’s capacitance through a sealed board.

Wet soil conducts better and has a higher capacitance than dry soil, so the output voltage changes with moisture. Resistive probes corrode within weeks; capacitive ones last far longer. Read both in dry and wet soil to calibrate them.

How do you read a sensor’s output?

To read a sensor’s output, use the divider formula for a resistive sensor and the speed of sound for an ultrasonic echo: 10 kΩ under 10 kΩ on 5 V gives 2.5 V.

Example 1: a resistive sensor’s voltage

A light or temperature sensor reads 10 kΩ, under a fixed 10 kΩ resistor on 5 V. What voltage does the divider give?

Given
a resistive sensor reading 10 kΩ under a fixed 10 kΩ on 5 V
Find
the voltage across the sensor
Solution
V = 5 V × 10 kΩ ÷ (10 kΩ + 10 kΩ) = 2.5 V
Answer
2.5 V

Example 2: distance from an echo

An ultrasonic distance sensor’s echo returns after 2.9 ms. How far away is the object?

Given
an ultrasonic echo that returns after 2.9 ms
Find
how far away the object is
Solution
The sound goes there and back, so distance = speed × time ÷ 2= 343 m/s × 0.0029 s ÷ 2 = 49.7 cm
Answer
About 49.7 cm

Summary

Key equations

  • Vout = Vin × Rs ÷ (Rf + Rs) a resistive sensor
  • d = 343 m/s × t ÷ 2 an ultrasonic echo

Key terms

Sensor
Turns a quantity into a signal.
Analog
Varies smoothly.
Digital
HIGH or LOW, or data.
Calibrate
Match readings to known values.

Practice problems

  1. What does a sensor do?

  2. Which sensor measures temperature?

  3. An ultrasonic echo returns after 2.9 ms. About how far away is the object?

  4. What does a digital sensor output?

  5. Why do capacitive soil sensors outlast resistive ones?

FAQ

What are the most common types of sensors?

Temperature, light, motion, proximity, pressure, force, sound and moisture sensors, found in phones, cars, homes and appliances.

What is a proximity sensor used for?

Detecting nearby objects without touching them: phone screens turning off at your ear, parking sensors, and machines counting parts.

What is the difference between a sensor and a transducer?

A transducer converts one form of energy into another; a sensor is a transducer used to measure, turning a quantity into a signal.

What is a PIR sensor?

A passive infrared sensor, which detects the heat of people and animals moving in front of it and switches its output HIGH.

How accurate are cheap sensors?

Often good enough to compare readings but a few percent off in absolute terms. Calibrate against a known value when accuracy matters.

Do sensors need power?

Most do: resistive sensors need current through their divider, and active sensors need a supply for their electronics. A few, such as piezo discs, make their own voltage.

Can I connect sensors to an Arduino?

Yes. Resistive and analog sensors go to its analog inputs through a divider, and digital sensors to its digital pins, at a voltage the board accepts.

What is a vibration sensor?

A sensor that detects shaking: a piezo disc that makes a voltage when flexed, a spring switch that closes on a knock, or an accelerometer to measure how much.

How does a water level indicator work?

Probes at different heights in a tank pass a small current through the water once it reaches them, each switching on a transistor and an LED for its level.