Integration of Sensors/Actuators of Arduino

1. What are Sensors and Actuators?

  • Sensors: Devices that measure physical parameters (temperature, light, motion, gas, etc.)

  • Actuators: Devices that perform actions based on Arduino’s output (LEDs, motors, relays, buzzers)

Arduino acts as the bridge between sensors (input) and actuators (output).


2. Types of Sensors Used with Arduino

(a) Analog Sensors

  • Output a continuous voltage

  • Connected to analog pins (A0–A5)

Examples:

  • LDR (light sensor)

  • Temperature sensor (LM35)

  • Gas sensor (MQ series)

 
int sensorPin = A0; int value; void setup() { Serial.begin(9600); } void loop() { value = analogRead(sensorPin); Serial.println(value); delay(1000); }

(b) Digital Sensors

  • Output HIGH (1) or LOW (0)

  • Connected to digital pins

Examples:

  • PIR motion sensor

  • IR obstacle sensor

  • Push button

 
int pirPin = 2; int motion; void setup() { pinMode(pirPin, INPUT); Serial.begin(9600); } void loop() { motion = digitalRead(pirPin); Serial.println(motion); }

3. Types of Actuators Used with Arduino

(a) LEDs & Buzzers

Simple digital outputs.

 
int ledPin = 13; void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, HIGH); delay(500); digitalWrite(ledPin, LOW); delay(500); }

(b) Motors (DC / Servo / Stepper)

Servo Motor Example

 
#include <Servo.h> Servo myServo; void setup() { myServo.attach(9); } void loop() { myServo.write(90); delay(1000); myServo.write(0); delay(1000); }

(c) Relay Module

Used to control high-voltage devices like fans or bulbs.

 
int relayPin = 8; void setup() { pinMode(relayPin, OUTPUT); } void loop() { digitalWrite(relayPin, HIGH); delay(2000); digitalWrite(relayPin, LOW); delay(2000); }

⚠️ Always use relay modules, not bare relays.


4. Sensor–Actuator Integration Logic

Arduino continuously:

  1. Reads sensor data

  2. Processes data (decision-making)

  3. Controls actuator

Example: Temperature-Controlled Fan

 
int tempPin = A0; int fanPin = 7; void setup() { pinMode(fanPin, OUTPUT); } void loop() { int temp = analogRead(tempPin); if (temp > 500) { digitalWrite(fanPin, HIGH); } else { digitalWrite(fanPin, LOW); } }

5. Sensor & Actuator Integration in IoT

In IoT systems:

  • Sensor data → Arduino → Cloud

  • Cloud commands → Arduino → Actuator

Example:

  • Sensor: Soil moisture

  • Actuator: Water pump

  • Action: Automatic irrigation via cloud control


6. Interfacing Methods

Interface Used For
GPIO LEDs, buttons
ADC Analog sensors
PWM Motor speed, LED brightness
I2C LCD, IMU sensors
SPI SD card, displays
UART GPS, GSM

7. Common Safety & Best Practices

✔ Use current-limiting resistors with LEDs
✔ Use external power for motors
✔ Common ground between Arduino and modules
✔ Avoid high voltage directly


8. Simple Block Diagram

 
[ Sensor ][ Arduino ][ Actuator ]

9. Applications

  • Smart home automation

  • Industrial control systems

  • Smart agriculture

  • Robotics

  • Health monitoring

You have completed 0% of the lesson
0%