Gesture-Controlled Robot with Arduino
Build a robot that follows hand gestures using MPU6050 accelerometer and Arduino.
Parts List
- Arduino Uno
- MPU6050 Accelerometer/Gyroscope
- L298N Motor Driver
- DC Motors (x2)
- Robot Chassis
- nRF24L01 Wireless Modules (x2)
Step-by-Step Instructions
Build Glove Controller
Sew or attach a small protoboard with the MPU6050 sensor and an Arduino Nano to a fabric glove, positioning the sensor on the back of the hand for accurate tilt detection. Wire the MPU6050 to the Nano via I2C (SDA to A4, SCL to A5) and add the nRF24L01 radio module connected to SPI pins. Mount a 9V battery holder on the glove wrist strap to power the controller wirelessly.
Wire Robot Platform
Assemble the robot chassis with two DC motors connected to the L298N motor driver's output terminals. Wire the motor driver inputs IN1-IN4 to the Arduino Uno's digital pins 5, 6, 7, and 8, and connect ENA/ENB to PWM pins 9 and 10 for speed control. Attach the second nRF24L01 radio module to the robot Arduino's SPI pins and mount it vertically with the antenna clear of metal components for best range.
Implement Wireless Communication
Write paired Arduino sketches for both the glove and robot that configure the nRF24L01 modules on the same radio channel and data rate. Set up the glove transmitter to send 3-axis accelerometer and gyroscope data as a structured packet every 50 milliseconds. Program the robot receiver to parse incoming packets, validate the data checksum, and forward commands to the motor driver functions.
Map Gestures to Movement
Calibrate the MPU6050 by recording the resting position values when the hand is flat and use these as the neutral reference point. Implement gesture mapping where tilting forward drives both motors forward, tilting backward reverses, tilting left turns left, and tilting right turns right. Add a dead zone around the neutral position to prevent accidental movements, and scale the motor speed proportionally to the tilt angle for intuitive proportional control.
#include <Wire.h>
const int MPU = 0x68;
int16_t ax, ay, az;
int baseAx = 0, baseAy = 0;
void readAccel() {
Wire.beginTransmission(MPU);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU, 6);
ax = Wire.read() << 8 | Wire.read();
ay = Wire.read() << 8 | Wire.read();
az = Wire.read() << 8 | Wire.read();
}
void loop() {
readAccel();
int tiltX = (ax - baseAx) / 100;
int tiltY = (ay - baseAy) / 100;
int deadZone = 5;
if (abs(tiltX) < deadZone) tiltX = 0;
if (abs(tiltY) < deadZone) tiltY = 0;
int leftSpeed = constrain(150 + tiltY + tiltX, 0, 255);
int rightSpeed = constrain(150 + tiltY - tiltX, 0, 255);
// Send to L298N motor driver
}