Accelerometer Based Hand Gesture Controlled Robot using Arduino

Published  July 28, 2015   134
S Saddam
Author
Accelerometer Based Hand Gesture Controlled Robot using Arduino

Robots are playing an important role in automation across all the sectors like construction, military, medical, manufacturing, etc. After making some basic robots like line follower robot, computer controlled robot, etc, we have developed this accelerometer based gesture controlled robot by using arduino uno. In this project we have used hand motion to drive the robot. For this purpose we have used accelerometer which works on acceleration.

 

Required Components

  1. Arduino UNO
  2. DC Motors
  3. Accelerometer
  4. HT12D
  5. HT12E
  6. RF Pair
  7. Motor Driver L293D
  8. 9 Volt Battery
  9. Battery Connector
  10. USB cable
  11. Robot Chasis

RF Pair:

RF Pair

A gesture controlled robot is controlled by using hand in place of any other method like buttons or joystick. Here one only needs to move hand to control the robot. A transmitting device is used in your hand which contains RF Transmitter and accelero-meter. This will transmit command to robot so that it can do the required task like moving forward, reverse, turning left, turning right and stop. All these tasks will be performed by using hand gesture.

 

Here the most important component is accelerometer. Accelerometer is a 3 axis acceleration measurement device with +-3g range. This device is made by using polysilicon surface sensor and signal conditioning circuit to measure acceleration. The output of this device is Analog in nature and proportional to the acceleration. This device measures the static acceleration of gravity when we tilt it. And gives an result in form of motion or vibration.

 

According to the datasheet of adxl335 polysilicon surface-micromachined structure placed on top of silicon wafer. Polysilicon springs suspend the structure over the surface of the wafer and provide a resistance against acceleration forces. Deflection of the structure is measured using a differential capacitor which incorporate independent fixed plates and plates attached to the moving mass. The fixed plates are driven by 180° out-of-phase square waves. Acceleration deflects the moving mass and unbalances the differential capacitor resulting in a sensor output whose amplitude is proportional to acceleration. Phase-sensitive demodulation techniques are then used to determine the magnitude and direction of the acceleration.

Accelerometer

 

Pin Description of accelerometer

  1. Vcc        5 volt supply should connect at this pin.
  2. X-OUT  This pin gives an Analog output in x direction
  3. Y-OUT  This pin give an Analog Output in y direction
  4. Z-OUT   This pin gives an Analog Output in z direction
  5. GND      Ground
  6. ST          This pin used for set sensitivity of sensor

 

Circuit Diagram and Explanation

Gesture Controlled Robot is divided into two sections:

  1. Transmitter part
  2. Receiver part

In transmitter part an accelerometer and a RF transmitter unit is used. As we have already discussed that accelerometer gives an analog output so here we need to convert this analog data in to digital. For this purpose we have used 4 channel comparator circuit in place of any ADC. By setting reference voltage we gets a digital signal and then apply this signal to HT12E encoder to encode data or converting it into serial form and then send this data by using RF transmitter into the environment.

 

At the receiver end we have used RF receiver to receive data and then applied to HT12D decoder. This decoder IC converts received serial data to parallel and then read by using arduino. According to received data we drive robot by using two DC motor in forward, reverse, left, right and stop direction.

 

Working

Gesture controlled robot moves according to hand movement as we place transmitter in our hand. When we tilt hand in front side, robot start to moving forward and continues moving forward until next command is given.

When we tilt hand in backward side, robot change its state and start moving in backwards direction until other command is given.

When we tilt it in left side Robot get turn left till next command.

When we tilt hand in right side robot turned to right.

And for stopping robot we keeps hand in stable.

Gesture Controlled Robot transmitter part

Gesture Controlled Robot Transmitter Circuit Diagram

Circuit Diagram for Transmitter Section

 

Hand Gesture Controlled Robot Circuit Diagram using Arduino

Circuit Diagram for Receiver Section

 

Circuit for this hand gesture controlled robot is quite simple. As shown in above schematic diagrams, a RF pair is used for communication and connected with arduino. Motor driver is connected to arduino to run the robot. Motor driver’s input pin 2, 7, 10 and 15 is connected to arduino digital pin number 6, 5, 4 and 3 respectively. Here we have used two DC motors to drive robot in which one motor is connected at output pin of motor driver 3 and 6 and another motor is connected at 11 and 14. A 9 volt Battery is also used to power the motor driver for driving motors.

 

Program Explanation

In program first of all we have defined output pins for motors.

define

And then in setup we have given the directions to pin.

directions

After this we read input by using ‘if statement’ and perform relative operation.

reading and programming

There are total five conditions for this Gesture controlled Robot which are giving below:

Movement of hand

Input for Arduino from gesture

 

 

 

Side

D3

D2

D1

D0

Direction

Stable

0

0

0

0

Stop

Tilt right

0

0

0

1

Turn Right

Tilt left

0

0

1

0

Turn Left

Tilt back

1

0

0

0

Backward

Tilt front

0

1

0

0

Forward

 

We have writen the complete program according to the above table conditions. Below is the complete code.

Code

#define FD 16
#define BD 17
#define LD 18
#define RD 19

#define m11 3
#define m12 4
#define m21 5
#define m22 6

void forward()
{
   digitalWrite(m11, HIGH);
   digitalWrite(m12, LOW);
   digitalWrite(m21, HIGH);
   digitalWrite(m22, LOW);
}

void backward()
{
   digitalWrite(m11, LOW);
   digitalWrite(m12, HIGH);
   digitalWrite(m21, LOW);
   digitalWrite(m22, HIGH); 
}

void left()
{
   digitalWrite(m11, HIGH);
   digitalWrite(m12, LOW);
   digitalWrite(m21, LOW);
   digitalWrite(m22, LOW);
}

void right()
{
   digitalWrite(m11, LOW);
   digitalWrite(m12, LOW);
   digitalWrite(m21, HIGH);
   digitalWrite(m22, LOW);
}

void Stop()
{
   digitalWrite(m11, LOW);
   digitalWrite(m12, LOW);
   digitalWrite(m21, LOW);
   digitalWrite(m22, LOW);
}

void setup() 
{
  pinMode(FD, INPUT);
  pinMode(BD, INPUT);
  pinMode(LD, INPUT);
  pinMode(RD, INPUT);

  pinMode(m11, OUTPUT);
  pinMode(m12, OUTPUT);
  pinMode(m21, OUTPUT);
  pinMode(m22, OUTPUT);
}

void loop() 
{

  int temp1=digitalRead(FD);
  int temp2=digitalRead(BD);
  int temp3=digitalRead(LD);
  int temp4=digitalRead(RD);
 
  if(temp1==1 && temp2==0 && temp3==0 && temp4==0)
  backward();

  else if(temp1==0 && temp2==1 && temp3==0 && temp4==0)
  forward();

  else if(temp1==0 && temp2==0 && temp3==1 && temp4==0)
  left();

  else if(temp1==0 && temp2==0 && temp3==0 && temp4==1)
  right();

  else
  Stop();
}

Video

Comments

Submitted by vikram on Thu, 01/21/2016 - 16:33

Permalink

Can you please tell me the range of the RF ? I mean for what distance can I use this RF ? Are there ant better ways to transmit the commands ?

Submitted by shubham on Fri, 03/25/2016 - 23:22

Permalink

Hey friend!! Firstly i would like to thank u for uploading this project.
I am also making the same project as urs using the same diagram and code and everything but i am not able to successfully run it.Pls help me asap as i hv to submit my project in 3-4 days.
I have used same connection and the led on receiver is also glowing but i am not able to figure out the problem as motors r not running.

Hi Abhishek,
This is regarding Accelerometer based hand gesture robot project which u had uploaded in the web. I am unable to get the output . I guess there is a bug in the program. I haave done the same connections and uploaded thr program bit the motors aren't running. I then added baurd rate 9600 into program and added few line of codes but still i am not able ro run the motors. I have used the same hardware components and connectionss which u had done.
Below is my source code pls check wat is the bug.

#define FD 16
#define BD 17
#define LD 18
#define RD 19
#define m11 3
#define m12 4
#define m21 5
#define m22 6
void forward()
{
digitalWrite(m11, HIGH);
digitalWrite(m12, LOW);
digitalWrite(m21, HIGH);
digitalWrite(m22, LOW);
}
void backward()
{
digitalWrite(m11, LOW);
digitalWrite(m12, HIGH);
digitalWrite(m21, LOW);
digitalWrite(m22, HIGH);
}
void left()
{
digitalWrite(m11, HIGH);
digitalWrite(m12, LOW);
digitalWrite(m21, LOW);
digitalWrite(m22, LOW);
}
void right()
{
digitalWrite(m11, LOW);
digitalWrite(m12, LOW);
digitalWrite(m21, HIGH);
digitalWrite(m22, LOW);
}
void Stop()
{
digitalWrite(m11, LOW);
digitalWrite(m12, LOW);
digitalWrite(m21, LOW);
digitalWrite(m22, LOW);
}
void setup()
{
Serial.begin(9600);
pinMode(FD, INPUT);
pinMode(BD, INPUT);
pinMode(LD, INPUT);
pinMode(RD, INPUT);
pinMode(m11, OUTPUT);
pinMode(m12, OUTPUT);
pinMode(m21, OUTPUT);
pinMode(m22, OUTPUT);
}
void loop()
{
int temp1=digitalRead(FD);
int temp2=digitalRead(BD);
int temp3=digitalRead(LD);
int temp4=digitalRead(RD);
Serial.print(analogRead(FD));
Serial.print("\t");
Serial.print(analogRead(BD));
Serial.print("\t");
Serial.print(analogRead(LD));
Serial.print("\t");
Serial.print(analogRead(RD));
Serial.println();
delay(100);

if(temp1==1 && temp2==0 && temp3==0 && temp4==0)
backward();
else if(temp1==0 && temp2==1 && temp3==0 && temp4==0)
forward();
else if(temp1==0 && temp2==0 && temp3==1 && temp4==0)
left();
else if(temp1==0 && temp2==0 && temp3==0 && temp4==1)
right();
else
Stop();
}

Submitted by Megashree R on Mon, 04/04/2016 - 17:39

Permalink

Hello,
I built a transmitter module on a bread board and it looks really clumsy because of too many connecting wires and potentiometers. It's too large for a hand palm. However, in the video that you have uploaded, transmitter looks really small. So, kindly upload a picture of the transmitter module alone so that I'll get some idea of optimizing the design.

Submitted by Anamul Haque on Fri, 04/08/2016 - 06:35

Permalink

i can not find any accelerometer sensor in proteus.......also encoder-decoder HT12E & HT12D....please help me how to find this component in proteus.......Badly need this component to simulate this project

Submitted by HIMANSHU RATHI on Sat, 04/09/2016 - 18:00

Permalink

I want where you have simulated this circuit, coz I can't find all the components used in Proteus.
if anyone have the simulated file for this project please mail me

Submitted by Hadmath singh on Sun, 04/10/2016 - 15:10

Permalink

I built a transmitter module on a bread board and it looks really clumsy because of too many connecting wires and potentiometers. It's too large for a hand palm. However, in the video that you have uploaded, transmitter looks really small. So, kindly upload a picture of the transmitter module alone so that I'll get some idea of optimizing the design.

Submitted by Megashree R on Wed, 04/13/2016 - 05:38

Permalink

Please reply as soon as possible. The project deadline is approaching and I badly need a help in building the transmitter module.

Submitted by Alina Lepcha on Tue, 05/03/2016 - 12:02

Permalink

Hey friend!! Firstly i would like to thank u for uploading this project.
I am also making the same project as yours using the same diagram and code and everything but i am not able to successfully run it. Please help me asap as i have to submit my project in 3-4 days.
I have used same connection and the led on receiver is also glowing but i am not able to figure out the problem as motors are not running.

Submitted by Megashree R on Thu, 05/05/2016 - 14:33

Permalink

Should the antenna pin of transmitter and receiver modules be left as it is? or should we connect any coil to that pin?

hi friend, im doing a similar project to this one. can you please help me with this, which circuit simulator did you use because i cant find most of these components on Proteus. looking forward for your reply. Thank you.

Submitted by Sinjan Chakraborty on Fri, 05/06/2016 - 16:35

Permalink

I can not upload code into arduino uno r3.
The error is:-
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x43
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x43
please tell me how can i solve this error

Submitted by Chandramauli Kaushik on Thu, 06/23/2016 - 19:49

Permalink

My robot is only going forward. What could be wrong? Please help....

Submitted by Shoaib on Sun, 06/26/2016 - 11:16

Permalink

I dont find this model of motor driver L293D.Will any other motor driver work? I dont see 4 input pins in other motor driver like L293D.At that situation which pins i use to connect to Arduino?

Submitted by rupinder on Mon, 06/27/2016 - 17:22

Permalink

i cant find components for making this on proteus how did u done it on proteus

Submitted by SUDHIR on Sat, 07/30/2016 - 23:12

Permalink

HELLO.

I HAVE MADE THE EXACT CIRCUIT FOR Rx AND Tx, & USED THE EXACT SAME CODE.
BUT IT IS NOT WORKING CORRECTLY.

SOMETIME MOTORS HAVE TURNED ON WHILE OTHERTIME THEY DONT,
PLEASE HELP SORTING THIS OUT.

Submitted by Mohammad Shoaib on Sun, 08/28/2016 - 11:44

Permalink

Is there needed any header file such as for decoder,motor driver?I connected all elements exactly as like as your provided figure but when i test it there is no signal in the receiver portion and robot does not run too.

Submitted by SANJITH .T on Sun, 09/18/2016 - 22:07

Permalink

hai i like this robot,but actually i am new to this gesture things. can ypu please give me the assembling of parts in both reciever and transmitter section as avideo

Submitted by ahamedmaududi on Tue, 09/20/2016 - 22:58

Permalink

When I did the project.The motor doesn't run when I apply gesture.But when I touch or change the resistance using screwdriver the motor runs.pls give the solution.

Submitted by Himanshu prajapati on Sun, 09/25/2016 - 04:31

Permalink

Sie how u make transmitter connections..on PCB..it too complicated .....plz help me
Ll

A0-A7 pins should be identically configured. We have grounded them in both encoder and decoder. You can make many combinations like left A0 open in encoder and same in decoder, then this encoder will only respond for A0 opened decoder.

Submitted by ajay on Sat, 10/01/2016 - 11:42

Permalink

i have made the all connection as shown in the circuit diagram nd same program but..its not working... led is also not glowing in the receiver circuit.. plzzz help ..i did not find the sollution yet ..plzz help me its urgent

Submitted by jay on Sat, 10/22/2016 - 16:35

Permalink

I have made this robot bt in the transmitter section I have implemented the accelerometer in such a direction that yours x-y direction is mine y- x direction so what changes should I make in my program plzzzz help me

Submitted by Saeed Anwer on Sat, 10/29/2016 - 18:16

Permalink

i make this project but cant run it is i need to programe HT12E AND HT12D
I COMPLETE THE BOTH TRANSMITER ANS RECEIVER AND I USE H BRIDGE

Submitted by Sreekanth Bv on Tue, 11/15/2016 - 21:45

Permalink

I have connected all the components asper the circuit, but when I tilt the accelerometer forward and right the motors moves forward and right, but when the accelerometer is tilted left and backwards the motors aren't moving! please help me! What should I do

Submitted by Umarzaheer on Mon, 11/21/2016 - 17:56

Permalink

Sir according table in forward 1 pin is high.but in program you write the two pins are high for forward.please explain it.plzplzplZ.which condition is true for forward and other

Submitted by IKRAM on Fri, 11/25/2016 - 10:28

Permalink

hey sir. can u help me. i cant find ht12e and ht12d in my library of proteus. do you have the library for that in proteus 8? can u email it to me or what do you use to draw the circuit and simulation

Submitted by Umarzaheer on Wed, 12/07/2016 - 06:47

Permalink

Sir can I use diffrent conditin for left and right movment because my car is going only forward and backward.in program 1 pin high for left and right can i set 2 pins high.because it is very difficult to set the condition for left and right from variable resister.give me salution

Hey! This is my first project so I'm just gonna replicate it. Is the information and code available on the website sufficient ?
pls reply! it'll help alot.

Submitted by Bhavana S on Mon, 02/13/2017 - 15:14

Permalink

Hii Friends,
I would like to thank you for uploading this project'
I have used same hardware components,same circuit connections & code. I have also included the "Serial.begin(9600);" baudrate instrution in the "void setup()" function and "delay(100);" and few "Serial.print(.......) instuctions;" in the "void loop()" function. I am getting the output in software. But, the motors are not running.
I have few confusion in motor driver(L293D) circuit of receiver section. Is pin 16,1,8,9 all are shorted and given to 5V of Arduino? And for which pin 9V battery is connected to? because,according to data sheet of L293D pin 1,9,16 r given to 5V and pin 8 is given to battery. So,I did the connections correctly but unable to get the output(motors are not running). In the picture of project module which u uploaded I can see 2 wires in between analog and digital pins of Arduino board. But unable to get to where those pins are connected to. Please upload the receiver circuit connection and clear picture of your project module. once again. So that it may clear my doubts. Tell me if there any bug in it and Please clear my doubts within the 2days.

Submitted by Adarsh on Sun, 02/26/2017 - 09:42

Permalink

Hi there,
can u hlp me connecting accelerometer with the data lines of encoder.there is only x and y axis ryt and 4 data pins for encoder.in the circuit it is shunted ryt?i have a rf encoder board where i can connect the the transmitter module.

Thanks :)

Submitted by Ahmad on Sat, 03/11/2017 - 21:45

Permalink

can u give me the pcb layout of ur both circuits i have to make this project urgently and dont have much time , kindly give me pcb layout ....

Submitted by Abhijeet G on Fri, 03/17/2017 - 23:23

Permalink

can you tell me that can I use a microcontroller directly instead of ardunio board