Ping sensor not working

19 Dec 2011

I tried several of the code examples on the site to try to get the Parallax PING))) sensor working through the mbed mounted on my Pololu m3pi robot, but to no avail. The code hangs during the while (!pingPin) line of segment below:

Timer tmr;
pingPin.output();
pingPin = 0;
wait_us(2);
pingPin = 1;
wait_us(5);
pingPin = 0;
pingPin.input();
while (!pingPin);
tmr.start();
while (pingPin);
range = tmr.read_us();

I noticed though, that the ACT LED on the Ping sensor was never lighting up, which to me suggests it is not getting adequate power. I don't see why this would be the case though, I have the ground pin on the Ping going to GND on the mbed, 5V going to VOUT, and SIG going to p10. I tried sending the 5V to VU, but that made no difference, nor did using any other pin besides p10. I would post my full code, but I can't even seem to get it to work with the Ping library or sample code listed on the site here first.

Has anyone else had similar problems? I have yet to get anything external working on my m3pi and it's getting a bit frustrating.

On another note, for those that have used analog sensors on the m3pi, is it true that I have to desolder one of the LEDs on the m3pi in order to use any other analog sensor input?

Thanks

19 Dec 2011

Isn't it a ttl sensor and you maybe need a 5V ttl ping?

19 Dec 2011

Well, the ping is meant to operate at 5V, and the mbed VOUT supplies 3.3V, so do you mean I need a 3.3V ping sensor?

19 Dec 2011

For an update: I got it to work when plugged into my computer, with the 5V pin of the ping connected to the VU pin of the mbed. When i unplug the USB though, it no longer works. Still no luck running it through the VOUT pin.

19 Dec 2011

Yes.mbed delivers 5v only with usb. See datasheet

19 Dec 2011

Right. That could be why it isn't working- thanks for the tip! However, I was under the impression the ping sensor could work with some 3.3v microcontrollers. People have done this with a ping and an mbed before, so I'm curious as to what else I need to do to get this setup. I haven't need able to find any help beyond code in searching.

19 Dec 2011

Hi Philip,

I just had a look at the datasheet I found on Parallax Ping Website

It seems to suggest the power source must be +5V dc, but the signal/ping line can be 5v or 3.3v TTL (transistor to transistor logic). So that means you'll be fine using mbed, as long as you give it a 5v supply. If you are connected to the pc the VU pin will mirror the 5v supply it is getting from USB, but if it is not going to be connected to the PC, you'll need some other source.

Perhaps you could start a "Parallax Ping" page in the cookbook to collect this information and examples and focus any help, plus it'd be a great record for anyone else in the future!

Hope this helps you get it working,

Simon

22 Dec 2011

Thanks Simon!

If I end up getting it working, I'll certainly create a page for others to follow.