Gesture Controlled Robot with Arduino: MPU6050 and nRF24L01 Guide
Build a gesture controlled robot with Arduino: MPU6050 and nRF24L01 on a glove, L298N on the car; tilt table, dead zone, batteries, range test and ESP-NOW.
A gesture controlled robot car moves according to the tilt of a sensor on a glove you wear: tilt your hand forward and the car drives forward, tilt it back and it reverses, tip it left or right and it turns that way. The MPU6050 accelerometer on the glove measures the tilt of your hand, the Arduino sends these angles to the car with an nRF24L01 wireless module, and the Arduino on the car turns them into speeds for two motors through an L298N motor driver. Driving with nothing but hand movements, no joystick, is very impressive and teaches sensors, wireless communication and motor control all in one project.
In this guide you'll set up, step by step, the table that maps tilt to direction, the threshold and dead zone that stop the car creeping on its own, the wiring diagrams and the transmitter and receiver code. You'll compare batteries with real numbers, measure the range with a simple method and build the same project with two ESP32s over ESP-NOW without any extra radio module. The code also includes a safety feature that stops the car if the link is lost.

How does a gesture controlled car work?
The system has two parts. The glove (transmitter) carries an Arduino Nano, an MPU6050 and an nRF24L01. Even when it's still, the MPU6050 measures gravity; with your hand flat, gravity is entirely on the Z axis, and as you tilt forward part of it moves onto the X axis. From these ratios the atan2 function calculates two angles: forward-back tilt (pitch) and left-right tilt (roll). The Nano sends these two angles to the car 20 times a second. The car (receiver) is made of an Arduino Uno, an nRF24L01, an L298N and two geared DC motors. The Uno reads the incoming angles, turns pitch into forward-back speed and roll into turning, and steers the car by running the left and right motors at different speeds. This tank-like steering is called differential drive. For the details of the MPU6050, see the MPU6050 accelerometer and gyroscope article.
| Part | Where? | Job |
|---|---|---|
| Arduino Nano | Glove | Calculates the angle, sends the packet |
| MPU6050 (GY-521) | Glove | Measures hand tilt (I2C) |
| nRF24L01 + 10 µF capacitor | Glove and car | 2.4 GHz wireless link (SPI) |
| Arduino Uno | Car | Receives the packet, calculates motor speeds |
| L298N motor driver | Car | Drives two DC motors both ways with PWM |
| 2 geared DC motors with wheels, caster wheel | Car | Two-wheel-drive chassis |
| Battery: 9 V or 1-cell Li-ion + boost on the glove, 2 × 18650 on the car | Both | Power |
Tilt-to-direction mapping table
The heart of the code is a simple formula that turns two angles into two motor speeds. First each angle passes through the dead zone and becomes a speed between −255 and +255: forward = speed(pitch), turn = speed(roll). Then left motor = forward + turn and right motor = forward − turn. While the car is moving forward the turn value is halved, so it draws a smooth curve instead of a sharp turn; when the car is stopped the turn is applied in full and it spins on the spot. If the directions come out reversed on your glove, the sensor is mounted differently; just change the sign of pitch or roll in the code.
| Hand movement | Pitch | Roll | Left motor | Right motor | Car |
|---|---|---|---|---|---|
| Hold hand flat | Within ±12° | Within ±12° | Stops | Stops | Stands still |
| Tilt forward | Above +12° | Within ±12° | Forward | Forward | Drives forward |
| Tilt back | Below −12° | Within ±12° | Reverse | Reverse | Reverses |
| Tip right | Within ±12° | Above +12° | Forward | Reverse | Spins right |
| Tip left | Within ±12° | Below −12° | Reverse | Forward | Spins left |
| Forward and right | Above +12° | Above +12° | Fast forward | Slow forward | Curves right |
| Forward and left | Above +12° | Below −12° | Slow forward | Fast forward | Curves left |
How do you choose the threshold and dead zone?
A human hand is never perfectly flat; if even a few degrees of shake move the car, driving gets tiring. That's why we define a dead zone: any tilt within ±12 degrees counts as zero and the car stops. Outside the dead zone, speed rises linearly with the angle and reaches maximum at 45 degrees. Speed starts at MIN_PWM rather than zero because geared motors hum without turning at low PWM; many yellow TT motors don't start moving below roughly 100–120. The angles also pass through a simple low-pass filter: only 20% of each new reading counts, which smooths out sudden jolts. You'll need a few test runs to tune these values for your hand and your car; the table below is a good starting point. Filtering methods are covered in detail in the sensor data filtering article.
| Setting | Starting value | If you lower it | If you raise it |
|---|---|---|---|
| DEAD_ZONE | 12° | The car moves with hand tremor | You must tilt a lot to get moving |
| MAX_TILT (full-speed angle) | 45° | The car reaches full speed too quickly | You must bend your wrist far for full speed |
| MIN_PWM (starting speed) | 110 | The motor hums but doesn't turn | The car lurches off at first |
| Filter factor | 0.8 old + 0.2 new | Faster but jittery response | Smoother but delayed response |
| Send interval | 50 ms (20 packets per second) | Smoother, more power | Less power, coarser control |
| FAILSAFE_MS (link-loss time) | 500 ms | Stops even on short dropouts | The car travels further after losing the link |
Wiring diagram
| Glove connection | Arduino Nano | ESP32 (ESP-NOW version) |
|---|---|---|
| MPU6050 VCC | 5V (the GY-521 has a regulator) | 3V3 |
| MPU6050 GND | GND | GND |
| MPU6050 SDA | A4 | GPIO 21 |
| MPU6050 SCL | A5 | GPIO 22 |
| MPU6050 AD0 | GND (address 0x68) | GND (address 0x68) |
| nRF24L01 VCC | 3.3 V (5 V with an adapter board) | Not needed |
| nRF24L01 CE / CSN | D9 / D10 | Not needed |
| nRF24L01 SCK / MOSI / MISO | D13 / D11 / D12 | Not needed |
| Car connection | Arduino Uno | ESP32 (ESP-NOW version) |
|---|---|---|
| L298N ENA (left motor speed) | D5 | GPIO 25 |
| L298N IN1 / IN2 | D7 / D8 | GPIO 26 / GPIO 27 |
| L298N ENB (right motor speed) | D6 | GPIO 14 |
| L298N IN3 / IN4 | D3 / D4 | GPIO 33 / GPIO 32 |
| nRF24L01 CE / CSN | D9 / D10 | Not needed |
| nRF24L01 SCK / MOSI / MISO | D13 / D11 / D12 | Not needed |
| L298N 12V input | 2 × 18650 positive | 2 × 18650 positive |
| L298N 5V output | To the Uno's 5V pin | To the ESP32 VIN (5V) pin |
| GND | Battery, L298N and Uno common | Battery, L298N and ESP32 common |
Step-by-step build
- Install TMRh20's RF24 library from the Library Manager in the Arduino IDE; the MPU6050 needs no extra library, the code reads it directly with Wire.
- Fit the two motors, caster wheel, L298N and battery holder to the chassis; connect the motor wires to OUT1-OUT2 and OUT3-OUT4 on the L298N.
- Remove the ENA and ENB jumpers on the L298N and wire those pins to PWM pins on the Uno; leave the 5V jumper on so the board also powers the Uno.
- On the glove, fix the MPU6050 flat on the back of the hand with its pins pointing towards the fingers; put the Nano and nRF24L01 in a box near the wrist.
- Upload the receiver code to the Uno first and the transmitter code to the Nano; set the car on a box with its wheels in the air.
- Check that the wheels stop with your hand flat and both turn forward when you tilt forward; if one motor runs backwards, swap its two wires on the L298N.
- If the car turns left when you tip right, change the sign of roll in the code; if it reverses when you tilt forward, change the sign of pitch.
- Put the car on the floor, try it gently in an open space and tune DEAD_ZONE and MIN_PWM for your own hand.
Transmitter code: MPU6050 and nRF24L01
1// Eldiven (verici): Arduino Nano + MPU6050 + nRF24L01, eğim açılarını 20 kez/sn gönderir
2// Glove (transmitter): Arduino Nano + MPU6050 + nRF24L01, sends tilt angles 20 times per second
3#include <Wire.h>
4#include <SPI.h>
5#include <RF24.h>
6
7RF24 radio(9, 10); // CE, CSN
8const byte ADDRESS[6] = "BGCAR"; // alıcıyla aynı olmalı / must match the receiver
9
10struct Packet {
11 int8_t pitch; // öne-arkaya eğim, derece / forward-back tilt, degrees
12 int8_t roll; // sağa-sola eğim, derece / left-right tilt, degrees
13};
14
15const int MPU = 0x68; // AD0 GND'de / AD0 to GND
16float pitchF = 0, rollF = 0; // süzülmüş açılar / filtered angles
17
18int16_t read16() {
19 int16_t hi = Wire.read(); // önce yüksek bayt / high byte first
20 return (hi << 8) | Wire.read();
21}
22
23void setup() {
24 Wire.begin();
25 Wire.beginTransmission(MPU);
26 Wire.write(0x6B); // PWR_MGMT_1
27 Wire.write(0); // uykudan uyandır / wake up
28 Wire.endTransmission();
29
30 radio.begin();
31 radio.setPALevel(RF24_PA_LOW); // masada LOW, menzil testinde HIGH / LOW on the desk, HIGH for range tests
32 radio.setDataRate(RF24_250KBPS); // düşük hız = daha uzun menzil / lower rate = longer range
33 radio.setChannel(108); // Wi-Fi'den uzak kanal / channel away from Wi-Fi
34 radio.openWritingPipe(ADDRESS);
35 radio.stopListening();
36}
37
38void loop() {
39 Wire.beginTransmission(MPU);
40 Wire.write(0x3B); // ACCEL_XOUT_H
41 Wire.endTransmission(false);
42 Wire.requestFrom(MPU, 6);
43 int16_t ax = read16();
44 int16_t ay = read16();
45 int16_t az = read16();
46
47 // İvmeden eğim açısı (±2g, 16384 LSB/g, oran yeterli) / tilt from acceleration (ratio only)
48 float pitch = atan2(-(float)ax, sqrt((float)ay * ay + (float)az * az)) * 57.3;
49 float roll = atan2((float)ay, (float)az) * 57.3;
50 pitchF = 0.8 * pitchF + 0.2 * pitch; // basit alçak geçiren süzgeç / simple low-pass filter
51 rollF = 0.8 * rollF + 0.2 * roll;
52
53 Packet p;
54 p.pitch = (int8_t)constrain(pitchF, -90, 90);
55 p.roll = (int8_t)constrain(rollF, -90, 90);
56 radio.write(&p, sizeof(p));
57 delay(50);
58}The code wakes the MPU6050 from sleep and on every loop reads the accelerometer's three axes as 6 bytes. In the default ±2g range, 1 g corresponds to 16384; but since only the ratio between the axes matters when calculating the angle, we don't need that scale. atan2 returns radians, and multiplying by 57.3 converts to degrees. To keep the packet small, the angles are limited to −90 to +90 and sent as one-byte integers; the whole packet is only 2 bytes. The radio runs at 250 kbit/s on channel 108: the low data rate increases range, and channel 108 sits above the 2.4 GHz channels your home Wi-Fi uses. For the nRF24L01's other settings, see the nRF24L01 wireless module article.
Receiver code: nRF24L01 and L298N
1// Araba (alıcı): Arduino Uno + nRF24L01 + L298N, eğimi tekerlek hızına çevirir
2// Car (receiver): Arduino Uno + nRF24L01 + L298N, turns tilt into wheel speeds
3#include <SPI.h>
4#include <RF24.h>
5
6RF24 radio(9, 10); // CE, CSN
7const byte ADDRESS[6] = "BGCAR";
8
9struct Packet { int8_t pitch; int8_t roll; };
10
11const int ENA = 5, IN1 = 7, IN2 = 8; // sol motor / left motor
12const int ENB = 6, IN3 = 3, IN4 = 4; // sağ motor / right motor
13
14const int DEAD_ZONE = 12; // ±12° içinde dur / stop inside ±12°
15const int MAX_TILT = 45; // 45° ve üstü = tam hız / 45° and above = full speed
16const int MIN_PWM = 110; // motorun kalktığı en düşük PWM / lowest PWM that moves the motor
17const unsigned long FAILSAFE_MS = 500; // bu sürede paket yoksa dur / stop if no packet in this time
18
19unsigned long lastPacket = 0;
20
21void drive(int pin1, int pin2, int pwmPin, int speed) {
22 digitalWrite(pin1, speed > 0);
23 digitalWrite(pin2, speed < 0);
24 analogWrite(pwmPin, abs(speed));
25}
26
27int tiltToSpeed(int tilt) {
28 if (abs(tilt) < DEAD_ZONE) return 0;
29 int s = map(constrain(abs(tilt), DEAD_ZONE, MAX_TILT), DEAD_ZONE, MAX_TILT, MIN_PWM, 255);
30 return tilt > 0 ? s : -s;
31}
32
33void setup() {
34 pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(ENA, OUTPUT);
35 pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); pinMode(ENB, OUTPUT);
36 radio.begin();
37 radio.setPALevel(RF24_PA_LOW);
38 radio.setDataRate(RF24_250KBPS);
39 radio.setChannel(108);
40 radio.openReadingPipe(1, ADDRESS);
41 radio.startListening();
42}
43
44void loop() {
45 if (radio.available()) {
46 Packet p;
47 radio.read(&p, sizeof(p));
48 lastPacket = millis();
49
50 int forward = tiltToSpeed(p.pitch); // eli öne eğ = ileri / tilt hand forward = forward
51 int turn = tiltToSpeed(p.roll); // sağa-sola eğim = dönüş / sideways tilt = turn
52 if (forward != 0) turn /= 2; // giderken yumuşak kavis / gentle curve while moving
53 int left = constrain(forward + turn, -255, 255);
54 int right = constrain(forward - turn, -255, 255);
55 drive(IN1, IN2, ENA, left);
56 drive(IN3, IN4, ENB, right);
57 }
58
59 if (millis() - lastPacket > FAILSAFE_MS) { // bağlantı koptu: dur / link lost: stop
60 drive(IN1, IN2, ENA, 0);
61 drive(IN3, IN4, ENB, 0);
62 }
63}The receiver records the time whenever a packet arrives. If more than 500 milliseconds pass since the last packet, meaning the glove battery died, you went out of range or the transmitter was switched off, both motors are stopped. Without this failsafe the car would keep driving on its last command all the way into a wall. The drive() function controls a motor with a single number: positive means forward, negative means reverse and zero means stop; the IN pins set direction and the EN pin sets speed with PWM. We explain how the L298N and PWM work in detail in the DC motor control with L298N article.
Choosing batteries
The motors are the most power-hungry part of the car. Yellow TT geared motors run on 3–6 V and each can draw about 150–250 mA while driving and close to 1 A when stalled. Because the transistors inside the L298N drop about 2 V, the motors get 2 V less than the battery voltage; a 6 V pack therefore turns the motors at only 4 V and the car feels sluggish. The best result comes from two 18650 Li-ion cells in series (2S, 7.4 V nominal, 8.4 V full). The glove draws very little current: the Nano, MPU6050 and nRF24L01 together use about 30–50 mA, more with a PA+LNA module. You can work out capacity and runtime with the battery life calculator and read about safe use of Li-ion cells in the 18650 Li-ion battery article.
| Battery | Voltage | For the car | Note |
|---|---|---|---|
| 9 V battery | 9 V | Not recommended | About 500 mAh, voltage collapses quickly under motor current; fine for the glove |
| 4 × AA alkaline | 6 V | Weak | About 4 V left for the motors after the L298N drop |
| 6 × AA NiMH | 7.2 V | Good | Rechargeable, but heavy |
| 2 × 18650 in series (2S) | 7.4 V (8.4 V full) | Best | Use protected cells and a 2S charging circuit |
| 2S LiPo | 7.4 V | Good | Light and powerful, but a balance charger is a must |
| 1-cell Li-ion + 5 V boost | 3.7 V → 5 V | Glove only | Light, rechargeable glove supply |
How do you test the range?
Range depends far more on the environment than on datasheet figures: walls, people, Wi-Fi traffic and how far from the antenna the module is mounted all change the result. Roughly, an nRF24L01 with a PCB antenna works at 15–30 m indoors and around 50–100 m outdoors in line of sight; PA+LNA models with an antenna reach much further. ESP-NOW usually goes beyond 100 m in open space. The best approach is to measure your own setup, and the failsafe makes that easy:
- Set the car on a box with its wheels in the air and mark a starting point in an open space.
- Hold the glove tilted forward; once the wheels start turning, walk slowly away from the car in a straight line.
- The moment the wheels stop, the failsafe has kicked in; measure the distance between that point and the car by pacing or with a tape measure.
- Repeat the test with RF24_PA_LOW, RF24_PA_HIGH and RF24_PA_MAX and write the results in a table.
- If the wheels turn in fits and starts near the limit, packets are being lost; treat half this distance as the safe limit when driving.
Wireless version with ESP32 and ESP-NOW
If you use two ESP32s, you don't need the nRF24L01 at all: ESP32s can send each other packets of up to 250 bytes directly with Espressif's ESP-NOW protocol, without setting up a Wi-Fi network. The wiring gets simpler too: on the glove only the MPU6050 (GPIO 21 and 22) connects to the ESP32, and on the car only the L298N. Upload the car code first; at start-up the car prints its own MAC address to the Serial Monitor. Copy that address into the carMac array in the transmitter code and upload it to the glove. The callback in the receiver code is written to compile with the different signatures in versions 2.x and 3.x of the ESP32 Arduino core. Although the ESP32 is a 3.3 V board, the L298N's inputs read 3.3 V as HIGH. You'll find ESP-NOW's pairing and encryption options in the ESP-NOW article.
1// ESP32 eldiven: MPU6050 eğimini ESP-NOW ile arabaya gönderir
2// ESP32 glove: sends MPU6050 tilt to the car over ESP-NOW
3#include <WiFi.h>
4#include <esp_now.h>
5#include <Wire.h>
6
7// Arabanın MAC adresi (alıcı kodu açılışta yazdırır) / the car's MAC (the receiver prints it at boot)
8uint8_t carMac[6] = {0x24, 0x6F, 0x28, 0x00, 0x00, 0x00};
9
10struct Packet { int8_t pitch; int8_t roll; };
11const int MPU = 0x68;
12float pitchF = 0, rollF = 0;
13
14int16_t read16() {
15 int16_t hi = Wire.read(); // önce yüksek bayt / high byte first
16 return (hi << 8) | Wire.read();
17}
18
19void setup() {
20 Serial.begin(115200);
21 Wire.begin(21, 22); // SDA, SCL
22 Wire.beginTransmission(MPU);
23 Wire.write(0x6B);
24 Wire.write(0);
25 Wire.endTransmission();
26
27 WiFi.mode(WIFI_STA);
28 if (esp_now_init() != ESP_OK) {
29 Serial.println("ESP-NOW baslatilamadi / ESP-NOW init failed");
30 return;
31 }
32 esp_now_peer_info_t peer = {};
33 memcpy(peer.peer_addr, carMac, 6);
34 peer.channel = 0; // geçerli kanal / current channel
35 peer.encrypt = false;
36 esp_now_add_peer(&peer);
37}
38
39void loop() {
40 Wire.beginTransmission(MPU);
41 Wire.write(0x3B);
42 Wire.endTransmission(false);
43 Wire.requestFrom(MPU, 6);
44 int16_t ax = read16();
45 int16_t ay = read16();
46 int16_t az = read16();
47
48 float pitch = atan2(-(float)ax, sqrt((float)ay * ay + (float)az * az)) * 57.3;
49 float roll = atan2((float)ay, (float)az) * 57.3;
50 pitchF = 0.8 * pitchF + 0.2 * pitch;
51 rollF = 0.8 * rollF + 0.2 * roll;
52
53 Packet p = { (int8_t)constrain(pitchF, -90, 90), (int8_t)constrain(rollF, -90, 90) };
54 esp_now_send(carMac, (uint8_t *)&p, sizeof(p));
55 delay(50);
56}1// ESP32 araba: ESP-NOW paketini alır, L298N ile iki motoru sürer
2// ESP32 car: receives ESP-NOW packets and drives two motors with an L298N
3#include <WiFi.h>
4#include <esp_now.h>
5
6struct Packet { int8_t pitch; int8_t roll; };
7
8const int ENA = 25, IN1 = 26, IN2 = 27; // sol motor / left motor
9const int ENB = 14, IN3 = 33, IN4 = 32; // sağ motor / right motor
10const int DEAD_ZONE = 12, MAX_TILT = 45, MIN_PWM = 110;
11const unsigned long FAILSAFE_MS = 500;
12
13volatile int8_t rxPitch = 0, rxRoll = 0;
14volatile unsigned long lastPacket = 0;
15
16// Çekirdek 3.x ve 2.x geri çağırma imzaları farklı / core 3.x and 2.x callback signatures differ
17#if ESP_ARDUINO_VERSION_MAJOR >= 3
18void onReceive(const esp_now_recv_info_t *info, const uint8_t *data, int len) {
19#else
20void onReceive(const uint8_t *mac, const uint8_t *data, int len) {
21#endif
22 if (len != sizeof(Packet)) return;
23 Packet p;
24 memcpy(&p, data, sizeof(p));
25 rxPitch = p.pitch;
26 rxRoll = p.roll;
27 lastPacket = millis();
28}
29
30void drive(int pin1, int pin2, int pwmPin, int speed) {
31 digitalWrite(pin1, speed > 0);
32 digitalWrite(pin2, speed < 0);
33 analogWrite(pwmPin, abs(speed));
34}
35
36int tiltToSpeed(int tilt) {
37 if (abs(tilt) < DEAD_ZONE) return 0;
38 int s = map(constrain(abs(tilt), DEAD_ZONE, MAX_TILT), DEAD_ZONE, MAX_TILT, MIN_PWM, 255);
39 return tilt > 0 ? s : -s;
40}
41
42void setup() {
43 Serial.begin(115200);
44 pinMode(IN1, OUTPUT); pinMode(IN2, OUTPUT); pinMode(ENA, OUTPUT);
45 pinMode(IN3, OUTPUT); pinMode(IN4, OUTPUT); pinMode(ENB, OUTPUT);
46 WiFi.mode(WIFI_STA);
47 Serial.print("Arabanin MAC adresi / Car MAC: ");
48 Serial.println(WiFi.macAddress()); // bunu eldiven koduna yaz / copy this into the glove sketch
49 if (esp_now_init() != ESP_OK) {
50 Serial.println("ESP-NOW baslatilamadi / ESP-NOW init failed");
51 return;
52 }
53 esp_now_register_recv_cb(onReceive);
54}
55
56void loop() {
57 if (millis() - lastPacket > FAILSAFE_MS) {
58 drive(IN1, IN2, ENA, 0);
59 drive(IN3, IN4, ENB, 0);
60 } else {
61 int forward = tiltToSpeed(rxPitch);
62 int turn = tiltToSpeed(rxRoll);
63 if (forward != 0) turn /= 2; // giderken yumuşak kavis / gentle curve while moving
64 drive(IN1, IN2, ENA, constrain(forward + turn, -255, 255));
65 drive(IN3, IN4, ENB, constrain(forward - turn, -255, 255));
66 }
67 delay(20);
68}Project ideas and upgrades
- Idea: Add a button to the glove; unless it's held down the car doesn't move, so it won't run away if your hand tilts by accident.
- Idea: Add an HC-SR04 to the car and ignore the forward command while an obstacle is closer than 20 cm.
- Idea: Set the speed separately with a flex sensor or potentiometer that measures finger bending.
- Idea: Make the glove an ESP32, put an ESP32-CAM on the car and drive while watching the video on your phone.
- Idea: Control a robot arm with the same glove; see the Arduino robot arm article for details.
- Idea: Instead of the MPU6050, try a version driven by swipe gestures with the touch-free APDS-9960 gesture sensor.
Common problems and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| The car doesn't respond at all | Different nRF24 address or channel, module underpowered | Check ADDRESS and channel match on both sides, add a 10 µF capacitor |
| The car creeps even with the hand flat | Dead zone too small or sensor mounted at an angle | Raise DEAD_ZONE to 15°, mount the sensor flat on the back of the hand |
| The motors hum but don't turn | PWM too low or weak battery | Raise MIN_PWM, use 2 × 18650 |
| Directions are reversed | Sensor or motor wires oriented differently | Change the sign of pitch or roll in the code, swap the motor wires |
| The Uno resets when the motors start | Inrush current pulls the voltage down | Add 100 nF across the motors and 470 µF at the battery, keep wires short |
| ESP-NOW packets don't arrive | Wrong carMac or boards on different Wi-Fi channels | Copy the car's MAC from the Serial Monitor again, don't connect either board to a Wi-Fi network |
A gesture controlled car combines sensor reading, angle calculation, wireless communication and motor driving in one project, which makes it a build that's both fun and educational. If you want to learn the parts one by one, you can follow the wiring diagrams and code of projects like "Bluetooth Controlled Car with L298N", "Obstacle Avoiding Robot", "Servo Control with a Joystick" and "2 Arduino One-Way Communication" step by step in the BlueGrays app, then combine them all in your own glove.
Frequently asked questions
How do you make a gesture controlled car?
You fit an MPU6050 accelerometer, an Arduino Nano and an nRF24L01 transmitter to a glove, and put an Arduino Uno, an nRF24L01 receiver and an L298N motor driver on the car. The glove sends the hand's tilt angles 20 times a second and the car turns these angles into speeds for its two motors. Tilting forward drives forward and tipping sideways turns.
Which sensor is used for a gesture controlled robot?
The most common choice is the MPU6050, which contains a 3-axis accelerometer and gyroscope and connects over I2C. Because it calculates tilt from gravity, it suits hand movement very well. Other accelerometers like the ADXL345 also work, and for touch-free versions the APDS-9960 gesture sensor is an option.
Can I use Bluetooth instead of the nRF24L01?
Yes, you can fit an HC-05 to both the glove and the car, pair them and send the same angles over serial. However, one HC-05 must be configured as master for them to connect to each other, and the range is usually shorter. The nRF24L01 is cheaper, easy to set up and has low latency.
Why does the car move on its own when my hand is flat?
Small tremors of the hand, or a sensor mounted at an angle on the glove, make the measured angle slightly different from zero. Increase the dead zone (DEAD_ZONE) in the code to 12–15 degrees and mount the sensor flat on the back of the hand. Filtering the angles also reduces jitter.
What is the range of a gesture controlled car?
An nRF24L01 with a PCB antenna works at roughly 15–30 m indoors and around 50–100 m outdoors; PA+LNA models with an antenna reach much further. Range varies with the environment and the antenna position. The best way is to walk away with the wheels in the air and measure the distance at which the failsafe kicks in.
What's the best battery for a robot car?
Because the L298N drops about 2 V, two 18650 Li-ion cells in series (7.4 V) give the best result. A 9 V battery weakens quickly under motor current, and 4 AA cells leave only about 4 V for the motors. With Li-ion, choose protected cells and a suitable charging circuit.
Projects to build after reading this
See all projects
LED Blink with ESP32
Teaches basic GPIO output usage with ESP32. We achieve a blinking effect by turning an LED on and off from a digital pin. ESP32 version of the classic blink project on Arduino UNO; the basic blink commands in the Arduino environment are the same, but the ESP32's pin layout and 3.3 V GPIO levels differ from those of the Arduino UNO.

Bluetooth Controlled Car with L298N
Turn your phone into a remote and drive your own robot car. The Arduino receives commands from a remote-control app on your phone through a Bluetooth module and spins the wheels with a motor driver…

Obstacle Avoidance Robot
How about building a smart vehicle that finds its own way? The Obstacle Avoidance Robot constantly scans its surroundings thanks to the ultrasonic sensor in front of it.

Led Control with Joystick
Push the little stick on the joystick all the way in any direction and the LED for that direction lights up: there are four different colours for right, left, up and down.

Servo Control with Joystick
Steer two motors with a joystick, just like turning a security camera. Push the stick left or right and the bottom servo motor slowly turns, push it up or down and the top servo tilts up and down…

One-Way Communication Between 2 Arduinos
You get two Arduinos talking over a single wire: press the button on one and the LED on the other lights up, press it again and it goes off.

Two-Way Communication Between 2 Arduinos
Two Arduinos are wired together and talk to each other: press the button on one and the light on the other comes on, press it again and it goes off.

Control an LED from Your Phone via Bluetooth
A small rehearsal for switching the lights in your room on and off from your phone.
More articles
BlueGrays app
Build this circuit step by step on your phone
Wiring diagram, code and parts list on one screen. 500+ Arduino, ESP32, ESP8266, Pico, mBot and micro:bit projects ready to build.
Scan with your phone
Point your camera at the code and your phone's app store opens.
or open the store

