Control Your Home With Just a Wave and a Word

by rohanbarnwal in Circuits > Arduino

106 Views, 4 Favorites, 0 Comments

Control Your Home With Just a Wave and a Word

Using.png

Imagine walking into a room and turning on the lights with just a wave of your hand-or commanding your fan to start with a simple voice prompt. No switches, no remotes-just effortless control. Sounds futuristic, right? Well, that future is now!

This project brings gesture and voice-controlled home automation to life using DFRobot's Gravity: GR10-30 Gesture Sensor and Gravity: Offline Language Learning Voice Recognition Sensor. With a simple swipe or voice command, you can control your appliances, making your home not just smart but truly intuitive and touch free!

How It All Started

I got my hands on these amazing DFRobot sensors and immediately started wondering: What cool project can I build with them? After exploring different possibilities, I realized they would be perfect for home automation!

Of course, the journey wasn't smooth. Integrating multiple sensors and ensuring real-time responsiveness was a challenge. But thanks to the I2C and UART communication options on these sensors, I figured it out and brought this futuristic system to life!

Now, let's dive in and build a gesture-and voice-controlled smart home that feels like it's straight out of a sci-fi movie!

How It Works

Gesture Control:

  1. Swipe Right: Change the relay position from 1→2→3→4
  2. Swipe Left: Change the relay position from 4→3→2→1
  3. Swipe Up: Turn ON the selected relay
  4. Swipe Down: Turn OFF the selected relay

Voice Recognition:

  1. Pre-programmed & custom commands for precise control
  2. Offline functionality for better privacy
  3. Self-learning capabilities to add unique wake words & commands

With these features, you can effortlessly control lights, fans, or any appliance using just you hand movements or voice commands!

Final Thoughts

With this gesture and voice-controlled home automation system, we've taken a step towards a truly futuristic and intuitive smart home. No more searching for switches-just a wave of your hand or a simple voice command can control your appliances effortlessly.

This project not only showcases the power of DFRobot's sensors but also opens the door to endless possibilities. You can expand this system by adding more appliances, integrating IoT, or even using AI for advanced automation.

So, what's next? Try it out, customize it, and make it your own! I'd love to see how you enhance and innovate with this system. Share your versions and let's build the future of smart homes together!

Supplies

+ - (2).png

Gesture Sensor (DFRobot Gravity GR10-30):

  1. Recognizes 12 different hand gestures
  2. Adjustable recognition distance up to 30cm
  3. Supports I2C and UART communication
  4. Documentation for further information

Voice Recognition Module (DFRobot Gravity Offline Learning Sensor)

  1. Works offline (No internet required)
  2. Comes with 121 pre-programmed commands
  3. Allows custom wake words & command training
  4. Documentation for further information

Arduino Mega 2560

  1. Handles multiple sensors and real-time operations
  2. Provides multiple input/output pins for seamless integration
  3. Documentation for further information

4-Channel Relay Module

  1. Control high power appliances like lights, fans, or smart devices
  2. Works with low-power microcontrollers like Arduino

Jumper Wires: To connect all components with each other

Wiring the Circuit

+ - (3).png

So the connection is as follows

Gesture Sensor Connection to Arduino Mega 2560:

  1. Gesture Sensor's SCL is connected to SCL
  2. Gesture Sensor's SDA is connected to SDA
  3. Gesture Sensor's GND is connected to GND
  4. Gesture Sensor's VCC is connected to VCC

Offline Voice Recognition Module to Arduino Mega 2560

  1. Offline Voice Recognition Module's TX to Arduino Mega 2560 19(RX)
  2. Offline Voice Recognition Module's RX to Arduino Mega 2560 18(TX)
  3. Offline Voice Recognition Module's GND to Arduino Mega 2560 GND
  4. Offline Voice Recognition Module's VCC to Arduino Mega 2560 VCC,



Training Custom Voice Commands

+ - (4).png

To create your own voice commands:

  1. Say "Learning Command Word"
  2. Follow the prompts and repeat the command three times
  3. Assign a unique Command ID
  4. Use the ID in the code to control appliances

To create you own wake word:

  1. use the default wake up word to initiate setup
  2. Say "Learning wake word" and follow the prompts
  3. Speak your desired wake word (e.g. "Hello buddy") three times.
  4. Once learning is completed, the module respond to your own wake word

Uploading the Code

+ - (5).png

Required Libraries:

Before uploading the code, install the following libraries in Arduino IDE:

  1. GR10-30 Gesture Sensor Library: https://github.com/DFRobot/DFRobot_GR10_30
  2. DFRobot_DF2301Q Voice Recognition Library: https://github.com/DFRobot/DFRobot_DF2301Q
  3. RTU Library: https://github.com/DFRobot/DFRobot_RTU


Code: Gesture & Voice-Controlled Home Automation

Upload the following code to your Arduino Mega 2560:

#include "DFRobot_GR10_30.h"
#include "DFRobot_DF2301Q.h"
#if defined(ARDUINO_AVR_UNO) || defined(ESP8266)
#include <SoftwareSerial.h>
#endif

const int relayPins[] = {2, 3, 4, 5};
int relayStates[] = {0, 0, 0, 0};

#if defined(ARDUINO_AVR_UNO)||defined(ESP8266)
SoftwareSerial softSerialGesture(4, 5);
DFRobot_GR10_30 gr10_30(GR10_30_DEVICE_ADDR, &Wire);
#else
DFRobot_GR10_30 gr10_30(GR10_30_DEVICE_ADDR, &Wire);
#endif

#if (defined(ARDUINO_AVR_UNO) || defined(ESP8266))
SoftwareSerial softSerialVoice(6, 7);
DFRobot_DF2301Q_UART asr(&softSerialVoice);
#elif defined(ESP32)
DFRobot_DF2301Q_UART asr(&Serial1, D3, D2);
#else
DFRobot_DF2301Q_UART asr(&Serial1);
#endif

void setup() {
Serial.begin(115200);
for (int i = 0; i < 4; i++) {
pinMode(relayPins[i], OUTPUT);
digitalWrite(relayPins[i], HIGH);
}

while (gr10_30.begin() != 0) {
Serial.println("Gesture Sensor failed!!");
delay(1000);
}

while (!(asr.begin())) {
Serial.println("Voice Module failed!!");
delay(3000);
}

asr.settingCMD(DF2301Q_UART_MSG_CMD_SET_VOLUME, 7);
}

void loop() {
if (gr10_30.getDataReady()) {
uint16_t gestures = gr10_30.getGesturesState();
if (gestures & GESTURE_RIGHT) Serial.println("Swiped Right - Changing relay");
if (gestures & GESTURE_LEFT) Serial.println("Swiped Left - Changing relay");
if (gestures & GESTURE_UP) Serial.println("Swiped Up - Turning ON relay");
if (gestures & GESTURE_DOWN) Serial.println("Swiped Down - Turning OFF relay");
}

uint8_t CMDID = asr.getCMDID();
switch (CMDID) {
case 5: relayStates[0] = 1; Serial.println("Relay 1 ON"); break;
case 6: relayStates[0] = 0; Serial.println("Relay 1 OFF"); break;
}
}

Watch Demo Video

Smart Home Like Never Before: Gesture &amp; Voice-Controlled Automation with Arduino

Now, it's time to see the project in action! Check out the video demonstration If you love this project, don't forget to Like, Share and Subscribe to my YouTube channel it would mean a lot and be a great support!