Electronic – arduino – Ultrasonic Sensor Controller

arduinoproximity-sensorraspberry pi

I am working on a project at school where we need sonar input to control a little vehicle. Pretty simple stuff, usually. However, we're having a bear of a time getting the sonar to work. My faculty adviser has helped us get a little closer to the goal but we're still up a creek and running out of time. The module is a Prowave SRM400. We wired it up to an Arduino with a transistor which will pull the MCU pin low for 500 microseconds (verified on o-scope) and we have also been able to verify that the out-pulse does get sent to the transducer. For a while we were getting some weird sawtooth looking data back with a curved front edge and a straight dropoff on the "right" side of the scope. The adviser then started to play with the potentiometers on the board and now it seems to not work at all. The datasheets are not super helpful about what the output is supposed to look like or how to interpret the output into useful data. There is one waveform supplied on the data sheet which is perfect digital square waves, and we definitely never saw anything like that. Does anyone have experience with this particular board? It's not a new device, I think it came out in 2003 or something, but I'm not able to find any help on it so far. How am I supposed to interpret the output coming from this board?

I might also mention this does not count as "helping a student do his homework." The class is about project management and the actual project is not so important… except ours is supposed to be used by grad students next year so it really needs to actually work.

SRM400 datasheet (note: the PDF has timing information on the waveform section, the HTML does not) http://www.prowave.com.tw/english/products/sr/srm400.htm
The chip on the SRM400 is a PW0268, found here: http://www.prowave.com.tw/english/products/sr/sric/sric.htm
What we saw point "A" coming from the MCU and point "C" between the control module and the transducer match the data sheet. This is the scope of the output to the MCU.
scope trace

Best Answer

Ok, let's remind ourselves how ultrasonic sensors typically work:

  1. Send out a pulse
  2. Wait for echo

Looking at the datasheet, after your initial pull low, the output goes high, then goes low whenever it detects echos. The examples given in the datasheet are for perfect (maybe even simulated) conditions.

So, what I see from your scope looks correct! After your initial pull low, the sensor sees an immediate echo (from itself) which it is designed to attenuate (ignore) - that's that tiny blip. Then the output goes high (waiting for an echo). Then it starts getting echos - apparently a lot of them.

So, what you need to do is pull it low, wait until the signal goes high, then start timing how long it takes to go low again (first echo). If you care about other reflections and multipath, you may try to analyze the remaining.

But dude, it's working fine!