grove ultrasonic ranger interfacing with beaglebone black

Hi,
I wanted to interface the grove ultrasonic ranger sensor with beaglebone black. i couldnt find any libraries for beaglebone. i found its libraries for raspberry pi, arduino etc but not for BBB. If anyone has done it, please share the ideas.
Thanks in advance.
Jithu.

On Thu, 28 Sep 2017 22:42:50 -0700 (PDT),
jithunair21@gmail.com declaimed the
following:

Hi,
I wanted to interface the grove ultrasonic ranger sensor with beaglebone
black. i couldnt find any libraries for beaglebone. i found its libraries
for raspberry pi, arduino etc but not for BBB. If anyone has done it,
please share the ideas.
Thanks in advance.
Jithu.

  You'll likely have to write code for the PRU since these sensors use a
variable length pulse to indicate the distance (I'm presuming it is similar
to the Parallax PING))) sensor: https://www.parallax.com/product/28015 ).
That makes it very difficult to get accurate pulse timing using the sysfs
access to the pins (especially as, besides timing the return pulse length,
you need to rapidly switch the pin from output [to send the "start
measurement" pulse] to input [to read/time the return pulse] NOTE:
four-lead versions -- HC-SR04 -- may be easier as the trigger and echo are
on separate pins).

  Most of the Parallax documentation is based on BASICStamp's
pulsin/pulsout commands. The rest are Propeller based (which, for this
discussion, could be looked at as an 8-core PRU equivalent)

  I did find a site that was using one with a Raspberry-Pi... First step
-- plug in an Arduino board with Grove sockets <G>. Granted, the R-PI
doesn't have quite the GPIO capability of the BBB, but it also has the
overhead of Linux. Even if you memory map the port to bypass the sysfs you
might run into erratic timing as the OS switches from your program to some
other process. The same problem occurs if trying to read various DHT
sensors -- which return a pulse stream of nominally two lengths and one has
to determine if the pulse is longer or shorter than some median to tell 1
from 0 (the ultrasonic sensor is just a single pulse whose length maps to
the distance, the DHT is sending scaled integer temp/humidity)

  A second site did use Python directly on the R-Pi.
https://www.modmypi.com/blog/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi
This version should be easy to port to the BBB (replace the RPi.GPIO with
Adafruit_BBIO.GPIO, then change the pin names to be BBB format)

  Still may not be the most accurate if the Python program gets
pre-empted by the OS near the start or end of the return pulse (ie: it may
miss the exact time of transition)

o/~ Talking to myself in public o/~

On Fri, 29 Sep 2017 13:58:20 -0400, Dennis Lee Bieber
<wlfraed@ix.netcom.com> declaimed the following:

you need to rapidly switch the pin from output [to send the "start
measurement" pulse] to input [to read/time the return pulse] NOTE:
four-lead versions -- HC-SR04 -- may be easier as the trigger and echo are
on separate pins).

  Looking at the Grove example library for Arduino (and likely compatible
with Energia), the Grove sensor is similar to the PING))), in that it uses
the same pin for trigger and echo.