Author
Topic: Sonar and programing selection? (Read 3299 times)

Hey I need help with a few things. I am short on money and would like to get a somewhat cheap (No more than 35 please) and reliable sonar that I can install to my 50 dollar robot with somewhat simple programing. Please tell me the best sonar for me and the best program. Will the program run on my 50 dollar robot board?Please help. thanks.

I just got the LV-MaxSonar-EZ1 rangefinder http://www.maxbotix.com/uploads/LV-MaxSonar-EZ1-Datasheet.pdfhttp://www.maxbotix.com/http://www.sparkfun.com/commerce/product_info.php?products_id=639and my initial impression was excellent. I just got finished writing the code for it to work with my Arduino board (AVR) and it is working fine. So far I have only tested its analog output option, but I'm working on code for its other output- serial ASCII characters representing the actual inches- I hope to use this methoed since it should be less work for the microcontroller to have to convert the analog output. The sensor itself also has an "old skool" PWM output in which the MCU has to time and convert ping lengths, I don't plan on using this really though. Some other nice things about it are- uses very little power, its a single unit, has lots of output options (whatever your comfortable with), all the ping timing and calculations are done on the ultrasonic device itself thereby freeing up your precious processing power, and its one of the cheapest sonar I could find right now. I would highly reccomend it for anyone experienced or not experienced with electronics.And if you would like to see my code for it just ask- although it is written in the Arduino/ C++ code.

Thanks. I will probobly buy that one and may need help with the source code and audirino (or however you spell it) directions. If it is possible when I buy the sonar (which I hope is fairly simple to assemble) if I could get your directions on how to use it (the programing). Or if you could give me your IM and just take me through step by step (that would be nice). Thanks. Please help.

Sure no problem, so are you getting the LV-MAX sonar and the Arduino or do you already have the Arduino? Cause it will be a lot easier for me to guide you through it if you are using the Arduino board. Also there is no assembly which is nice, all you have to do is solder wire to three holes for +5, ground, and your signal line. and my AIM is Brandon121233, or if you use Yahoo IM its also Brandon121233.

No, what you have is fine- because you are using an AVR Microcontroller, and the language is similar. I wouldnt have been able to help you as much if you had been using a Baisic Stamp or other kind of Microcontroller. Let me know when you get the sonar, and I can help guide you how to do it.

Send a single pulse to the sonar like you would to a servo (code that you already have).

Then use a timer (a feature of the atmega8, just look up the manual for it) to measure the time it takes for the sonar to send a signal back to your microcontroller. You will need a second digital output pin set for input (servos use digital output pins set for output).

Knowing the speed of sound in air, and the time the sonar took to send the pulse, calculate the distance the object is away from the robot.

sorry for not being more help, Ill write some code when I have more time . . .

Admin- if NOOBinDistress is getting the LV-MaxSonar (which I highly reccomend for beginners) then he dosent need to do that because the sonar module itself does the calibration and calculating the distance, all that is necessary is to convert the voltage or ASCII signal into inches or feet.

Yeah thats what I'm saying, its very very easy for even a beginner to write 10 lines of code, and to have it work, as opposed to having to calculate the time pulses to run the emitter, and calculate the time between pulses to convert that into inches or feet. It's 10X as easy and frees up the MCU from having to pulse the emitter and calculate everything.