Ultrasonic rangfinders are a cheap and easy way to gather obstacle avoidance data. When added to a servo motor they form something of a scanning radar for near-proximity objects.
In this implementation, [Rui Cabral] is driving the servo, and collecting data from the sensor using a PIC 18F4520. The servo rotates 180 degreees, taking sensor measurements in increments of nine degrees. If it discovers obstacles, the distance and orientation are recorded. Feedback is displayed on a 20-LED bar graph display which shows a moving LED to track the sensor orientation, with LEDs remaining lit whenever an object is found. Right now the obstacle data is pushed over a serial connection with a PC, but could easily be injected into navigation logic for a robot in order to triangulate a path around the obstruction. You can see [Rui’s] project in action after the break.
We looked in on the same concept with a different display technique a couple of years back. That hack used an Arduino and Processing to map sensor data with a traditional green sweep display.
14 thoughts on “Ultrasonic Rangefinder As Scanning Radar”
Fun way to get some use out of some older tech. I wonder if it would be possible to scan the rangefinder smoothly, and just sample the data at intervals, for a less jerky appearance, or does the rangefinder have to be stationary to read?
it isn’t jerky because of the rangefinder, but because of the servo. you have to send a control signal to the servo and, since there is no feedback signal, you just have to give it enough time to reach the position before you go to the next position. if you instead just had a motor with a feedback signal then you could sweep it like that, since you know the position of the rangefinder for sure when you take a reading without having to wait for the servo to get to its position.
No, servos are jerky because they rely on a potentiometer coupled through cheap plastic gears with tons of electrical noise as their position feedback sensor. Combine that with untuned PID control loops and you get the twitch effect that is so common. Finally, the control signal most of them use with the 1-2ms pulse every 20 ms is usually pretty noisy as well so the target position keeps moving around.
As the quality of the servo goes up from the $5 discount bin ones to the $200+ industrial ones you will find that they have better gears with less backlash, more accurate sensing (I took one apart and found an optical encoder!), better control loops, and different input signals including pure serial commands. Needless to say the high end ones don’t twitch.
As for the reading while moving, it is possible but usually avoided. Pure time of flight wouldn’t be affected but if you’re looking at Doppler shifts or phase difference on arrival then sweeping the sensor makes the math a lot ickier.
when I said jerky, I was referring to the stop-start of this circuit, not the servo itself. I was saying that this person programmed in a wait time to ensure that the servo was at the specified angle before taking a reading. if you instead just used your own motor with a positional feedback you could eliminate the wait time. the distance reading might be affected by doppler shift, sure, but that is an issue with using a servo like this anyway. besides, since I assume this is mainly for robotic awareness of the immediate surrounding and not for precise range finding, a little error is a fine tradeoff for a faster sweep.
it’s more echo location than RADAR (no electromagnetic waves here)
How many bits of resolution are you getting out of the sonar module, and how accurate (over what range) is it?
I saw something very similar in a recent episode of Ghost Adventures, this one scans for distance and temperature and continually re-scans to look for differences. Scroll down to the THERMOSOUND unit:
Hey Khordas, it looks like a DFRobot URM Sensor. The choppy movement is probably due to the servo and not the sensor. I think the sensor could be moved smoothly, just not too fast. You could use an IR Senor instead for faster scanning.
Something like this: http://www.youtube.com/watch?v=XvJSZomwFLA&feature=player_embedded
Um, it’s SONAR not RADAR. look them up.
I tried this many years ago, used a laser to point the location where distance was measured. It was fairly accurate.
I like this project better:
a stepper might give better resolution and 360-degree coverage. i might try this some day if i have the free time
Hey, I think you just hacked your way into the key element blocks of the Lego NXT 2.0 kit!..lol
Please be kind and respectful to help make the comments section excellent. (Comment Policy)