go_away

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

0 Members and 1 Guest are viewing this topic.

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Sonar and programing selection?
« on: April 16, 2007, 04:06:13 PM »
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. ;D

Offline Brandon121233

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 320
  • Helpful? 0
  • "Genius is %1 inspiration and %99 perspiration"
Re: Sonar and programing selection?
« Reply #1 on: April 16, 2007, 10:25:07 PM »
I just got the LV-MaxSonar-EZ1 rangefinder http://www.maxbotix.com/uploads/LV-MaxSonar-EZ1-Datasheet.pdf http://www.maxbotix.com/ http://www.sparkfun.com/commerce/product_info.php?products_id=639
and 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.
Hell, there are no rules here—we're
   trying to accomplish something.

                                                                              —Thomas Edison

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: Sonar and programing selection?
« Reply #2 on: April 20, 2007, 07:39:21 PM »
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.

Offline Brandon121233

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 320
  • Helpful? 0
  • "Genius is %1 inspiration and %99 perspiration"
Re: Sonar and programing selection?
« Reply #3 on: April 20, 2007, 09:09:40 PM »
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.
« Last Edit: April 20, 2007, 09:19:20 PM by Brandon121233 »
Hell, there are no rules here—we're
   trying to accomplish something.

                                                                              —Thomas Edison

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: Sonar and programing selection?
« Reply #4 on: April 21, 2007, 08:19:14 AM »
Unfortunately I do not have Arduino program or the board.I have a 50 dollar robots board. Will this still work? If it does not what other route should I take? Thanks.

Offline Brandon121233

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 320
  • Helpful? 0
  • "Genius is %1 inspiration and %99 perspiration"
Re: Sonar and programing selection?
« Reply #5 on: April 21, 2007, 10:12:11 AM »
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.
Hell, there are no rules here—we're
   trying to accomplish something.

                                                                              —Thomas Edison

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: Sonar and programing selection?
« Reply #6 on: April 21, 2007, 06:52:26 PM »
I think in the future Ill write sonar code for the $50 robot.

Ill give you a quick rundown so you can start reading up on 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 . . .

Offline Brandon121233

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 320
  • Helpful? 0
  • "Genius is %1 inspiration and %99 perspiration"
Re: Sonar and programing selection?
« Reply #7 on: April 21, 2007, 07:33:43 PM »
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.
Hell, there are no rules here—we're
   trying to accomplish something.

                                                                              —Thomas Edison

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: Sonar and programing selection?
« Reply #8 on: April 21, 2007, 09:05:22 PM »
hmmmm interesting (very useful!) output options . . . i would perfer the analog for this sensor tho . . .

Three interfaces (active simultaneously):
Serial output: asynchronous, logic-level, inverted, 9600 bps
Analog output: 10 mV/inch
Pulse width output: 147 us/inch

Offline Brandon121233

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 320
  • Helpful? 0
  • "Genius is %1 inspiration and %99 perspiration"
Re: Sonar and programing selection?
« Reply #9 on: April 22, 2007, 11:32:24 AM »
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.
Hell, there are no rules here—we're
   trying to accomplish something.

                                                                              —Thomas Edison

 


Get Your Ad Here