Sensors and actuators: how IoT devices sense and act
In short: Sensors turn physical quantities such as temperature or motion into electrical signals; actuators do the reverse and change something in the world. Analogue signals must be digitised by an analogue-to-digital converter, while digital sensors send ready-made values over a bus. Good firmware scales, filters and checks readings before trusting them.
Sensing and acting
A sensor measures something physical and produces an electrical signal. An actuator takes an electrical signal and produces a physical effect: it moves, heats, lights up or switches. Together they let an IoT device observe the world and respond to it. A smart thermostat uses a temperature sensor to decide, and a relay (an actuator) to switch the boiler.
| Sensor | Measures | Typical use |
|---|---|---|
| Thermistor or digital temperature sensor | Temperature | Heating, cold-chain monitoring |
| Passive infrared (PIR) | Movement of warm bodies | Alarms, lighting control |
| Reed switch | Magnet nearby (open or closed) | Door and window sensors |
| Capacitive soil probe | Soil moisture | Irrigation |
| Accelerometer | Acceleration and tilt | Wearables, vibration monitoring |
| Current transformer | Electrical current | Energy monitoring |
Common actuators include relays (switch mains devices), servo and stepper motors (precise movement), solenoid valves (water or gas flow), LEDs, buzzers and displays.
From physics to a number
Inside the MCU, an analogue-to-digital converter (ADC) samples a voltage and returns a whole number. A 12-bit ADC gives values from 0 to 4095. Firmware then converts that number into real units using the sensor's datasheet formula or a calibration table, for example turning a raw 2048 into 21.4 degrees Celsius.
Analogue and digital
Digital sensors talk to the MCU over short wired buses. Inter-Integrated Circuit (I2C) uses two wires and lets many sensors share them by address. Serial Peripheral Interface (SPI) is faster and uses more wires. Universal Asynchronous Receiver-Transmitter (UART) is a simple serial link often used by GPS modules. Actuators may be driven by a plain on/off pin or by pulse-width modulation (PWM), which varies power by switching rapidly.
Making readings trustworthy
Raw readings are noisy and sometimes wrong. A loose wire can report minus 127 degrees; a sensor in direct sunlight reads high. Good practice:
- Calibrate against a known reference and record the offset.
- Average several samples to smooth noise.
- Reject values outside a physically sensible range.
- Send units and a timestamp with every value.
- Flag sensor faults instead of sending a fake normal value.
For actuators, put safety limits in the device itself, not only in the cloud. A heater should switch off at a maximum temperature even if the network is down or a command is forged.
Tip: attackers who can reach a sensor physically can fool it, for example by warming a thermostat with a hairdryer. Where readings drive important actions, cross-check them with a second sensor or a plausibility rule.
Practice
What does an ADC do?
Why might you choose an I2C sensor over an analogue one?
Why put a temperature limit in the heater's own firmware?
Key takeaways
- Sensors turn physical quantities into signals; actuators turn signals into physical effects.
- An ADC digitises analogue voltages; digital sensors use I2C, SPI or UART.
- Firmware scales raw numbers into real units using calibration.
- Filter, range-check and timestamp readings before trusting them.
- Keep safety limits for actuators on the device itself.
Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.