Sonar Sensor (HC-SR04)
The sensor costs $6 from the staff closet. But its value+ease of use is much much more than that! In short, use it!
Why sonar?
In our state machine, the sonar sensor was used for detecting proximity to the wall. We were initially skeptical about the effectiveness of the sonar sensor and planned to use a bumper for detecting the wall. The sonar would just be our general guide for when we should be looking to detect the bump. But boy was it amazing! As soon as we hooked it up (and it's really easy to hook up!) the quality of the distance was perfect, requiring no calibration.
Caution
There are some things the sensor is bad at. For example, if the bot is at an angle, the sensor signal gets reflected at an angle and does not get back till much later, producing incorrectly large distance reading. Also, we programmed the sensor discretizing the distance by centimeters. At one point we tried to align using two sensors in parallel when positioned far away from the wall, and it's just not enough discretization.
Why sonar?
In our state machine, the sonar sensor was used for detecting proximity to the wall. We were initially skeptical about the effectiveness of the sonar sensor and planned to use a bumper for detecting the wall. The sonar would just be our general guide for when we should be looking to detect the bump. But boy was it amazing! As soon as we hooked it up (and it's really easy to hook up!) the quality of the distance was perfect, requiring no calibration.
Caution
There are some things the sensor is bad at. For example, if the bot is at an angle, the sensor signal gets reflected at an angle and does not get back till much later, producing incorrectly large distance reading. Also, we programmed the sensor discretizing the distance by centimeters. At one point we tried to align using two sensors in parallel when positioned far away from the wall, and it's just not enough discretization.
The Circuit
There is basically no circuit involved. We just hook up Echo to 12 and Trig to 13, Vin to 5V and GND to Ground and you are good to go. There are plenty of resources out there for how to get it running out there on the webs. Check out the code page for how we tested sensor values initially. Since our power unit sat in the back of the bot and the connections were not sauntered, sometimes a wire would slip out. It's useful to know if Sonar is getting a signal by putting an LED with a resistor (540 Ohm) in parallel to the Sonar. We did this and it saved us a couple of close ones! |
Create a free website
Start your own free website
A surprisingly easy drag & drop site creator. Learn more.