Using Arduino's accelerometer based gesture control robot

Posted by Darhazer on Sun, 20 Feb 2022 07:47:36 +0100

Original address:

Using Arduino's accelerometer based gesture control robot


Pass by** Saddam **July 28, 2015 135

Robots play an important role in the automation field of construction, military, medical, manufacturing and other fields. After making some basic robots (such as Linear follower robotComputer controlled robot After that, we developed this accelerometer based gesture control robot by using aldunounouno. In this project, we use gestures to drive the robot. For this purpose, we use accelerometers.

Required components

  1. Arduino UNO
  2. DC motor
  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 chassis

RF pair:

Gesture controlled robots are controlled by using hands instead of any other method such as buttons or joysticks. Here, you can control the robot with your hands. Your hand uses a transmitting device that contains an RF transmitter and an accelerometer. This transmits commands to the robot so that it can perform the required tasks, such as forward, backward, left, right and stop. All these tasks will be performed by hand gestures.

The most important component here is the accelerometer. Accelerometer is a 3-axis acceleration measuring device with + - 3g range. The device is made by using polysilicon surface sensor and signal conditioning circuit to measure acceleration. The output of the device is analog in nature and proportional to the acceleration. When we tilt gravity, the device measures the static acceleration of gravity. The results are given in the form of motion or vibration.

According to the data sheet of adxl335, the surface micromachined structure of polysilicon is placed on the silicon dome. Polysilicon springs suspend the structure above the wafer surface and provide the ability to resist acceleration. The deformation of the structure is measured using a differential capacitor, which includes an independent fixed plate and a plate connected to a moving mass block. The fixed plate is driven by 180 ° out of phase square wave. The acceleration will deflect the moving mass and unbalance the differential capacitor, resulting in the amplitude of the sensor output proportional to the acceleration. Then phase sensitive demodulation technology is used to determine the magnitude and direction of acceleration.

Pin description of accelerometer

  1. VCC 5V power supply should be connected to this pin.
  2. X-OUT this pin provides an analog output in the x direction
  3. Y-OUT this pin provides an analog output in the y direction
  4. The analog output is provided in the out-z direction
  5. GND ground
  6. ST this pin is used to set the sensitivity of the sensor

Circuit diagram and description

The gesture control robot is divided into two parts:

  1. Transmitter part
  2. Receiver part

In the transmitter part, accelerometer and RF transmitter unit are used. As we have discussed, the accelerometer provides analog output, so here we need to convert the analog data to digital. To this end, we use a 4-channel comparator circuit to replace any ADC. By setting the reference voltage, we get a digital signal, then apply the signal to the HT12E encoder to encode the data or convert it into serial form, and then send the data to the environment using the RF transmitter.

On the receiver side, we have used the RF receiver to receive data and then applied it to the HT12D decoder. The decoder IC converts the received serial data into parallel data, and then reads it with arduino. According to the received data, we use two DC motors to drive the robot in the forward, backward, left, right and stop directions.

On the job

When we put the transmitter in our hand, the gesture controlled robot will move according to the movement of the hand. When we tilt our hand forward, the robot starts moving forward and continues moving forward until the next command is issued.

When we tilt the hand backward, the robot will change its state and start moving backward until other commands are issued.

When we tilt it to the left, the robot will turn left until the next command.

When we tilt our hand to the right, the robot will turn to the right.

For stopping the robot, we remain stable.

Circuit diagram of transmitter

Circuit diagram of receiver

The circuit of this gesture to control the robot is very simple. As shown in the above schematic diagram, the RF pair is used for communication and connected with arduino. The motor driver is connected to arduino to run the robot. Input pins 2, 7, 10 and 15 of the motor driver are connected to arduino digital pins 6, 5, 4 and 3, respectively. Here, we use two DC motors to drive the robot, one of which is connected to the output pins of motor drivers 3 and 6, and the other is connected to 11 and 14. A 9 volt battery is also used to power the motor driver.

Program description

First, in the program, we define the output pin of the motor.

Then in the setting process, we give fixed instructions.

After that, we use the "if statement" to read the input and perform related operations.

The gesture control robot has the following five conditions:

Hand movementGesture input Arduino
stable0000stop it
Tilt right0001Turn right
Tilt left0010Turn left
Tilt back1000backward
Before tilting0100forward

We have written a complete program according to the conditions in the above table. The following is the complete 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)

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

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

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