loading

What could be more awesome than building your own robot.

This is how to do it your self.

Banana for scale in the last picture.

For mobile users. Watch the video from here!

Find the building kit from here!

Step 1: Components.

I used my previous project's shield and ultrasound sensor in this project.

Learn how to make the Radar from HERE! The build is explained there.

The base for the whole build is an old HDD lid. It is light weight and it hold's its shape well.

The wheels are just from an old toy car.

Two servos for the wheels is needed and one servo for the radar.

And of course some kind of Arduino based board is needed. I used Intel Edison+ Arduino breakout board.

Step 2: Making a Forever Rotating Servo.

Forever rotating servo means that it will turn more than the basic 0-180 degrees.

The forever rotating servo is great for this type usage. You can change the speed by entering differed value to the servo and also you can change the direction of rotation.

First find a simple test code from the internet to set up your servo.

I used a basic potentiometer on a shield and set the servo to 90 degrees. This way it is in the middle of its original rotation and it is easiest to program. Also the rotation speed of the servo is the same in both 0 and 180 degree.

Then remove the cap from the servo and pull out the gears.

In one gear there should be a small pin that stops the servo if it is turning too much. Cut that off.

Then make absolutely sure that the potentiometer is at 90 degree position and drop a small drop of superglue on the potentiometer to jam it on its place.

Then just put all the gears back and test the workings of the servo.

Step 3:

Attach your servos to the wheels and attach the servos to the base of your robot.

I used hot glue for basically connecting everything since it is very durable and hold's tightly on its place.

Don't worry about the front wheels at this point. I will get to them later.

Step 4: Add Connectors to the Radar Shield.

If you have not checked out my RADAR project yet, i suggest to look at it now since mostly of this pit of the project is done in my previously project.

Add two simple connectors for the two servos.

A slight modification to the radar shield had to be done however. This is just for convenience of the build.

The trigger and echo pins were moved to 7 and 8 pin.

And the two servos are connected to pin 3 and 5.

The radar servo is in pin 9.

Step 5: Coding and Testing

Lift the project on to something so the wheels will be up, this just eases the coding process.

If you have any questions about the code, just ask and i will try to answer them.

Start the code by making all the needed definitions and global variables.

To change the distance when the robot stops, change the dangerThresh to something else. like 10.

The threshold is in centimeters.

#include
#define ECHOPIN 8 #define TRIGPIN 7

const int RForward = 0; const int RBackward = 180; const int LForward = RBackward; const int LBackward = RForward; const int RNeutral = 90; const int LNeutral = 90;

const int dangerThresh = 20; int leftDistance, rightDistance; Servo panMotor; Servo leftMotor; Servo rightMotor; long duration;

Then it's time for setup.

void setup()
{ Serial.begin(115200); rightMotor.attach(5); leftMotor.attach(3); panMotor.attach(9); panMotor.write(75); pinMode(ECHOPIN, INPUT); pinMode(TRIGPIN, OUTPUT); }

And then for the main program, loop.

void loop()
{ int distanceFwd = Distance(); if (distanceFwd>dangerThresh) { leftMotor.write(LForward); rightMotor.write(RForward); } else { leftMotor.write(LNeutral); rightMotor.write(RNeutral); panMotor.write(0); delay(500); rightDistance = Distance(); delay(500); panMotor.write(150); delay(700); leftDistance = Distance(); delay(500); panMotor.write(75); delay(100); compareDistance(); } }

Then there is two subroutines.

One to compare the measured distances. This one tells the robot to go left or right, witch has more space to move.

void compareDistance()
{ if (leftDistance>rightDistance) { leftMotor.write(LBackward); rightMotor.write(RForward); delay(700); } else if (rightDistance>leftDistance) { leftMotor.write(LForward); rightMotor.write(RBackward); delay(700); } else { leftMotor.write(LForward); rightMotor.write(RBackward); delay(1000); } }

And subroutine for the distance calculation.

long Distance()
{ digitalWrite(TRIGPIN, LOW); delayMicroseconds(2); digitalWrite(TRIGPIN, HIGH); delayMicroseconds(10); digitalWrite(TRIGPIN, LOW);

float distance = pulseIn(ECHOPIN, HIGH); distance= distance/58.2; return(distance); }

Step 6: Adding Battery Pack.

The robots usage is pretty limited if it need's a cord to run, so at this point is good to make a battery pack for it.

The pack hold's six AA (LR6) battery's witch is plenty for the project. I haven't tried how long it can run.

Once again i used hot glue to hold the pack in its place.

The Edison is not hold with anything on the board. It just fits snugly on the base board so it wont need any. This means that changing the battery's is easy.

Step 7: Time for the Front Wheels.

These wheels are the same kind of wheels that are on the servos.

I used a BBQ stick to make the axle and a two pits of plastic to hold it in it's place.

Once again, Hot glue everything like there is no tomorrow.

Step 8: Done.

Now it is finally done.

I could say this is pretty easy project to do. It just takes some time to collect all the needed pits and parts.

Anyway, I hope you liked the build!

If you did, Make sure to follow me to get more projects!

Thank you for reading.

PS. Remember to watch the video ;)

Where I will write these code or with which software
<p>Hi!</p><p>This should get you started, <a href="https://www.arduino.cc/en/Main/Software" rel="nofollow">https://www.arduino.cc/en/Main/Software</a></p>
<p>i will try</p>
<p>Hey ! This is a very nice job ! I want make the same one but your building kit link is dead. Can you fix it please ? Thank you very much :)</p>
Thanks for giving the idea I was able to complete the robot and once again thanks for the idea of making this awesome robot.
<p>Is there any link other than the youtube for this vedio?</p>
<p>I can't find any vedio at the given link</p>
<p>Hello, seeing this tutorial, I wonder if it would be possible, do the ultrasound rotate rotate and detect all around you? a radius of a circle, for example of a meter, he would turn and detect all approach this circle.</p>
<p>Great work. For the video, I'd prefer to hear commentary instead of shredding guitar. Why do people feel embarrassed about technical prowess, and have to make a statement &quot;See, I'm not a nerd -- this cool music proves it&quot;? But excellent project.</p>
<p>Hi. Thanks for commenting. The reason i don't like to talk on my videos is that i'm not comfortable with it since i'm not a native speaker. Text is much more convenient way to &quot;communicate&quot; in videos. And also the music is free to use. :)</p><p>FYI. I have a degree in music (bass, drums and guitar) and also i'm Electronics technician, soon to be Engineer in the same field. </p><p>We Finns just like to listen metal, bang our heads to the wall and communicate as less as possible.</p>
I get it -- thanks for setting me straight. I apologize for sounding critical. I guess I was cranky. :) Thanks for your project! -Cheers
<p>How do you power the board, do the Intel Edison use 5V power supply? Btw, that batteries seem to be from Finland :)</p>
<p>Intel Edison has a build in regulator of 5 volts. So if you use like in this project 6*1.5 Volt battery's you will get 9 Volts that is regulated to 5 Volts for the board. It can handle Volts from 0 to about 15 Volts.</p><p>Jep Jep. Patterit on halvinta l&auml;hikaupan Smarket laatua ;D </p>
<p>I have a Galileo, wonder if the Galileo also has a built-in regulator? </p>
<p>Soo... this works on a Galileo?</p>
<p>No, I am not sure about everthing, but about the power supply, you need an extra voltage regulator.</p>
<p>I cant find any information about that.</p><p>This is what the datasheet says:</p><p>Galileo is powered via an AC-to-DC adapter, connected by plugging a 2.1mm center-positive plug into the <br>board's power jack. The recommended output rating of the power adapter is 5V at up to 3A.</p><p>So i think that means there is no regulator on that?</p><p><a href="http://www.intel.com/newsroom/kits/quark/galileo/pdfs/Intel_Galileo_Datasheet.pdf" rel="nofollow">http://www.intel.com/newsroom/kits/quark/galileo/p...</a> Here is a link to the datasheet</p>
<p>Had to mute the video. No sound would be better.</p>
<p>Great! The mute button is made just for you. Rest of that don't mind the music can keep audio on. </p><p>Everybody wins!</p><p>Have a nice day.</p>
<p>How do you connect your sensor? Do you connect it directly to your analog pin?</p>
<p>Hi, I use digital pins for the sensor. Pins 7 and 8.</p>
you have to be careful when removing pins from a servo because some potentiometers can't go 360 degrees instead you could use a motor with a gearbox and an encoder that way you don't need to worry about modifying the servo and you ensure that it can go 360 degrees
<p>Servos typical turning ratio is 180 degrees. No pin is removed in the servo modifying process. To use a motor with gearbox you will need a driver for that. For example this <a href="http://www.engineersgarage.com/electronic-components/l293d-motor-driver-ic" rel="nofollow">http://www.engineersgarage.com/electronic-componen...</a></p>
<p>Would stepper motors work for the wheels?</p>
<p>Well. That depends how you are going to use them. Wheels are the best for moving in this kind of build.</p>
<p>What I meant was can stepper motors be used instead of the servos to power the wheels.</p>
<p>Stepper motors can be used. But you will need more power to the board. I suggest using a stepper motor shield for this since the arduinos/edisons power supply is not enough.</p>
Very nice! I would have worried about spikes on the power. How are the servos powered?
<p>Servos are powered just with the 5V output. The servos are micro servos and don't draw too much current when in use. But the 3 servos is the max that i suggest using. Otherwise make or order a servo/motor shield.</p><p>Battery's are pretty solid and spike proof power supply. </p>
<p>Hi! Nice build. Is the robot can avoid stairs?</p>
<p>It can be programmed to avoid them. By default it can't since the ultrasound sensor looks straight ahead and not down. But it can be surely done.</p>
Off subject, but seems like you spelt &quot;robot&quot; wrong on your main picture.
it seems like it but in reality the font just has got that kind of B letter. :D Try look at it in artistic view point.
don't know why. it's a downloaded font .
I didn't know since the &quot;B&quot; in the word obstacle looks right.
Hello friends broke this ir jammer device this send information to the bill acceptor cant your this for me build send me one email writing me of this email rewe.dekra@web.de
hi. Could you please write that message again. I can't really understand what you are trying to say.
I meant to say quick enough on that pin
<p>Hi, The HC-SR04 has 4 pins to deal with. Vcc, Trigger, Echo and GND. The Arduino shield has worked like any other Arduino and i have had not any problems with anything so far. (check my distance bug project to see how to calibrate the sensor)</p><p>The Edison chip should be much faster than any Arduino atmel chip.</p><p>I think you might have a false information about that.</p><p>Here is an example.</p><p>If you calculate it with speed of sound, lets say the distance is about 2.5 meters. The sound takes about 15 ms to reach to the measured distance and the same time to get back. The whole process takes about 30 ms and if Arduino isn't fast enough for that, it is useless for anything.</p><p>The same goes with a three pin sensor. Just try it and you will be surprised.</p><p>Thank you for commenting!</p>
Nice build I thought I read about the edison not having the ability with the arduino shield to change between input and output on one pin to use a three wire ping sensor so I haven't messed with mine

About This Instructable

32,169views

499favorites

License:

Bio: I am 26 years old engineering student from Oulu in Finland. Currently living in Joensuu. I make these projects as a hobby, and it would ... More »
More by mkarvonen:PipBoy 3000 (working) DIY Piranha Plant Photo(s) to 3D model 
Add instructable to: