Hand Gesture Controlled Car

0
1476

Hand Gesture Controlled Car is designed using Arduino. Palm gesture is the main controlling area that controls the movement of the car. This Gesture Controlled Car will provide a platform for business robots and higher intelligence embedding robots like humanoids.

Working and Explanation

Gesture Controlled Robot Using Arduino consists of 3 wheels and the wheels are coupled with one motor each and are tie to a single center. Since all the wheels coupled with the motor are tie to a single-center, each wheel will have a 120-degree distance from the other 2 wheels, assume that the length of end to end from wheel to motor is the same among 3 wheels, it is forming an equilateral triangle.

To control a movement in the desire direction, three wheels will rotate with specific velocity to move the robot in the direction wanted.

The robotic car can move forward, reverse, left, or right by performing some hand gesture. A 2-axis accelerometer is used to get the x-axis measurement and the y-axis measurement of the human hand and transmit the data to the robotic car via RF. So, x-axis measurement will perform left and right turn while y-axis measurement will perform forward and reverse movement.

Block Diagram

The following image shows the simple block diagram of the sender and receiver part of the Gesture Controlled Robot.

gesture control robot
Hand Gesture Controlled Robot
Block Diagram of Transmitter circuit
gesture control robot
Hand Gesture Controlled Robot
Block Diagram of Receiver circuit

Components used:

The following are the components used in gesture controlled robot

  • Arduino UNO
  • Arduino Nano
  • RF Transmitter
  • 24L01
  • MPU6050 Accelerometer/Gyroscope Sensor
  • H-Bridge
  • 33KΩ Resistor
  • 330Ω Resistor
  • 750KΩ Resistor
  • LED
  • Four Geared Motors
  • Wheels
  • Robot Chassis
  • Vero Board
  • PCB Board

Circuit Design

gesture control robot
Hand Gesture Controlled Robot
Complete Model of Hand gesture Robot

Coding(Hand Gesture Controlled Robot)

Receiver side code:

#include <SPI.h>

#include <nRF24L01.h>

#include <RF24.h>

RF24 radio(7 , 8 ); // CE , CSN

const byte address[6] = “00001”;

int motor_left_cw = 10;

int motor_left_ccw = 9;

int motor_right_cw = 6;

int motor_right_ccw = 5;

int left = 0;

int right = 0;

int back = 0;

int frwrd = 0;

int zero = 0;

void setup()

{

Serial.begin (9600);

pinMode(motor_left_cw, OUTPUT);

pinMode(motor_left_ccw, OUTPUT);

pinMode(motor_right_cw, OUTPUT);

pinMode(motor_right_ccw, OUTPUT);

analogWrite(motor_left_cw, 0);

analogWrite(motor_left_ccw, 0);

analogWrite(motor_right_cw, 0);

analogWrite(motor_right_ccw, 0);

radio.begin();

radio.openReadingPipe (0, address );

radio.setPALevel (RF24_PA MIN);

radio.startListening ();

}

void loop()

{

if (left == 1)

{

analogWrite(motor_left_cw, 150);

analogWrite(motor_left_ccw, 0);

analogWrite(motor_right_cw, 0);

analogWrite(motor_right_ccw, 150);

}

if (right == 1)

{

analogWrite(motor_left_cw, 0);

analogWrite(motor_left_ccw, 150);

analogWrite(motor_right_cw, 150);

analogWrite(motor_right_ccw, 0);

}

if (back == 1)

{

analogWrite(motor_left_cw, 150);

analogWrite(motor_left_ccw, 0);

analogWrite(motor_right_cw, 150);

analogWrite(motor_right_ccw, 0);

}

if (frwrd == 1)

{

analogWrite(motor_left_cw, 0);

analogWrite(motor_left_ccw, 150);

analogWrite(motor_right_cw, 0);

analogWrite(motor_right_ccw, 150);

}

if (zero == 1)

{

analogWrite(motor_left_cw, 0);

analogWrite(motor_left_ccw, 0);

analogWrite(motor_right_cw, 0);

analogWrite(motor_right_ccw, 0);

}

if (radio.available())

{

char text[32] = “”;

radio.read (&text, sizeof (text));

if (text [0] == ‘L’)

{

left = 1;

zero = 0; Serial.println(“left”);

}

if (text[0] == ‘R’)

{

right = 1;

zero = 0; Serial.println(“right”);

}

if (text[0] == ‘B’)

{

back = 1;

zero = 0;

Serial.println(“back”);

}

if (text[0] == ‘F’)

{

frwrd = 1;

zero = 0; Serial.println(“frwrd”);

}

if (text[0] == ‘O’)

{

left = 0;

right = 0;

back = 0;

frwrd = 0;

zero = 1; Serial.println(“zero”);

}

}

}

Transmitter side

#include <SPI.h>

#include <nRF24L01.h>

#include <RF24.h>

#include <Wire.h>

#define MPU 0x68  // MPU-6050: I2C address

double AcX,AcY,AcZ;

int Pitch, Roll;

RF24 radio(7 , 8 ); // 1CE,  CSN

Const byte address[6] = “00001”;

int flag1 = 0;

int flag2 = 0;

void setup()

{

Serial.begin (9600);

radio.begin ();

init_MPU();

radio.openWritingPipe(address );

radio.setPALevel (RF24_PA_MIN);

radio.stopListening();

}

void loop()

{

if((Roll < 25 && Roll > -25) && (Pitch < 25 && Pitch> -25))

{

const char text[] = “O”;

radio.write(&text, sizeof(text));

flag2 = 1;

}

if(Pitch > 25 && flag2 == 0)

{

const char text [] = “R”;

radio.write(&text, sizeof(text));

flag1 = 0;

}

if(Pitch < -25 && flag2 == 0)

{

const char text [] = “L”;

radio.write(&text, sizeof(text));

flag1 = 0;

}

if(Roll < -25 && flag2 == 0)

{

const char text [] = “B”;

radio.write(&text, sizeof(text));

flag1 = 0;

}

if(Roll > 25 && flag2 == 0)

{

const char text [] = “F”;

radio.write(&text, sizeof(text));

flag1 = 0;

}

flag2 = 0;

delay(150);

FunctionsMPU ();

Roll = FunctionsPitchRoll (AcX, AcY, AcZ);

Pitch = FunctionsPitchRoll (AcY, AcX, AcZ); Serial.print (“Pitch: “);

Serial.print (Pitch ); Serial.print (“\t”);

Serial.print (“Roll: “);

Serial.print (Roll );

Serial.print (“\n”);

}

void init_MPU()

{

Wire.begin ();

Wire.beginTransmission (MPU);

Wire.write (0x6B);

Wire.write (0);

Wire.endTransmission (true);

delay (1000);

}

double FunctionsPitchRoll (double A, double B, double C)

{

double DatoA, DatoB, Value;

DatoA = A;

DatoB = (B*B) + (C*C);

DatoB = sqrt (DatoB);

Value = atan2 (DatoA, DatoB);

Value = Value * 180/3.14;

return (int) Value;

}

void FunctionsMPU ()

{

Wire.beginTransmission (MPU );

Wire.write (0x3B );

Wire.endTransmission (false );

Wire.requestFrom ( MPU,6,true );

AcX=Wire.read ()<<8|Wire.read ();

AcY=Wire.read ()<<8|Wire.read ();

AcZ=Wire.read ()<<8|Wire.read ();

}

Leave a Reply