Table of Contents
Introduction
Hey guys, hope you are doing fine. We are back with another new post on Arduino projects. In this article, we are going to make a hand gesture controlled robot arm using Arduino UNO. For sensing the movement of our hand we are using four IR sensors. You have to place them in four different directions with their heads upwards. You can also check out more projects on Arduino and IoT made by us. Make the circuit according to the diagram and then upload the code to the Arduino.
Description
- In this project we can control the movement of the robotic arm without touching it.
- We can control it by the gestures of our hand.
- The IR sensors that we use in this circuit sens the movement of our hands.
- The IR sensors can generate a high signal when they found any obstacle in their range.
- One servo motor is used to control the movement of the x-axis and the other is used to control the movement of the y-axis.
- When you hover your hand over the sensors the robot arm will move accordingly.
- These kinds of robotic arms are very popular nowadays.
- Many industries use these kinds of machines for increasing their productivity. Read the article carefully and try to make it on your own.
- You can also check the WiFi controlled robot using nodemcu made by us.
Components Required
- Arduino UNO
- 4 x IR sensor
- 2 x Servo motor
- Cardboard pices
- Jumper wires and a breadboard
- USB cable for uploading the code
Circuit For Hand Gesture Controlled Robot
- First of all, take two servo motors and place them one over the other as shown in the project image.
- You can use a piece of cardboard for this purpose.
- Then connect the positive supply wire of both the servo motors with the 5 volts pin of the Arduino.
- Join the negative supply wire of the servos with the GND pin of the Arduino.
- Connect the signal wire of the first servo motor with the digital-12 pin of the Arduino.
- Attach the signal wire of the second servo motor with the digital-13 pin of the Arduino.
- Then take four IR sensors and join their VCC pin with the 5 volts pin of the Arduino.
- Connect the GND pins of the sensors with the GND pin of the Arduino.
- Use the breadboard for making connections. Join the OUT pin of the first, second, third, and fourth IR sensor with the digital-8, digital-6, digital-7, and digital-9 pins of the Arduino. Your circuit is now ready to use.
Code For Hand Gesture Controlled Robot
NOTE: Please upload this code to the Arduino. Before uploading please install <Servo.h> if it is showing the error. You can check here how to add a zip library to the Arduino IDE.
//Techatronic.com
#include<Servo.h>
Servo motor1;
Servo motor2;
int sensor1 = 8;
int sensor2 = 6;
int sensor3 = 7;
int sensor4 = 9;
void setup() {
pinMode(sensor1,INPUT);
pinMode(sensor2,INPUT);
motor1.attach(12);
motor2.attach(13);
// Serial.begin(9600);
}
void loop() {
int top = digitalRead(sensor1);
int bottom = digitalRead(sensor2);
int right = digitalRead(sensor3);
int left = digitalRead(sensor4);
//Serial.println(top);
//Serial.println(bottom);
//Serial.println(right);
//Serial.println(left);
if (top == 1 && bottom == 1 && right == 1 && left == 1)
{
motor1.write(60);
motor2.write(60);
}
else if(top == 1 && bottom == 1 && right == 1 && left == 0)
{
motor1.write(0);
motor2.write(60);
}
else if(top == 1 && bottom == 1 && right == 0 && left == 1)
{
motor1.write(180);
motor2.write(60);
}
else if(top == 1 && bottom == 1 && right == 0 && left == 0)
{
motor1.write(60);
motor2.write(60);
}
else if(top == 1 && bottom == 0 && right == 1 && left == 1)
{
motor1.write(60);
motor2.write(0);
}
else if(top == 1 && bottom == 0 && right == 1 && left == 0)
{
motor1.write(0);
motor2.write(0);
}
else if(top == 1 && bottom == 0 && right == 0 && left == 1)
{
motor1.write(180);
motor2.write(0);
}
else if(top == 1 && bottom == 0 && right == 0 && left == 0)
{
motor1.write(60);
motor2.write(0);
}
else if(top == 0 && bottom == 1 && right == 1 && left == 1)
{
motor1.write(60);
motor2.write(180);
}
else if(top == 0 && bottom == 1 && right == 1 && left == 0)
{
motor1.write(0);
motor2.write(180);
}
else if(top == 0 && bottom == 1 && right == 0 && left == 1)
{
motor1.write(180);
motor2.write(180);
}
else if(top == 0 && bottom == 1 && right == 0 && left == 0)
{
motor1.write(60);
motor2.write(180);
}
else if(top == 0 && bottom == 0 && right == 1 && left == 1)
{
motor1.write(60);
motor2.write(60);
}
else if(top == 0 && bottom == 0 && right == 1 && left == 0)
{
motor1.write(0);
motor2.write(60);
}
else if(top == 0 && bottom == 0 && right == 0 && left == 1)
{
motor1.write(180);
motor2.write(60);
}
else if(top == 0 && bottom == 0 && right == 0 && left == 0)
{
motor1.write(0);
motor2.write(0);
}
}
We hope that you liked this project and understand it completely. If you have any doubts regarding this project then feel free to use the comments section given below. Also, you can check out more tutorials on Arduino and Raspberry Pi.
Thanks for reading.