![]() |
||
![]()
MISC
SKILLS
HARDWARE
SCIENCE |
Sonar
How Sonar Works
Availability and Cost
Calculating Distance vs Time
example:
calculating:
343 m/s * .03 s / 2 = 5.145 m
The Sonar Process, English Pseudo Code Pseudo CODE in C output_high(pin_D5); //bring command pin high
delay_us(210); //time it takes for a sonar to emit sound after recieving a command
distance=get_TIMER1()/conversion_factor; //convert passed time to inches
Power Requirements
The typical sonar module consumes roughly 100 mA in standby mode, meaning no sound pulses are being emitted.
When in use, however, the power requirement jumps momentarily up to 2 Amps. Just like with
motors, they can draw sudden large amounts of current resulting in sudden
voltage drops on your batteries (i.e. a ping causes the microcontroller to reset).
This huge jump can wreak havoc on microcontrollers and other circuitry sharing the same power supply. A microcontroller
won't work and will just reset if the voltage drops too low.
However, if you design your power supply circuit with a capacitor,
it should suppress these sudden but short lived voltage drops. You should already have one for your motors, but
if you draw from another seperate power supply, a ~500uF capacitor across the power leads should work fine.
Range (Maximum and Minimum)
There is also a minimum range, meaning that if an object is too close (say within a inch or two) from the sonar emitter, your sonar
will not detect the object (or at least not accurately). This is because sound is really fast, so fast that the electronics cannot
work with in the time it takes for the sound to return back to the sensor. Make sure your sonar is an inch or more back from the front
of your robot, or it will not detect wall collisions properly.
Sound Reflectance / Absorbance and Object Material Properties
As an object sensor, you can use some of these 'problems' to your advantage. What if your blind robot needed to know if it is
trying to kill humans with a brick or a pillow? The uses are vast.
Using Multiple Sonar Simulataneously
The electronics approach to solving this problem would be to have each sonar operating at a different sound
frequency (not easy to do!).
Lastly, there is the computational approach. With this method each of your sonar would
fire at different times. Your robot would wait for one sonar to receive an echo, plus an additional time for
ghost echos to dissipate, before the next sonar is activated. But if you have say 16+ sonar, that can take a huge
amount of wasted time! Then you can do things like have only sonar on opposite sides of the robot fire together.
Or do some strange sonar firing pattern so that each sonar has a small chance of interfering with each another.
Advanced Signal Interpretation
|
|
Has this site helped you with your robot? Give us credit -
link back, and help others in the forums! Society of Robots copyright 2005-2014 |