BeagleBone and PING)))

Hi,

has anyone tried / successfully got this sensor working with a BeagleBone?

http://www.parallax.com/tabid/768/productid/92/default.aspx

I previously had this working fine with an Arduino, but now wished to move it over to my BeagleBone. For the sensor to start working it needs to have the pin set HIGH for a couple of milliseconds and then you can start to read the analog values returned.

This sensor uses the same single wire to send the signal HIGH as is does to read the values. I’m assuming that the send signal is digital and the read signal is analog.
I have a piece of breadboard and am connecting pin 15 (gpio 48) and pin 40 (ain2) together and a single wire out to the signal line of the PING))).

From the command line, I export gpio 48, set the direction and then echo 1 > value so that it switches the PING))) on - this looks good as the LED turns on.
If I now go to /sys/devices/platform/omap/tsc and cat ain2, I see 4095 output I recognise this as the default / I’m not doing anything value. If I then disconnect the gpio48 wire, so it is no longer connected to the ain2 wire and I repeat the cat ain2 repeatedly, I get values output that cvary.
If I hold my hand close to the sensor, I get values like 1,7,14,0,1,17,3 - but they seem to jump about quite a bit - if I just leave the sensor pointing at the ceiling I get values like 1,6,3,4,27,20,25,1,0,9,19,4,2 - these seem all very random.

Has anyone connected the PING))) to a BeagleBone before and gotten it to work properly? If so, can you give me some pointers as I’d very much like to hook up a couple of these sensors.

many thanks

Tony

for reference, at the bottom of this article is the Arduino code that works: http://learn.parallax.com/kickstart/28015

Hello Tony,

I did use a PING))) equivalent:
http://www.seeedstudio.com/depot/ultra-sonic-range-measurement-module-p-626.html?cPath=144_149

I have to say that it’s not as easy as you put it. The interface of the sensor is not analogue and also it is not really healthy to directly attach it to your BeagleBone. According to the documentation it needs a 5V in supply which means that the signal coming back will also be 5V which will burn that GPIO of your device (or the whole stuff).

The important stuff: the measured distance is returned in a wave where the length of the HIGH wave codes the measured value. It’s not an analogue voltage that is returned but a digital signal.

I made a blog post about this a while ago:
http://fleshandmachines.wordpress.com/2012/09/25/sonar-sensor-on-the-beaglebone-part-1-direct-approach/

Any feedback is appreciated.

–Bence

2013/1/25 tonypig777 <tony.pigram@gmail.com>

A related question is how does one obtain precise pulse width measurements with the beagle running linux, linux not being exactly hard realtime.

might be much easier to use one of the I2C based ultrasonic sensors.

Eric

________________________________________
From: beagleboard@googlegroups.com [beagleboard@googlegroups.com] on behalf of Eric Fort [eric.fort@gmail.com]
Sent: Friday, January 25, 2013 11:28 PM
To: beagleboard@googlegroups.com
Subject: Re: [beagleboard] BeagleBone and PING)))

A related question is how does one obtain precise pulse width measurements with the beagle running linux, linux not being exactly hard realtime.

might be much easier to use one of the I2C based ultrasonic sensors.

Eric

The BeagleBone PRU (PRUSS) has hard realtime capabilities. Probably the biggest differentiator between the BeagleBone and other competing ARM platforms.

http://elinux.org/ECE497_BeagleBone_PRU
http://tinyurl.com/aucb6qc

etc...

According to the documentation it needs a 5V in supply which means that the signal coming back will also be 5V which will burn that GPIO of your device (or the whole stuff).

That is good to know, I didn’t appreciate that 5V would be coming back to the GPIO pin. I’m glad I only had it plugged in for a few minutes - won’t do it again.

The important stuff: the measured distance is returned in a wave where the length of the HIGH wave codes the measured value. It’s not an analogue voltage that is returned but a digital signal.

okay, I took a look at your url - I don’t fancy the idea of having to get components and do soldering just to get this working - I’ll leave these connected up to my Arduino and just get the Arduino to pass the obtained values to the BeagleBone.

The I2C modules might be an option. The PRUS information is also very handy to know about.

Speaking of the no so hard realtime of the Linux kernel, I unfortunately found that out after writing a kernel platform driver for those HC-SR04 sonars. All thats needed to interface the beaglebone with them is a transistor, because the beaglebone IO outputs a high enough voltage to trigger the sonar and I just run the echo pin into the transistor and connect it between the beaglebone’s IO and ground. Then I enable the internal pullup resistor. I’m curious if installing realtime extensions will help with interrupt service time.

Nathaniel Lewis