HC-SR04 and FreeBSD
Luiz Otavio O Souza
lists.br at gmail.com
Fri Aug 29 18:07:20 UTC 2014
Okay, so i got my hands on one HC-SR04 and got it working quite
easily. Two consecutive GPIO readings takes from 15 to 30 usec which
gives a good precision for this case (readings above 116 usec).
I written a simple C program to program the GPIO pins, trigger the
sensor and read back the duration of echo pulse, it give me good
readings using the datasheet formula, so i'm happy with it. Build it
with: cc -o hc-sr04 hc-sr04.c
I'm using the wiring suggested at (voltage divisor on echo pin):
The trigger and echo pin is connected to pins 2 and 3 respectively.
The module is powered from DGND and VDD_5V.
This maybe a good candidate to be on Wiki.
More information about the freebsd-arm