Step 6Connecting the Sonar(s)
I needed EYES! But, I settled for some good ol' Bat Ears. Sonar. Ultrasonic. (although you can hear it making a tick-tick-tick sound if you listen real close)
The Sonar sends out a sound wave and waits for it to bounce back, then calculates how long it took for the sound to return to determine the distance (based on the speed that sound travels at sea level). The ones I use are accurate from about six inches to 40 inches.
I can detect the distance of an object and tell the robot to slow down or stop depending on the distance of the object.
Sonars worked better then Infrared Range sensors (in this case) because of the wider cone-of-detection. Infrared range sensors have a very narrow beam and won't pickup object slightly off-center like the sonars do.
Since I don't want to veer too far off-course, I am simply having the robot slow down and stop until the object moves out of range. Since I am using the text-to-speech module, I have the robot say "pardon me" if it has to stop, so you know you are blocking it and can move.
The Sonars connect to the Propeller via an i2c bus. i2c is just another fancy way of talking to a bunch of devices connected to the same two wires, but each device has it's own Address so you can talk to them individually.
I have two sonars on my ServerBot, but one could be sufficient. All sonars are connected the same way to the same wires (in parallel).
Build i2c Circuit with the 1K series resistors and 2.2k Pull-Up resistors on the Proto Board (see image).
Connect the sonars (in parallel) to the +5, Gnd, SCL, and SDA connection points on the Proto Board (see image).
| « Previous Step | Download PDFView All Steps | Next Step » |
![]() |
Add Comment
|






















































