Gesture-Controlled Home Automation System
Introduction:
The Gesture-Controlled Home Automation System allows users to control home devices like lights
and fans using hand gestures.
It uses an ultrasonic sensor to detect hand movements and relay modules to control devices.
Components Required:
1. Arduino (or ESP32)
2. Ultrasonic Sensor (HC-SR04)
3. Relay Module
4. Jumper Wires
5. Power Supply
6. Optional: Servo Motor (for mechanical movements like door opening)
Step-by-step Guide:
1. Arduino Setup:
- Use Arduino IDE to write the code.
2. Ultrasonic Sensor Setup:
- Connect the HC-SR04 ultrasonic sensor to Arduino to detect gestures.
3. Relay Module Setup:
- Use relay module to control home devices (light, fan).
4. Coding:
- Write code to trigger actions (like turning on/off devices) based on hand gestures detected by the
ultrasonic sensor.
5. Testing & Tuning:
- Test the project by moving your hand in front of the sensor to control the device.
Code:
#include <NewPing.h>
#define TRIGGER_PIN 9
#define ECHO_PIN 10
#define MAX_DISTANCE 200
#define RELAY_PIN 3
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
void setup() {
pinMode(RELAY_PIN, OUTPUT);
Serial.begin(9600);
void loop() {
delay(50);
int distance = sonar.ping_cm();
if (distance > 10 && distance < 30) {
digitalWrite(RELAY_PIN, HIGH); // Turn on the device
} else {
digitalWrite(RELAY_PIN, LOW); // Turn off the device
}
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");