MaxSonar EZ0 - Noisy Results

I have an Arduino sketch that interfaces with a MaxSonar EZ0 ultrasonic sensor. It uses the pulse-width encoded output from the MaxSonar to determine distances (pulse width divided by 147 microseconds per inch is the conversion factor). It works great in a desktop/benchtop environment, with an unshielded connection for the pulse line.

Unfortunately, when I move the device over to the "production" environment (a saltwater aquarium with several AC motors, ballasts and heaters) I get lots of false sensor readings. This happens even when I use a shielded cable cobbled together from an old S-Video cable.

Has anyone encountered this problem and resolved it? I know MaxBotix sells a foil-shielded cable. Is foil shielding necessary to transmit a clean signal? Also, my sketch currently has the sensor "free running", i.e., I don't command it to range, I just let it run and monitor its output. Could that be causing a problem?

  • Mark

I think I may have solved this issue. It appears that my sensor lead wasn't picking up spurious pulses on the pulse width modulated line. Instead, the MaxSonar module is pretty sensitive to noise on the power supply lines.

When I ran the Arduino and sensor off my laptop I got good readings, even in the "production" environment. As soon as I switched the power supply to the production switching supply I started getting weird results again. Putting a small capacitor across the Vcc and GND pins on the sensor itself made the problem go away.

  • Mark

Cool; a self-answering thread... Cheers for sharing the solution too! :sunglasses:

I'm embarrassed to admit how many of my threads over the years have been self-answering. For some reason, by the time I give up and decide to go public with my ignorance the act of writing tends to focus my thinking enough to get me the answer.

Maybe I should just pretend to post the questions... :slight_smile: