1. Introduction
Gesture-controlled robots are an exciting innovation in robotics where movement is controlled using hand gestures instead of buttons or remotes.
In this project, we design a Gesture Controlled Robot using NodeMCU (ESP8266) and an MPU6050 accelerometer sensor. The robot moves based on the tilt of your hand, making it a perfect demonstration of IoT + Embedded Systems + Robotics.
This project is highly suitable for:
- Engineering students
- Robotics workshops
- IoT demonstrations
2. Components
🔹 Transmitter Side
- NodeMCU ESP8266 → 1 No.
- MPU6050 Accelerometer & Gyroscope → 1 No.
- Jumper wires → As required
- Breadboard → 1 No. if required
- 3.7V Li-ion Battery → 1 No.
🔹 Receiver Side
- NodeMCU ESP8266 → 1 No.
- L298N Motor Driver → 1 No.
- DC Motors (2/4) → 2/4 as required
- Robot Chassis → 1 No.
- Wheels → 2/4 as required
- 7.4V Battery → 1 No.
3. Circuit and Connections
| ESP32 CAM Pinout Diagram |
| MPU6050 Pinout Diagram |
| Pinout Diagram L298N |
🔹 MPU6050 to NodeMCU (Transmitter)
- VCC → 3.3V
- GND → GND
- SDA → D2
- SCL → D1
🔹 Motor Driver to NodeMCU (Receiver)
- IN1 → D5
- IN2 → D6
- IN3 → D7
- IN4 → D8
⚠️ Important:
- Use common ground
- Use separate power supply for motors
4. Detailed Step By Step Circuit Working
MPU6050 detects tilt (acceleration values AX and AY)
Step 2:
NodeMCU reads these values using I2C communication
Step 3:
Based on tilt:
- Forward tilt → F
- Backward → B
- Left → L
- Right → R
Step 4:
NodeMCU sends command using WiFi (UDP protocol)
Step 5:
Receiver NodeMCU receives command
Step 6:
Motor driver activates motors accordingly
5. Libraries to be included
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
6. Code
🔹 Transmitter Code
#include <Wire.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
WiFiUDP UDP;
const char* ssid = "Robot";
const char* password = "12345678";
int16_t ax, ay;
void setup() {
Wire.begin();
Serial.begin(9600);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED);
Wire.beginTransmission(0x68);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission();
}
void loop() {
Wire.beginTransmission(0x68);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(0x68, 6, true);
ax = Wire.read()<<8 | Wire.read();
ay = Wire.read()<<8 | Wire.read();
char command = 'S';
if (ax > 15000) command = 'F';
else if (ax < -15000) command = 'B';
else if (ay > 15000) command = 'L';
else if (ay < -15000) command = 'R';
UDP.beginPacket("192.168.4.1", 4210);
UDP.write(command);
UDP.endPacket();
delay(200);
}
🔹 Receiver Code
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
WiFiUDP UDP;
char buffer[10];
#define IN1 D5
#define IN2 D6
#define IN3 D7
#define IN4 D8
void setup() {
Serial.begin(9600);
WiFi.softAP("Robot", "12345678");
UDP.begin(4210);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}
void loop() {
int packetSize = UDP.parsePacket();
if (packetSize) {
int len = UDP.read(buffer, 10);
char cmd = buffer[0];
if (cmd == 'F') forward();
else if (cmd == 'B') backward();
else if (cmd == 'L') left();
else if (cmd == 'R') right();
else stopRobot();
}
}
void forward() {
digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW);
}
void backward() {
digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH);
}
void left() {
digitalWrite(IN1, LOW); digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH); digitalWrite(IN4, LOW);
}
void right() {
digitalWrite(IN1, HIGH); digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW); digitalWrite(IN4, HIGH);
}
void stopRobot() {
digitalWrite(IN1, LOW); digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW); digitalWrite(IN4, LOW);
}
7. Detailed Step By Step Code Working
🔹 Transmitter
- Initializes MPU6050 using I2C
- Reads AX and AY values
- Converts tilt into command
- Sends command via WiFi UDP
🔹 Receiver
- Creates WiFi hotspot
- Listens for UDP packets
- Reads command character
- Controls motors using GPIO pins
8. Tips
- Use glove mounting for stable gesture detection
- Adjust threshold values (15000) for accuracy
- Use separate battery for motors
- Add LED indicator for debugging
- Ensure common ground connection
9. Uses
- Robotics workshops
- Gesture-based control systems
- Assistive robotics
- Industrial prototype systems
- Smart vehicle control
10. Conclusion
The Gesture Controlled Robot using NodeMCU is a powerful project combining IoT, sensors, and robotics. It provides a hands-on understanding of wireless communication and motion sensing.
This project can be further expanded into:
- AI-based robots
- Smart automation systems
- Surveillance robots