Tuesday, December 31, 2019

#Wired Gesture controlled robot

Gyroscope Controlled Robot (Wired)



Gyroscopes are used in mostly all devices. The most common example is the smartphones. The Gyro sensors are used to sense the angular velocity and using that data we can control the movement of the robot. Unlike accelerometers which measure linear acceleration, the Gyroscope sensors adds an additional dimension to the accelerometer thus allowing us to measure the angular velocity.
Today we will learn to make a Gyroscope controlled robot using Arduino and GY521 Gyroscope sensor.

Working :

The gyroscope sensor is also known as the tilt sensor. It senses its movements and provides the values to the arduino. The gyroscope module works in all the three axis namely the x,y and z. When the arduino receives these values it uses them with the if else statements to drive the motors accordingly. 
This project is a wired project. i.e. The Arduino and Gyro sensor is connected to each other using wires. This project can be used for surveillance and the only disadvantage with this project is its wired connections.

Components used in this project :



1. Arduino Uno.

2. GY-521 MPU-6050 Gyroscope sensor.

3. Motor Driver Module.

4. Metal chassis and wheels.

5. Connecting wires.

6. Double sided tape.

7. Batteries or adapter to power the board.

Circuit Diagram :

The circuit diagram for this project is shown below. Do all the connections accordingly.


You can also download the circuit diagram by clicking HERE .

Place all the components on metal chassis and fix them with the help of some double sided tape.

Here are some screen shots of the project.




Now connect the Arduino to your PC and upload the code.

CODE :

#include<Wire.h>
const int MPU_addr=0x68;  // I2C address of the MPU-6050
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
 const int trigPin=13;
 //Motor A
const int motorPin1  = 5;
const int motorPin2  = 6;
//Motor B
const int motorPin3  = 10;
const int motorPin4  = 9;
void setup()
{
  pinMode(trigPin,OUTPUT);
  pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
  Wire.begin();
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x6B);
  Wire.write(0); 
  Wire.endTransmission(true);
  Serial.begin(9600);
}
void loop(){
  Wire.beginTransmission(MPU_addr);
  Wire.write(0x3B);
  Wire.endTransmission(false);
  Wire.requestFrom(MPU_addr,14,true);
  AcX=Wire.read()<<8|Wire.read(); 
  AcY=Wire.read()<<8|Wire.read();
  AcZ=Wire.read()<<8|Wire.read();
  Tmp=Wire.read()<<8|Wire.read();
  GyX=Wire.read()<<8|Wire.read();
  GyY=Wire.read()<<8|Wire.read();
  GyZ=Wire.read()<<8|Wire.read();
  Serial.print("AcX = "); Serial.print(AcX);
  Serial.print(" | AcY = "); Serial.print(AcY);
  Serial.print(" | AcZ = "); Serial.print(AcZ);
  Serial.print(" | Tmp = "); Serial.print(Tmp/340.00+36.53);
  Serial.print(" | GyX = "); Serial.print(GyX);
  Serial.print(" | GyY = "); Serial.print(GyY);
  Serial.print(" | GyZ = "); Serial.println(GyZ);
  if(AcX<-6000&&-11000)
  {
    digitalWrite(trigPin,HIGH);
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);//FORWARD
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
  }
  else if(AcX>4000&&6000)
  {
   digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);//REVERSE
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
  }
   else if(AcY<-7000&&-5000)
  {
   digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);//LEFT
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
  }
  else if(AcY>5000&&12000)
{
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);//RIGHT
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
}
  else
  {
    digitalWrite(trigPin,LOW);
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);//STOP
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
  }
  delay(333);
}

You can also download the code from HERE .

After this power the Arduino and Motor driver and that's it. Your project is ready to be tested.

Wednesday, December 18, 2019

#Wirelss gesture controlled robot

Hand Gesture Controlled Robot using Arduino

In this project, we have designed a simple Hand Gesture Controlled Robot using Arduino. This Hand Gesture Controlled Robot is based on Arduino Nano, MPU6050, RF Transmitter-Receiver Pair and L293D Motor Driver.
Even though the title says it as a Hand Gestured Controlled Robot, technically this robot is controlled by the tilt of the hand. 

Table of Contents

Saturday, December 14, 2019

#line follower robot

How to make line follower robot- using Arduino ??

Line follower Robot is a machine which follows a line, either a black line or white line. Basically there are two types of line follower robots: one is black line follower which follows black line and second is white line follower which follows white line. Line follower actually senses the line and run over it.

Concepts of Line Follower

Concept of working of line follower is related to light. We use here the behavior of light at black and white surface. When light fall on a white surface it is almost full reflected and in case of black surface light is completely absorbed. This behavior of light is used in building a line follower robot.
Concept of White Line Follower Robot
Concept of Black Line Follower Robot
In this arduino based line follower robot we have used IR Transmitters and IR receivers also called photo diodes. They are used for sending and receiving light. IR transmits infrared lights. When infrared rays falls on white surface, it’s reflected back and catched by photodiodes which generates some voltage changes. When IR light falls on a black surface, light is absorb by the black surface and no rays are reflected back, thus photo diode does not receive any light or rays.
Here in this arduino line follower robot when sensor senses white surface then arduino gets 1 as input and when senses black line arduino gets 0 as input.

Circuit Explanation

The whole arduino line follower robot can be divided into 3 sections: sensor section, control section and driver section.

Sensor section:
This section contains IR diodes, potentiometer, Comparator (Op-Amp) and LED’s. Potentiometer is used for setting reference voltage at comparator’s one terminal and IR sensors are used to sense the line and provide a change in voltage at comparator’s second terminal. Then comparator compares both voltages and generates a digital signal at output. Here in this line follower circuit we have used two comparator for two sensors. LM 358 is used as comparator. LM358 has inbuilt two low noise Op-amps.

Control Section:
Arduino Pro Mini is used for controlling whole the process of line follower robot. The outputs of comparators are connected to digital pin number 2 and 3 of arduino. Arduino read these signals and send commands to driver circuit to drive line follower. 

Driver section:
Driver section consists motor driver and two DC motors. Motor driver is used for driving motors because arduino does not supply enough voltage and current to motor. So we add a motor driver circuit to get enough voltage and current for motor. Arduino sends commands to this motor driver and then it drive motors.

Working of Line Follower Robot using Arduino

Working of line follower is very interesting. Line follower robot senses black line by using sensor and then sends the signal to arduino. Then arduino drives the motor according to sensors' output.
Working of Line Follower Robot using Arduino
Here in this project we are using two IR sensor modules namely left sensor and right sensor. When both left and right sensor senses white then robot move forward.
Working of Arduino Line Follower Robot
If left sensor comes on black line then robot turn left side.
Turning left to line follower robot using arduino
If right sensor sense black line then robot turn right side until both sensor comes at white surface. When white surface comes robot starts moving on forward again.
Turning right to line follower robot
If both sensors comes on black line, robot stops.
Stopping Arduino Line Following Robot

Code-

int s1= A2;
int s2= A4;
int R1=7;
int R2=8;
int L1=10;
int L2= 11
void setup(){
    Serial.begin(115200);
    pinMode(s1,INPUT);
    pinMode(s2,INPUT);
    pinMode(L1,OUTPUT);
    pinMode(L2,OUTPUT);
    pinMode(R1,OUTPUT);
    pinMode(R2,OUTPUT);
}

void loop(){
    int s1 = digitalRead(A1);
    int s2 = digitalRead(A4);
    Serial.print(s1);
    Serial.print("\t");
    Serial.print(s2);
    Serial.print("\t");
  
    
//FORWARD
   
 if(s1==1 && s2 == 1){
       digitalWrite(R1,HIGH);
       digitalWrite(R2,LOW);
       digitalWrite(L1,HIGH);
       digitalWrite(L2,LOW);
        
    }
       
    }
    //TURN LEFT
  if(s1 == 0 && s2 == 1){
       digitalWrite(R2,LOW);
       digitalWrite(R1,LOW);
       digitalWrite(L2,HIGH);
       digitalWrite(L1,HIGH);
      
    }
    //TURN RIGHT 
   if(s1 == 1 &&  s2 == 0){
        digitalWrite(R2,HIGH);
        digitalWrite(R1,HIGH);
        digitalWrite(L2,LOW);
        digitalWrite(L1,LOW);
    }
    
}