loading

OBSTACLE AVOIDING ROBOT
FUNDED BY;INTEL KENYA IN ASSOCIATION WITH SOCIETY OF ENGINEERING STUDENTS AUTOMATION CLUB JKUAT.

PROJECT MEMBERS:

1 ANTONY KARIUKI

2 ERIC KINYANJUI

3 EMMANUEL KINYANJUI

PROJECT INSTRUCTABLE:

REQUIREMENTS:

1 INTEL GALILEO GENERATION 2 BOARD

2 SERVO MOTOR

Servos are basically Dc motors with position feedback that means you can tell the microcontroller through your code to move the servo to the desired position.In galileo board a standard servo can be moved between 0 to 180 degree and 90 is the servo center(makes senseServo has three wires i.e.Brown,Red,Yellow or the color maybe Black,Red,White.

1 Brown or black wire is to be connected to ground of the microcontroller.

2 Red wire is to be connected to Vcc(4.8V to 6V).

3 Yellow or white wire is to be connected to the digital output of the microcontroller and is called signal wire.

3 1BREAD BOARD

Half sized breadboard is enough for this robot.

4 GAUGE WIRES AND JUMPER WIRES

For making connections on the breadboard you will need either gauge wire or male to male jumper wires.

5 1 L293D MOTOR DRIVER

L293D is a 16 pin chip and is a popular motor driver which can be used for small motors that have low output current.

6 1 X Sharp GP2D12 analog distance sensor.

The sensor consists of two eyes.One eye sends the infrared light and the other eye sees the reflection of that infrared light and measures the distance which is then sent to the microcontroller through analog input to perform further operations based on the distance(the operations should be defined in the code.

There are three wires coming from the sensor.i.e.Red,Black adn White or it can be Red,Brown and Yellow.

1 Red is connected to 5V of arduino.

2 Black or brown to Ground of arduino.

3 White or yellow to analog input pin of galileo boardi.e. in this case to analog pin 0

7 BATTERIES

The Galileo board itself needs 9V(recommended).So it is better to use two different battery packs.

1 x 9V PP3 battery for the board and 4 AA batteries i.e. 6V for motors and servo.

8 1 x 4 AA Battery Holder

9 2 x Battery connector

One battery connector should have a DC plug at the end so that it can be directly plugged in to the dc jack of galileo.The Dc plug can be bought at any local electronics shop easily.

10 1 x double sided tape

We wont be using any screws or nuts for mounting the components.We will just stick the components on the acrylic plate using double sided tape.

11 Soldering Iron

A standard soldering iron

PROCEDURE

1 First we soldered the wires to the motor leads.In my case,i have cut the male to male jumpers in half and soldered them to the motor leads.It helps in easy connections on the breadboard.

2 We then mounted the wheels to the motor shaft with the help of screw that you got with the wheels.

3 After that we mounted the castor wheel on the bottom front and center(roughly) of the robot using double sided tape.The castor wheel usually comes with holes in it for easy mounting using small nuts and bolts but if you dont want to drill holes on the acrylic sheet(robot base) then you can simply stick it with double sided tape as i did.

4 Then we placed the two motors on the acrylic sheet with the help of double sided .The distance between the front castor wheel and the rear wheels was as small as possible.

5 We then placed a servo in the front using double sided tape

6 The intel galileo board and breadboard were placed on the base using a double sided tape.

7 We then placed a 9V battery with the connector(with dc plug) and 4 AA batteries with the connector(without the dc plug) on the robot base.

8 The power distribution in this circuit is as follows:The sensor and both the enable pins of L293D motor driver are powered through 5V regulated supply from the galileo board. The board uses 9V power and regulates it to 5V with the help of onboard voltage regulator.The motors and servo are powered by 6V(4 AA batteries).

9 We connected the circuit as shown below;

10 From the circuit:

The signal wire(white or yellow) of the sharp sensor is connected to analog pin 0 of the galileo ,Vcc(red) to 5V and ground(black or brown) to ground of galileo .Color of the wires may vary.

The signal wire(white or yellow) of servo is connected to digital pin 8 of galileo ,Vcc(red) to 6V and ground(black or brown) to ground of galileo.(the ground of the 6V battery pack and galileo should be combined).Color of the wires may vary.

The motors are driven by digital pins 4,5,6 and 7 and are powered by 6V.

CODE

The code used for the obstacle avoiding robot included;

#include //includes the servo library

int motor_pin1 = 4;

int motor_pin2 = 5;

int motor_pin3 = 6;

int motor_pin4 = 7;

int servopin = 8;

int sensorpin = 0;

int dist = 0;

int leftdist = 0;

int rightdist = 0;

int object = 500; //distance at which the robot should look for another route

Servo myservo;

void setup ()

{

pinMode(motor_pin1,OUTPUT);

pinMode(motor_pin2,OUTPUT);

pinMode(motor_pin3,OUTPUT);

pinMode(motor_pin4,OUTPUT);

myservo.attach(servopin);

myservo.write(90);

delay(700);

}

void loop()

{

dist = analogRead(sensorpin); //reads the sensor

if(dist < object) { //if distance is less than 550

forward(); //then move forward

}

if(dist >= object) { //if distance is greater than or equal to 550

findroute();

}

}

void forward() { // use combination which works for you

digitalWrite(motor_pin1,HIGH);

digitalWrite(motor_pin2,LOW);

digitalWrite(motor_pin3,HIGH);

digitalWrite(motor_pin4,LOW);

return;

}

void findroute() {

halt(); // stop

backward(); //go backwards

lookleft(); //go to subroutine lookleft

lookright(); //go to subroutine lookright

if ( leftdist < rightdist )

{

turnleft();

}

else

{

turnright ();

}

}

void backward() {

digitalWrite(motor_pin1,LOW);

digitalWrite(motor_pin2,HIGH);

digitalWrite(motor_pin3,LOW);

digitalWrite(motor_pin4,HIGH);

delay(500);

halt();

return;

}

void halt () {

digitalWrite(motor_pin1,LOW);

digitalWrite(motor_pin2,LOW);

digitalWrite(motor_pin3,LOW);

digitalWrite(motor_pin4,LOW);

delay(500); //wait after stopping

return;

}

void lookleft() {

myservo.write(150);

delay(700); //wait for the servo to get there

leftdist = analogRead(sensorpin);

myservo.write(90);

delay(700); //wait for the servo to get there

return;

}

void lookright () {

myservo.write(30);

delay(700); //wait for the servo to get there

rightdist = analogRead(sensorpin);

myservo.write(90);

delay(700); //wait for the servo to get there

return;

}

void turnleft () {

digitalWrite(motor_pin1,HIGH); //use the combination which works for you

digitalWrite(motor_pin2,LOW); //right motor rotates forward and left motor backward

digitalWrite(motor_pin3,LOW);

digitalWrite(motor_pin4,HIGH);

delay(1000); // wait for the robot to make the turn

halt();

return;

}

void turnright () {

digitalWrite(motor_pin1,LOW); //use the combination which works for you

digitalWrite(motor_pin2,HIGH); //left motor rotates forward and right motor backward

digitalWrite(motor_pin3,HIGH);

digitalWrite(motor_pin4,LOW);

delay(1000); // wait for the robot to make the turn

halt();

return;

}

<p>Really cool idea! Thanks for sharing and welcome to the community! </p>

About This Instructable

260views

6favorites

License:

More by AntonyKabiru:Robot -Obstacle Avoiding. 
Add instructable to: