loading

This is a simple homemade radar using Intel Edison, HC-SR04 and Tower Pro micro servo.

Follow this guide to make your own.

Remember to vote for me if you like my project!

The video included can be viewed with mobile from HERE!

Step 1: Things Needed.

Few things needed to make this work.

First of all, programmable Arduino based board. I used Intel Edison.

Then you will need HC-SR04 ultrasound sensor.

And lastly a micro servo.

Optionally i made a shaft to the servo to hang the ultrasound sensor to it. The shaft is basic breadboard cut in size. This also allows to easily solder jumper wires to the sensor.

Step 2: Build the Sensor Shaft.

You will need 4 holes for the sensor and 4 holes for the cables. The length of the shaft is about 15 cm.

Solder the sensor to the other end of the shaft, add jumper wires and lastly solder the connector from the other end. It's simple but very reliable.

Step 3: Connections.

I made a simple shield for the whole thing just to keep all cables in a neat order.

The basics of this is that the Edison (With external power supply) will power the ultrasound sensor and the servo.

The basic USB power wont last long with this since the servo need's steady current and it draws much of it.

So this is how the connection is.

HC-SR04 Edison

Vcc-------------------Edison Vcc

GND-----------------GND

Echo---------------- Pin 6

Trigger--------------Pin 5

And for the micro servo

Vcc-----------------Vcc

GND---------------GND

Signal------------ Pin 9

After soldering i attached the micro servo on to the shield with hot glue.

The shaft goes straight on the servo with hot glue and zip ties.

Step 4: Insert It on the Edison and Start Coding!

The code basic's is pretty simple, just make the servo rotate in steps from right to left and back and then make the ultrasound sensor to look up the distance to the current position.

All the information is printed to serial, witch we will be using later to draw a describer from the data collected.

The code goes like this.

Define components and setup global variables.

#define ECHOPIN 6
#define TRIGPIN 5 #include

Servo myservo; int pos = 0;

Then lets get the setup right.

void setup() {
Serial.begin(115200);

myservo.attach(9);

pinMode(ECHOPIN, INPUT); pinMode(TRIGPIN, OUTPUT); }

And then the main program. If you want to adjust the angle of the servo just adjust the pos=10 and pos=170.

This is the servos movement in servo position. The pos+=3 means that each step is 3 steps for the servo motor.

oid loop() {
myservo.write(10); delay(1000); for(pos = 10; pos <= 170; pos += 3) { myservo.write(pos); Print(Distance() , pos); delay(15); } delay(1000); for(pos = 170; pos>=10; pos-=3) { myservo.write(pos); Print(Distance() , pos);

delay(15); }}

Then we make few subroutines to run in the loop. This will just make the main program look much more cleaner.

void Print (int R , int T)
{ Serial.print(R);Serial.print(", "); Serial.print(T);Serial.println("."); delay(100); }

float Distance () { digitalWrite(TRIGPIN, LOW); delayMicroseconds(2); digitalWrite(TRIGPIN, HIGH); delayMicroseconds(10); digitalWrite(TRIGPIN, LOW); // Distance Calculation float distance = pulseIn(ECHOPIN, HIGH); distance= distance/58.2; return(distance); }

Step 5: Run the Programm.

Download Processing 2 and insert the code from the file to the program and run it when the board is running.

If you need any assistance with this, Go to this project to get the info---> Intel Edison: Heart rate monitor

You can see the drawing what it does in the last picture.

That about it. If you have any guestion's just ask. I will try to answer them.

Thank's for reading!

<p>Nice! </p><p>next step is to mount it on wheels :)<br><br>I can share some hints :<br><br><iframe allowfullscreen="" frameborder="0" height="281" src="//www.youtube.com/embed/h7S2JcvRrW0" width="500"></iframe></p>
hi. i have already done it. Check out my obstacle avoiding robot from my projects. thanks for the comment.
<p>Nice :-) Maybe I will integrate this and a mearm.......</p>
<p>This works with a Intel Galileo?</p>
<p>Awsome Instructable :).... But we can use a normal arduino and any normal analog motors instead of an expensive servo</p>
<p>Hi, This should work with Arduino uno just fine. These micro servos are really cheap. If you want to use normal hobby motor on it you will have to get a shield for that to change the polarity of the motor. Or a ic made for that job.</p>
<p>Can u suggest any other cheap board ?.. this one is expensive for me.... Like a broad not that much advanced as this just it has enough processing power that will do this job... </p>
<p>Hi, Arduino uno will do just fine.</p>
<p>Hi, great Instructable. I'm really interested in these kind of projects but I found something which looked a bit strange to me, within the code which I just don't understand correctly. It`s the &quot;distance&quot; part, how did you came up with the 58.2 and why do you &quot;reset&quot; the TRIGPIN when you`re not using it (you use the ECHOPIN instead).</p>
<p>Hi!</p><p>The 58.2 comes from speed of sound converted in this formula as centimeters.</p><p>If you want to change it to inches use 148.</p><p>( t = r / c c=speed of sound (340m/s), t=time, r=distance ).</p><p>It is used in many other examples that you can find from web.</p><p>In this example the distance= distance/58.2</p><p>(the second distance is in many cases called duration. Don't know why i did that but it does the job. might be a error in my head that messes it up a bit.)</p><p>The trigger pin must be shutdown when the echo pin listens the echo of the trigger pin. If the time is more than it should be ie. the measured distance is too long it will stop listening and sends a new signal through the trigger again. That is just something that has to be included in the code in order to make the sensor work properly.</p><p>Here is a link for the components datasheet to help understand the inner workings.</p><p><a href="http://www.micropik.com/PDF/HCSR04.pdf" rel="nofollow">http://www.micropik.com/PDF/HCSR04.pdf</a></p><p>If you have anything to ask just ask.</p>

About This Instructable

16,995views

147favorites

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: