Gesture‑Controlled Robot Powered by Raspberry Pi
Are you tired of button‑based controls? Imagine steering a robot with simple hand gestures while lounging on your couch. This tutorial shows how to build a dual‑motor robot that responds to hand movements using a Raspberry Pi, accelerometer, and RF communication.
Overview
We use a Raspberry Pi 3 at the transmitter to read accelerometer data, encode it with an HT12E module, and transmit the signal via a 434 MHz RF pair. On the robot side, a 12 V battery powers an HT12D decoder and an L293D motor driver, which drives two DC motors based on the received gesture commands.
Components
| Component | Specification | Qty |
|---|---|---|
| Raspberry Pi | Model 3 | 1 |
| MicroSD Card | ≥ 8 GB | 1 |
| Accelerometer | ADXL345 or MPU6050 | 1 |
| RF Module | TX & RX 434 MHz | 1 |
| Power Supply | 5 V USB for Pi; 12 V battery for robot | 1 |
| Wires | Female‑to‑male & male‑to‑female | 10 each |
| Encoder | HT12E (module preferred) | 1 |
| Decoder | HT12D (module preferred) | 1 |
| Motor Driver | L293D (module preferred) | 1 |
Block Diagram
Transmitter Side
The accelerometer feeds raw motion data to the Pi. Python processes the readings, maps them to motion commands, and sends a 4‑bit code to the HT12E encoder via GPIO. The encoder serialises the code, and the RF transmitter broadcasts it.
Receiver Side
The RF receiver captures the signal and forwards it to the HT12D decoder. The decoded 4‑bit code drives the L293D motor driver, which controls the robot’s left and right motors to achieve forward, reverse, left, right, or stop movements.
Accelerometer Basics
An accelerometer measures acceleration along three axes. Static acceleration (gravity) reveals tilt; dynamic acceleration detects motion. Digital models like ADXL345 or MPU6050 communicate via I²C, providing low‑noise, reliable data. The MPU6050 also includes a gyroscope, useful for more complex motion detection.
Connecting the Accelerometer to Raspberry Pi
Use the I²C bus: connect SDA and SCL pins on the Pi to the sensor’s SDA and SCL, and power the sensor with 3.3 V and GND. Enable I²C in Raspbian: sudo raspi-config → Interface Options → I²C. Install the SMBus utilities:
sudo apt-get install python-smbus i2c-toolsDetect the device:
sudo i2c-detect -y 1 – ADXL345 appears at 0x53; MPU6050 at 0x68 or 0x69.
Clone the library and run the example:
git clone https://github.com/pimoroni/adxl345-python cd adxl345-python sudo python example.pyFor MPU6050, use
pip install mpu6050-raspberrypi and test with:
from mpu6050 import mpu6050 sensor = mpu6050(0x69) print(sensor.get_accel_data())
Calibrating Gesture Thresholds
Place the sensor in each desired pose (forward, left, right, backward, stop) and record the raw X, Y, Z values. Compute the average and set a tolerance band; when live readings fall within a band, trigger the corresponding motor command. Store these thresholds in your Python script for real‑time decision making.
With this setup you’ll have a robust, wireless gesture‑controlled robot powered by Raspberry Pi.
Additional Resources
Manufacturing process
- Control an LED with a PIR Motion Sensor on Raspberry Pi
- Build a Smart Robot with the Bridge Shield – Raspberry Pi & Arduino Integration
- DIY Wall‑E Inspired Raspberry Pi CD‑Box Robot
- Build a Bluetooth‑Controlled Raspberry Pi Robot with Audio Feedback
- Build a WiFi‑Controlled Robot with Raspberry Pi & Android Smart Phone
- Build a Wi‑Fi‑Controlled Raspberry Pi Robot with Python – Step‑by‑Step Guide
- Integrating Microsoft Kinect with Raspberry Pi for Real‑Time Human Detection on the Sonbi Robot
- Build an Android‑Controlled Remote Vehicle with Raspberry Pi Motor Shield
- AI-Powered Maze-Solving Robot Using Arduino and Bluetooth
- Gesture‑Controlled Robot: Hands‑Free Arduino UNO Project