Gesture Control Robo Car

Have you ever thought of controlling your robo car with your hand gestures. We loved the thought of it and so we finally came up with a GESTURE CONTROL ROBO CAR that can take the commands from our hand Gestures.

Sounds crazy but we promise it’s very simple.

So, the basic idea of taking up this project is to make you understand how the Accelerometer is interfaced with the Arduino. Programming the Arduino to read the Data coming from the accelerometer and process is such that it should drive the robo car in the direction the user wants it to go.

Pre-requisites:

Download the Arduino IDE from https://www.Arduino.cc/en/Main/Software


Main Components:

1.     Arduino Uno R3
2.     Arduino Cable
3.     Accelerometer
4.     DC Motors
5.     L293D Motor Driver IC
6.     Wheels and Chassis
7.     12V Supply
8.     Bread Board
9.     Jumpers/Connecting Wires



Steps For Connections:

  Short the pins 1,8,9 and 16 of the Motor Driver IC and the Vcc pin of the Accelerometer to the Vcc(+5V) pin of the Arduino.



NOTE: It is recommended to connect 12V supply to the pins 8 and 16 of the Motor for better utilization of the RPM of a motor. Here, we have connected those 2 pins to 5V. It still works but your motor will work on lower RPM than provided by the manufacturer. It results slow speed.

  Short the pins 4,5,12, and 13 of the Motor Driver IC and the GND pin of the Accelerometer to the GND pin of the Arduino.

For Accelerometer:

   1.    Connect the X-axis pin to the analog pin – ‘A1’ of the Arduino Uno.

   2.    Connect the Y-axis pin to the analog pin – ‘A2’ of the Arduino Uno.

   3.    Connect the Z-axis pin to the analog pin – ‘A3’ of the Arduino Uno.

For Motor Driver IC:

   1.   Connect the pin 2 of the Motor Driver IC to the digital pin 11 of the Arduino Uno.

   2.   Connect the pin 7 of the Motor Driver IC to the digital pin 8 of the Arduino Uno.

   3.   Connect the pin 10 of the Motor Driver IC to the digital pin 10 of the Arduino Uno.

   4.   Connect the pin 15 of the Motor Driver IC to the digital pin 7 of the Arduino Uno.

   5.   Connect the pin 3 of the Motor Driver IC to the 1st pin of the Left Motor.

   6.   Connect the pin 6 of the Motor Driver IC to the 2nd pin of the Left Motor.

   7.   Connect the pin 11 of the Motor Driver IC to the 2nd pin of the Right Motor.

   8.   Connect the pin 14 of the Motor Driver IC to the 1st pin of the Right Motor.

About Code:



  Declare the variables used to indicate the Arduino pins to be connected to the pins of Accelerometer (X,Y,Z Axis).

  Declare the variables used to indicate the Arduino pins to be connected to the pins of the Motors.

    void setup


  Define the Pin Mode as “INPUT” of the axis of accelerometer as it would give the values of the axis to which the controller will accept, process and provide an output.

  Define the Pin Mode as “OUTPUT” of the motor pins as the microcontroller would provide the desired output to the motor which in turn will control the car.

  To check the values from Accelerometer, Serial Communication is used which would display the values on the Arduino’s Serial Monitor.

  The baud rate is set to 9600 to start the serial communication.

   Functions








  Make functions for each direction : Forward, Reverse, Left, Right, Still.

  In each function, give commands to the pins of motors either HIGH or LOW.

  To print the axis values on Serial Monitor, use “Serial.print”.

  Each axis is read first and stored in a variable.

   void loop




  5 loops are made which holds the conditions considering the values of the three axis and the respective function is called.

  Thus, as the accelerometer axis changes while moving in any direction, that particular condition will be satisfied and the function present in that condition will be executed enabling the car to move in that direction.

Steps for Compiling Program:

   1. Click on ‘Sketch’ on Menu bar.

   2. Select ‘Verify/Compile’.
      (or)
      Press Ctrl + R
      (or)
Click on the first button just below the menu bar. (Button with a tick)

Steps for Uploading Program:

1.   Click on ‘Tools’ on the Menu Bar.

2.   Go to ‘Board’ and select whichever Arduino you are using. Here, Arduino/Genuino Uno.

3.   Go to ‘Port’ and select the COM Port in which you have connected your Arduino Uno. You can check out your COM Port by going to Device Manager>PORTS(COM & LPT)

4.   Go to Programmer and select ‘AVRISP’.

5.   Now click on ‘Sketch’ on Menu Bar.

6.   Select Upload.

      (or)
   Press Ctrl + U
      (or)
Click on the button next to the ‘verify/compile’ button below the Menu Bar. (Button with a right arrow).

  If you are using an USBasp cable instead of Arduino Cable, then Choose USBasp in the Programmer options.

And then go to ‘Sketch’ and select ‘Upload using Programmer’ (or) press Ctrl+Shift+U.

Alternative for accelerometer – Gyroscope

  Build your own code and then give it a try.

  You can also use different Arduino Boards with the compatible controller and any other accelerometer model whichever is available in the market and if cost is a factor.

  Just make sure to refer to the datasheet of that sensor model and the pin connections may also vary.