DIY Hand gesture controlled robot

DIY Hand gesture controlled robot

Tired of controlling your robot with a joystick ? Ever thought of controlling it with your hands. Wished I could control everything with my hands 😀 . Sitting in the chair and controlling things like a BOSS 😀 . I loved it. So I finally came out with a cool DIY hand gesture recognition robot, which can follow the commands shown by hand. Sounds crazy but I promise it’s very simple.
Making a gesture control robot is actually very simple. This robot is an improvement of my other DIY project RC car using RF module

Here also the robot is divided into two sessions, Transmitter and Receiver. The Receiver circuit is the same as that of the old post and there is a slight change in the transmitter circuit, here we need to program the transmitter circuit. So I will be using an Arduino as the programming platform to recognize the gestures made by hand I will be using an accelerometer sensor. So let’s start building 🙂

Things you need

Watch the Robot in Action

What is an Accelerometer (ADXL335)?

In brief an accelerometer is a three-axis acceleration measuring device.The accelerometer used here is ADXL335 it has 3 axis (X Y Z).

The accelerometer is now there in almost all smartphones (We are not going to take it from a smartphone 😉  )You might definitely played motion games in your mobile (Eg Temple run) the character in the game moves left and right when you tilt your phone left and right respectively it is done by the accelerometer.

There is  another sensor called Gyroscope found in smartphone which we don’t  need now

How does it work and recognize the gestures ?

Here the brain of the robot is arduino uno(Atmega32) it is fed with some set of code.
The gestures/motion made by hand is recognised by a acceleration measuring device called accelerometer (ADXL335)

Here the Accelerometer reads the X Y Z coordinates when we make gestures by hand and send the X Y Z coordinates to the arduino (Here we don’t need the Z axis we need only two coordinated X and Y So neglect the Z coordinate) The arduino check the values of coordinates send a 4bit data to the Encoder IC accordance to the data received from the accelerometer.The Encoder passes the data to RF Transmitter and the transmitted data is received by the RF Receiver, The receiver sends the 4bit data to Decoder IC and the decodes it passes to Motor Driver IC,Later the motor driver make decision to turn the two motor in required direction

Make the power supply

First we will start with the power supply circuit. We need two power supply circuit one for the transmitter and one for receiver.The receiver circuit need to powered using 12v supply(Since I’am using a 12V motor) and transmitter circuit can be powered using 9v battery

You can see the circuit for the receiver power supply on the right. Using this diagram, wire up the supply circuit. You can also add an LED via a 1k resistor to indicate the state of power supply.

  • IC 7805 which regulates the 12v supply to 5v (if cant get a 12v supply you can use a 9v supply)
  • 0.1uf & 470uf capacitor
  • And 1k resistor for status led
NOTE: Use heat sink for 7805 because we are dropping 7v (12-5 )so lots of heat will be produced to burn the regulator so use heat sink is recommended

Making  the Transmitter (Remote)

The receiver session consist of  accelerometer which detects the gesture made by hand sends the data to the arduino, Later arduino send data to the Encoder IC accordance to the data received from accelerometer and the data  is transmitted to the receiver

Wire up as per below circuit

This is just a illustration of the transmitter

NOTE: Please, be aware that some accelerometers use 3.3V power supply and might be damaged by 5V. Check the supplier’s documentation to find out which is the correct voltage. 

CODE

/*
* Gesture Recognition Robot - MG  ProjectHub
* Coder - Mayoogh Girish
* Website - http://mgprojecthub.com/
* This program lets you control your robot with a gesture made by your hand

 ADXL335
 ———————————————————¬ 
 |Ø           Z    Ø| 
 |        X<---•    | 
 |             |    | 
 |             |Y   | 
 |             ∨    |
 |                  |
 |                  |
 | O  O  O  O  O  O |
 ———————————————————¬
   ST Z  Y  X  -  +

              Right
                ∧
                |
                |
 Forward <------|------>Backward
                |
                |
                ∨
               Left
FOLLOW THIS INSTRUCTION TO CALIBRATE ROBOT
1) Upload ADXL3xx Sketch from examples [ File >> Examples >> Sensor >> AdXL3xx ]
2] Connect the sensor the arduino [ X --> PIN A3
                                    Y --> PIN A2
                                    Z --> PIN A1 ]
3) Open serial [Ctlr + Shift + M]
4) Tilt the sensor in +X, -X, +Y ,-Y direction (forward, backward, left, right) and note down the required x y 
5) Now change the 
              #define forward xxx with new +X value 
              #define backward xxx with new -X value
              #define left xxx with new +Y value
              #define right xxx with new -Y value

*/
//°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°//

#define forward 340 // Change this value to change senstivity for forward direction /-Default 340-/ *X*
#define backward 400 // Change this value to change senstivity for backward direction /-Default 400-/ *X*
#define left 340 // Change this value to change senstivity for left direction /-Default 340-/ *Y*
#define right 400 // Change this value to change senstivity for right direction /-Default 400-/ *Y*

int GNDPin=A4; //Set Analog pin 4 as GND
int VccPin=A5; //Set Analog pin 5 as VCC
int xPin=A3; //X axis input
int yPin=A2; //Y axis input
int zPin=A1; //Z axis input(not used)
int Q1=10,Q2=11,Q3=12,Q4=13; //Output pins to be connected to 10, 11, 12, 13 of Decoder IC

long x; //Variable for storing X coordinates
long y; //Variable for storing Y coordinates
long z; //Variable for storing Z coordinates

void setup()
{
  Serial.begin(9600);
  pinMode(Q1,OUTPUT);
  pinMode(Q2,OUTPUT);
  pinMode(Q3,OUTPUT);
  pinMode(Q4,OUTPUT);
  pinMode(GNDPin, OUTPUT);
  pinMode(VccPin, OUTPUT);
  digitalWrite(GNDPin, LOW); //Set A4 pin LOW
  digitalWrite(VccPin, HIGH); //Set A5 pin HIGH
}

void loop()
{
  x = analogRead(xPin); //Reads X coordinates
  y = analogRead(yPin); //Reads Y coordinates
  z = analogRead(zPin); //Reads Z coordinates (Not Used)

    if(x<forward) // Change the value for adjusting sensitivity forward(); else if(x>backward) // Change the value for adjusting sensitivity
      backward();
    else if(y>right) // Change the value for adjusting sensitivity
      right();
    else if(y<left) // Change the value for adjusting sensitivity
      left();
    else
      stop_();
}

void stop_()
{
  Serial.println("");
  Serial.println("STOP");
  digitalWrite(Q1,LOW);
  digitalWrite(Q2,LOW);
  digitalWrite(Q3,LOW);
  digitalWrite(Q4,LOW);
}

void forward()
{
  Serial.println("");
  Serial.println("Forward");
  digitalWrite(Q1,HIGH);
  digitalWrite(Q2,LOW);
  digitalWrite(Q3,HIGH);
  digitalWrite(Q4,LOW);
}

void backward()
{
  Serial.println("");
  Serial.println("Backward");
  digitalWrite(Q1,LOW);
  digitalWrite(Q2,HIGH);
  digitalWrite(Q3,LOW);
  digitalWrite(Q4,HIGH);
}

void left()
{
  Serial.println("");
  Serial.println("Left");
  digitalWrite(Q1,LOW);
  digitalWrite(Q2,HIGH);
  digitalWrite(Q3,HIGH);
  digitalWrite(Q4,LOW);
}

void right()
{
  Serial.println("");
  Serial.println("Right");
  digitalWrite(Q1,HIGH);
  digitalWrite(Q2,LOW);
  digitalWrite(Q3,LOW);
  digitalWrite(Q4,HIGH);
}

Make the Receiver

The receiver circuit consists of 2 IC(HT12D decoder, L293D motor driver), the RF receiver module was the circuit as per the above receiver schematic. There is 2 led in the receiver board, one lights up when the power supply is given to the receiver and the other when the power supply is given to transmitter circuit the led near the IC HT12D should lit and this provides you a valid transmission(VT) when power is given at the transmitter if not there is something wrong with your connection or your RF TX RX module

Please see my Simple Remote control car article for detailed information on the receiver.

What all gesture will robot recognize  ?

This robot is designed for recognizing five sets of gestures. Forward, backward, left, right and stop. You will get a better idea if check the photos of gestures given below

15 thoughts on “DIY Hand gesture controlled robot

  1. I would require help, with pcb part of the project.
    Your work is good and inspiring.
    Need help for doing this project, can i get your email for askin further queries directly.

  2. I would require help, with pcb part of the project.
    Your work is good and inspiring.
    Need help for doing this project, can i get your email for askin further queries

  3. Need your help,in power supply diagram you’ve mentioned 100uf and 10uf capacitors,but below you’ve written 0.1uf & 470uf capacitor.

    which to use??

  4. i did all the connections as mentioned above and burned the same code given above. But my bot is only moving forward ,right and stop .Its not moving in backward and left direction ,where could i have gone wrong ?

Leave a Reply

Your email address will not be published. Required fields are marked *