Internet of ThingsUnit 314 min read
Sensors & Actuators in IoT: Types, Working, Applications & Design
Unit 3 of Internet of Things explores how sensors detect physical parameters (light, temperature, motion) and actuators perform actions (switches, motors, LEDs) in IoT systems, including their interfaces, signal processing, and real-world implementations in smart homes, agriculture, and industrial automation.
TAKEAWAYS:
- Sensors convert physical phenomena into electrical signals (e.g., temperature → voltage), while actuators convert signals into physical actions (e.g., voltage → motor rotation).
- Analog sensors (e.g., thermistors) require ADC conversion, while digital sensors (e.g., DHT11) output ready-to-use data.
- Actuators range from passive (relays) to active (servo motors) and are chosen based on load, precision, and power requirements.
- Signal conditioning (amplification, filtering) is critical to ensure sensor data accuracy before processing.
- IoT sensors/actuators communicate via protocols like I2C, SPI, or UART, with Raspberry Pi/Arduino acting as hubs.
- Real-world applications include eSewa’s load shedding alerts (temperature sensors + relays) and Pathao’s traffic routing (GPS sensors + actuators in ride-hailing).
1. Sensors in IoT: Types, Working, and Interfaces
Sensors are the "eyes and ears" of IoT systems, converting physical quantities (light, heat, motion) into electrical signals. Their choice depends on accuracy, cost, power consumption, and environmental compatibility.
1.1 Classification of Sensors
Sensors are categorized based on:
- Measured Quantity: Physical (temperature, humidity), chemical (pH, gas), biological (glucose), or environmental (light, sound).
- Output Type: Analog (continuous voltage/current) or digital (discrete binary/encoded data).
- Sensing Mechanism: Passive (resistive, capacitive) or active (generates own signal, e.g., piezoelectric).
1.2 How Sensors Work: Signal Generation
- Passive Sensors: Change resistance/capacitance (e.g., thermistor, LDR). Require an external circuit (voltage divider) to convert changes into measurable signals.
- Active Sensors: Generate their own signal (e.g., piezoelectric sensors for vibration). Output is directly proportional to the input stimulus.
- Digital Sensors: Output data in digital form (e.g., DHT11 for temperature/humidity). Simplify processing but may lack precision.
1.3 Sensor Interfaces and Communication Protocols
Sensors connect to microcontrollers (Arduino/Raspberry Pi) via:
| Protocol | Type | Use Case | Speed | Wires | Example Sensors |
|---|---|---|---|---|---|
| Analog (ADC) | Unidirectional | Simple sensors (LM35, LDR) | Slow | 3 | Thermistors, Photoresistors |
| I2C | Bidirectional | Multiple sensors on 2 wires | Medium | 2 | BMP180, SHT31 |
| SPI | Bidirectional | High-speed, single sensor | Fast | 4 | MPU6050 (IMU) |
| UART | Bidirectional | Serial communication (DHT11) | Medium | 2 | GPS Modules, Bluetooth |
| 1-Wire | Bidirectional | Low-power, single sensor | Slow | 1 | DS18B20 (Temperature) |
Example: Reading a DHT11 Sensor (Digital) The DHT11 outputs a serial signal that must be parsed by the microcontroller:
- Sensor sends a start signal (low for 1ms).
- Microcontroller pulls the line low for 1µs, then high for 40µs.
- Sensor responds with 40-bit data (8-bit humidity, 8-bit temperature, 8-bit checksum).
- Arduino library
DHT.hhandles parsing:#include <DHT.h> DHT dht(2, DHT11); // Pin 2 void setup() { dht.begin(); } void loop() { float h = dht.readHumidity(); float t = dht.readTemperature(); Serial.print("Temp: "); Serial.print(t); Serial.println("°C"); delay(2000); }
2. Actuators in IoT: Types and Applications
Actuators are the "muscles" of IoT, converting electrical signals into physical actions. They range from simple switches to complex robotic arms.
2.1 Classification of Actuators
| Type | Mechanism | Examples | IoT Use Case |
|---|---|---|---|
| Electromechanical | Electricity → Motion | Relays, Solenoids, Stepper Motors | Smart locks, automated gates |
| Thermal | Heat → Expansion/Contraction | Peltier Modules, Bimetallic Strips | HVAC systems, coffee makers |
| Pneumatic | Air Pressure → Motion | Air Cylinders, Valves | Industrial automation |
| Hydraulic | Fluid Pressure → Motion | Hydraulic Pumps, Cylinders | Heavy machinery (e.g., construction) |
| Smart Materials | Shape Memory Alloys (SMA) | Flexinol Wire | Medical implants, adaptive structures |
2.2 How Actuators Work: Signal to Action
Actuators require:
- Control Signal: Voltage/pulse width (PWM) from a microcontroller.
- Power Supply: Often higher than logic levels (e.g., 5V for relays, 12V for motors).
- Driver Circuit: Transistors (e.g., MOSFET, H-bridge) to handle high currents.
Example: Controlling a DC Motor with an H-Bridge (L298N)
- PWM Input: Controls motor speed (0–255).
- Direction Pins: Reverse motor polarity for forward/backward motion.
- Real-World Use: Pathao’s delivery drones use DC motors + PID control for autonomous navigation.
2.3 Common IoT Actuators and Their Applications
| Actuator | Working Principle | IoT Application | Interface |
|---|---|---|---|
| Relay | Electromagnetic switch | Smart plugs, load shedding alerts (e.g., eSewa) | Digital I/O |
| Servo Motor | PWM-controlled gear train | Robotics, automated blinds | PWM Signal |
| Stepper Motor | Precise step movements | 3D printers, CNC machines | Step/Direction Pins |
| Solenoid Valve | Electromagnetic coil opens/closes | Smart irrigation, HVAC systems | Digital I/O |
| LED/Display | Current → Light | Status indicators, dashboards | Digital I/O/PWM |
Worked Example: Smart Load Shedding Alert System (eSewa-like)
- Sensor: DS18B20 measures ambient temperature.
- Logic: If temperature > 30°C, assume grid failure (common in Nepal).
- Actuator: Relay switches a backup generator.
- Code (Arduino):
#include <OneWire.h> #include <DallasTemperature.h> OneWire oneWire(2); DallasTemperature sensors(&oneWire); const int relayPin = 3; void setup() { sensors.begin(); pinMode(relayPin, OUTPUT); } void loop() { sensors.requestTemperatures(); float temp = sensors.getTempCByIndex(0); if (temp > 30.0) digitalWrite(relayPin, HIGH); // Activate relay else digitalWrite(relayPin, LOW); delay(5000); }
3. Signal Conditioning: Ensuring Accurate Data
Raw sensor signals are often noisy or weak. Signal conditioning prepares them for ADC or digital processing.
3.1 Key Signal Conditioning Techniques
| Technique | Purpose | Components Used | Example |
|---|---|---|---|
| Amplification | Boost weak signals | Operational Amplifier (Op-Amp) | ECG sensors in wearables |
| Filtering | Remove noise (high/low pass) | RC Circuits, Butterworth Filters | Vibration sensors in industrial IoT |
| ADC Conversion | Convert analog → digital | MCP3008, Arduino ADC | Analog sensors (LM35) |
| Linearization | Correct nonlinear sensor output | Lookup Tables, Math Functions | Thermistors (nonlinear resistance) |
Example: Amplifying a Weak Signal (Op-Amp Circuit)
- Use Case: NTC’s power grid monitoring amplifies weak current signals from high-voltage lines.
4. Sensor-Actuator Integration in IoT Systems
IoT devices combine sensors and actuators in a feedback loop:
- Sense: Sensor detects a condition (e.g., soil moisture).
- Process: Microcontroller analyzes data.
- Actuate: Actuator responds (e.g., opens irrigation valve).
- Communicate: Data/logs sent to cloud (e.g., Daraz’s warehouse inventory).
sequenceDiagram participant Sensor participant MCU participant Actuator participant Cloud Sensor->>MCU: Soil Moisture (30%) MCU->>MCU: Compare to threshold (40%) MCU->>Actuator: Open Valve (PWM) Actuator->>Sensor: Water Soil MCU->>Cloud: Log Event (Timestamp, Action)
Real-World Example: Smart Agriculture (e.g., Nepal’s Terai farms)
- Sensor: Capacitive soil moisture sensor (e.g., FC-28).
- Actuator: Solenoid valve for drip irrigation.
- Workflow:
- Sensor detects dry soil (<30% moisture).
- Arduino triggers valve for 5 seconds.
- Cloud logs water usage for farmer alerts.
5. Challenges and Best Practices
5.1 Common Challenges
- Noise: EMI/RFI from motors or power lines (solved by shielding/filters).
- Power Constraints: Battery-powered sensors (use low-power modes, e.g., sleep in Arduino).
- Calibration Drift: Sensors degrade over time (periodic recalibration needed).
- Latency: Actuators may need real-time response (e.g., autonomous vehicles).
5.2 Best Practices for IoT Sensor-Actuator Design
| Practice | Why It Matters | Example |
|---|---|---|
| Use digital sensors | Reduces noise, easier processing | DHT22 over LM35 for humidity |
| Implement error handling | Prevents crashes from bad data | Checksums for sensor readings |
| Modular design | Easier upgrades/repairs | Raspberry Pi + HATs for sensors |
| Secure communication | Prevents spoofing (e.g., fake sensor data) | Encrypted I2C/SPI with AES |
| Energy-efficient sleep | Extends battery life | ESP32 deep sleep between readings |
In the Real World
eSewa’s Load Shedding Alerts
- Sensors: Temperature sensors detect grid failures (overheating transformers).
- Actuators: Relays switch backup generators or notify users via SMS.
- How It Works: If temperature > 40°C (abnormal), eSewa’s IoT node triggers an alert: "Load shedding detected in your area. Backup power activated."
Pathao’s Traffic Optimization
- Sensors: GPS (location), accelerometers (speed), and LiDAR (obstacle detection).
- Actuators: Electric motors adjust ride speed/route dynamically.
- Example: If a sensor detects a traffic jam (low speed + high congestion), Pathao reroutes the driver via its cloud system.
NTC’s Smart Grid Monitoring
- Sensors: Current/voltage transformers monitor power lines.
- Actuators: Circuit breakers trip automatically during faults.
- Real Picture:
Khalti’s Secure Transactions
- Sensors: Fingerprint scanners (biometric) + NFC (payment).
- Actuators: Haptic feedback (vibration on success/failure).
- Security: Actuators lock the device if 3 failed attempts occur.
Exam Tip
This unit is heavily tested on:
- Definitions and Comparisons:
- Differentiate analog vs. digital sensors (output type, processing).
- Compare passive vs. active sensors (signal generation).
- Explain I2C vs. SPI (wires, speed, use cases).
- Worked Examples:
- Always draw a diagram (e.g., sensor circuit, actuator control flow).
- For signal conditioning, show math (e.g., Op-Amp gain equation).
- Real-World Applications:
- Link sensors/actuators to Nepali examples (eSewa, NTC, agriculture).
- Explain why a specific sensor/actuator is chosen (e.g., "DHT11 for humidity because it’s digital and low-cost").
- Common Pitfalls:
- Don’t forget signal conditioning—examiners love questions on noise/amplification.
- Always mention power constraints for battery-operated IoT devices.
- Protocol specifics: Know when to use UART (serial) vs. I2C (multi-device).
Sample Exam Question Breakdown:
"Explain how a temperature sensor and relay can be used in a smart load shedding system. Include a circuit diagram and pseudocode." Your Answer Must Include:
- Sensor choice (e.g., DS18B20) + why.
- Relay type (e.g., SPDT) + how it connects to the grid.
- Circuit diagram (signal conditioning if needed).
- Pseudocode with thresholds (e.g.,
if temp > 30°C). - Real-world tie-in (e.g., "Similar to eSewa’s backup systems").
Based on the TU BCA syllabus for Internet of Things (CACS460), unit 3.
Discussion
Loading…