Sensors and Actuators: Complete Beginner's Guide Guide.
Sensors and actuators are the two halves of how machines touch the physical world. A sensor measures something — temperature, light, distance, pressure — and converts it into an electrical signal a computer can read. An actuator does the reverse: it turns an electrical signal into physical action, like a motor spinning, a valve opening or a buzzer sounding.
It matters because every "smart" device is a sense–decide–act loop. A thermostat senses the room temperature, decides it is too cold, and actuates the heater. Without sensors a computer is blind; without actuators it is paralysed.
Key Concepts
- Sensor — converts a physical quantity into an electrical signal. Examples: thermistor (temperature), LDR (light), ultrasonic module (distance), load cell (weight).
- Actuator — converts an electrical signal into motion or physical change. Examples: DC motor, servo motor, stepper motor, solenoid, relay, buzzer.
- Analog vs digital — analog sensors output a continuously varying voltage (0–5 V); digital sensors output discrete values, often over I2C or SPI.
- ADC — the Analog-to-Digital Converter turns voltage into numbers. A 10-bit ADC splits its reference voltage into 2¹⁰ = 1024 steps, numbered 0 to 1023.
- Resolution vs accuracy — resolution is the smallest change a sensor can detect; accuracy is how close readings are to the true value. A sensor can be high-resolution but inaccurate.
Formulas
- ADC voltage: V = (reading / 1024) × Vref for a 10-bit ADC. A reading of 512 with a 5 V reference means 2.5 V at the pin.
- ADC step size: step = Vref / 1024. At 5 V each step is about 4.88 mV — the ADC cannot see smaller changes than this.
- LM35 temperature: °C = millivolts / 10, since the LM35 outputs 10 mV per degree Celsius.
- PWM motor speed: average voltage = duty cycle × supply voltage. A 50% duty cycle on 12 V gives about 6 V, so the motor runs at roughly half speed.
Worked Example
An LM35 temperature sensor feeds a 10-bit ADC with a 5 V reference. The ADC reports 205. What is the temperature?
- Voltage: V = (205 / 1024) × 5 ≈ 1.001 V = 1001 mV.
- LM35 gives 10 mV per °C, so temperature = 1001 / 10 ≈ 100.1 °C.
- The measured object is at about 100 °C — and the same three-step recipe works for any analog sensor once you know its volts-per-unit rating.
Common Misconceptions
- "A sensor and an actuator are the same kind of thing." They are opposites: a sensor converts physical → electrical, an actuator converts electrical → physical. A thermostat needs both.
- "A 10-bit ADC reads any voltage precisely." It only resolves steps of Vref/1024 (about 4.88 mV at 5 V) and cannot measure above its reference without extra circuitry.
Real-World Applications
- Home automation: motion sensors trigger lights, temperature sensors drive air conditioners, servos open smart curtains.
- Cars: wheel-speed sensors feed ABS braking, oxygen sensors tune the engine, actuators move windows and locks.
- Healthcare: pulse oximeters sense blood oxygen; insulin pumps actuate precise drug delivery.
Sensors give machines their senses and actuators give them their muscles. Learn how a sensor's voltage becomes a number through an ADC, and how a number becomes motion through PWM, and you can build anything from a smart lamp to an industrial robot.