Ultrasonic Sesnor Accuracy

Has anyone managed to get the advertised 3cm accuracy using the Maxbotix Ultrasonic Rangefinder provided with the Kit of Parts? If so, what did you do to achieve this? Our sensor seems be returning data that is off by more than 40cm.

I don’t have experience with that particular ultrasonic sensor, but it seems like you need to calibrate it. Should be directions in a manual or online for how to do that as it varies by sensor.

The speed of sound (or ultrasound) varies with the density of air. That means temperature, humidity, and barometric pressure are all working against you in your quest for an accurate distance measurement.

But that wouldn’t lead to a difference of 40cm. At 70 deg F, C is ~344 m/s, at 60 it is 340 m/s and at 80 it is 347 m/s. Not a notable difference. Also barometric pressure is fair to assume constant, unless he’s somewhere significantly above or below sea level.

Here’s the spec sheet for the sensor.

Each time after the LV-MaxSonar®-EZ1™ is powered up, it will calibrate during its first read cycle. The sensor uses this
stored information to range a close object. It is important that objects not be close to the sensor during this calibration
cycle. The best sensitivity is obtained when it is clear for fourteen inches, but good results are common when clear for at
least seven inches. If an object is too close during the calibration cycle, the sensor may then ignore objects at that distance.

I found when testing the sensor that the signal is very susceptible to interference from other irregular obstacles (i.e. it ignores walls unless directly facing them) in its field of vision (which I estimated to be roughly 60 degrees, centered on its line of sight). The waveform is highly erratic when there are multiple objects in its field of vision, and oscillates between the closest and farthest object it can see.

After we calibrated the sensor, we saw accuracy to within a half an inch as long as we were 90 degrees to a wall and there were no interfering objects. Interfering objects will probably be a big issue, so you’ll need to come up with a way to recognize them.

Okay then. Pardon my ignorance, but how exactly would one go about calibrating the ultrasonic sensor? Is there a specific process that we are supposed to follow, or do you just mean that we should get some data and work out a formula, which is what we’ve done.

We took measurements every 6 inches. We wrote on a piece of paper the actual distance (measured via tape measure) and the voltage reading from LabVIEW. Put everything in an Excel spreadsheet, then use y = mx+b to find the best fit “m” (i.e. slope or scale factor) to make the data work best.

That’s what we did, too. Unfortunately, it doesn’t seem to be working. The sensor is just extremely inaccurate. Is it possible that there is something wrong with it, or that it was wired improperly?

As (http://www.chiefdelphi.com/forums/showpost.php?p=1118674&postcount=5), make sure that 1)the space in front of the sensor is kept clear when you first provide power to it and that 2)there’s nothing interfering with your readout and introducing error to your testing; e.g. if you’re testing distance with just a pencil or some thin item, it’s not going to work.

Since the analog input on the breakout is only 8 bits and everything is housed on a very electrically noisy robot I’ll bet at the end of the day you’ll get about 7 bits of dependable data out of the analog port of the sensor. Don’t expect too much from it and you’ll be fine. The 3cm is the theoretical accuracy but not with our hardware or environment.

Make sure everything is out of the way between the sensor and the wall(including the tape measure you’re measuriung with). Make sure your wall is flat and big (don’t do it near doors, etc). Make sure your sensor wires do not go near any motors or the radio.

Also, increase the oversampling and averaging. That will settle the sensor noise and improve your accuracy.

Thanks for your help, everybody. We’ve got it working properly now. We were measuring distance to a wooden board, but the board was not quite perpendicular to the sensor, and it was warped. Today, we got a bigger, straighter board, used a measuring tape instead of a bunch of meter sticks, and took readings at intervals of 50cm. Now, we have an equation that works. Again, we appreciate your help. We didn’t realize that the angle of the board would have such a tremendous effect. To compensate for that, we’ve coded some gyro stuff, and everything seems to be going smoothly so far.

Excellent. Good to hear. What accuracy to you have now?

Just to add another data point, when we first tested the sensor we found huge intermittent drops in the measured range when more than 8’ from the target wall, even with a properly-initialized sensor, perpendicular target, clear range to target etc. Two days later the problem did not recur even with no changes to the hardware or software. The leading theory so far (which we will test at the next opportunity) is that all of the grinding noise from the welding class going on next door had a high ultrasonic spectral content which interfered with the unit. Without the grinding noise two days later, the sensor was well-behaved.

Hmmm…grinding noises could sound a lot like robot noises whether our own robots or other robots on the field! This is certainly something to test.

Like the sound of chain running at 5000 RPM?