Free tech learning for everyone, from basics to pro

IoT FundamentalsIoT SecurityBeginner

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.

SensorMeasuresTypical use
Thermistor or digital temperature sensorTemperatureHeating, cold-chain monitoring
Passive infrared (PIR)Movement of warm bodiesAlarms, lighting control
Reed switchMagnet nearby (open or closed)Door and window sensors
Capacitive soil probeSoil moistureIrrigation
AccelerometerAcceleration and tiltWearables, vibration monitoring
Current transformerElectrical currentEnergy 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

From physics to dataQuantityheat, light,motionSensorchanges avoltageADCvoltage tonumberFirmwarescale, filterMessagevalue plusunits
Figure 1. A sensor converts a physical quantity into an electrical signal, which is digitised and turned into a meaningful reading.

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

Analogue vs digital sensorsAnalogue outputContinuous voltageNeeds an ADCAffected by noiseSimple and cheapDigital outputSends numbers directlyUses I2C, SPI or UARTLess noise on the wireOften calibrated in chip
Figure 2. Analogue sensors give a voltage the MCU must measure; digital sensors do the conversion themselves and send values over a bus.

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:

  1. Calibrate against a known reference and record the offset.
  2. Average several samples to smooth noise.
  3. Reject values outside a physically sensible range.
  4. Send units and a timestamp with every value.
  5. 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?
It samples an analogue voltage and converts it into a digital number the firmware can process.
Why might you choose an I2C sensor over an analogue one?
It sends calibrated digital values, is less affected by electrical noise and several sensors can share the same two wires.
Why put a temperature limit in the heater's own firmware?
So the device stays safe if the network fails or a malicious command arrives; it does not depend on the cloud for safety.

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.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

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.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.