Click here to Skip to main content
15,886,873 members
Articles / Internet of Things
Article

Simple Obstacle Avoidance Robot

19 Aug 2016CPOL3 min read 21.9K   9  
This project is about a simple obstacle avoiding robot using Intel® Edison module. Robotics is an exciting and fun hobby that has become very affordable in recent years.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

Summary

This project is about a simple obstacle avoiding robot using Intel® Edison module. Robotics is an exciting and fun hobby that has become very affordable in recent years. Lets do it.

Parts List

  • Cardboard.
  • Battery.
  • Ball bearing for front roller.
  • 2 servo motors.
  • 2 matching wheels.
  • Intel Edison with Arduino breakout board.
  • Breadboard.
  • Ultrasonic Range sensor – HC-SR04.
  • Capacitors (220uF).
  • Jumper Wires,rubber bands,Glues, etc…

Image 1

Steps To Be Followed

Step 1: Chassis

We chose a simple cardboard based chassis with the servos attached to it with the help of rubber bands. Make it convenient for your use. The above choices work as long as your rover is roving over smooth surfaces. Attach the front ball bearing in front of the cardboard.

Set front wheel ball bearing:Image 2

Attach single servo motor:

Image 3

Attach both servo motors:

Image 4

our chassis is ready.

Step 2: Arduino Board With Intel Edison

Configure your arduino board with intel edison. Look at this link to configure (https://software.intel.com/en-us/iot/library/edison-getting-started). Make sure your serial communiction and port are fixed. Check out your arduino board with intel edison by loading a simple program to your board.

Image 5

Let's check out our board with simple blinking led.

Image 6

Step 3: Battery And Board

Mount this battery using battery holder and board then later secure it to the chassis using rubber bands – surprisingly this works pretty well (remember this is planned on using this on smooth surfaces only – adjust the attach according to your plans). We have to use 6 AA battery holder in order to hold six batteries (based on motors you can use your batteries).

Step 4: Arduino Pins

These are the ARDUINO PINS which it is attached for this project. You can set the pins on your own.

Ultrasonic Range Sensor (HC-SR04) ECHO 9
Ultrasonic Range Sensor (HC-SR04) TRIG 10
Servo signal (left) 5
Servo signal (right) 6

Step 5: Ultrasonic Range Sensor (HC-SR04)

First of all check Ultrasonic Range Sensor (HC-SR04) by using a simple arduino code. Connect the ultra sonic sensor using some jumper wires.

Image 7

Here we have checked our ultra sonic sensor using simple program.

Image 8

By checking in serial port of arduino uno we can have a clear thought that it is working. Ultrasonic sensor shows the distance of the object in front of it. Here in our code distance is calculated in centimeter.

Below image shows the distance calculated by ultrasonic sensor in serial port (cm).

Image 9

Step 6: Servo Motor Connections

The wiring needed for connecting the servo cable — 3 pin connection coming out from the servo – red (vcc), black(ground) and in my case yellow(signal). The picture (Servo wiring 1) shows the 220uF capacitor connected between vcc/ground – this is needed for each servo in order to avoid the brownout issues. Since we are using the same battery source to power the servos and the board. on sudden rover turn of directions, there can be spikes of current draw which can cause the board to recycle if we don’t provide a sizeable capacitor (220uF works just fine in our case). The pictures show wiring for 1 servo without the servo cable attached (Servo wiring 1) with the servo cable attached (Servo wiring 2) and then both the servo cables attached.

Image 10

Step 7: Coding And Testing

Apply the code and test it.

#include<Servo.h>
#define trigpin 10 // Trigger pin
#define echopin 9 // echo pin

Servo servoLeft;
Servo servoRight;

int forward = 180;
int backward = 0;

void setup() {
Serial.begin(9600);
servoLeft.attach(5);
servoRight.attach(6);

pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);

}

void loop ()
{
int duration, distance;
servoRight.write(forward);
servoLeft.write(forward);

digitalWrite(trigpin, HIGH);
delayMicroseconds(1000);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin, HIGH);

distance = ( duration / 2) / 29.1;

delay(1000);
if (distance >= 10)
{
Serial.print(distance);
Serial.println(" cm");
}
else
{
Serial.println("danger");
servoLeft.write(90);
servoRight.write(90);
delay(1000);

servoLeft.write(backward);
servoRight.write(forward);
delay(5000);
servoLeft.write(forward);
servoRight.write(forward);

}

}

Now we have done. Here is our simple obstacle avoiding robot using intel edison.

Image 11

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
This is a Organisation

42 members

Comments and Discussions

 
-- There are no messages in this forum --