Sunday, December 18, 2016

Infrared "break beam" detection using BeagleBone Black and Adafruit 2167

Here is a simple example of monitoring a infrared (IR) light beam w/BeagleBone Black.  There are many use cases for IR break beam sensors and for US $1.95 the Adafruit 2167 is an excellent choice.

The example provided by Adafruit is for the Arduino.  Here is a simple example using the BBB.

Schematic of "break beam" demo.
  Any GPIO will do.  Below is a runtime example from a BBB using Debian 7 (wheezy).  Note that "value" contains a 1 when the IR beam is detected and a 0 when I block the beam.

root@beaglebone:~# cd /sys/class/gpio
root@beaglebone:/sys/class/gpio# echo 115 > export
root@beaglebone:/sys/class/gpio# cd gpio115
root@beaglebone:/sys/class/gpio/gpio115# echo in > direction
root@beaglebone:/sys/class/gpio/gpio115# cat value
1
root@beaglebone:/sys/class/gpio/gpio115# cat value
0

No comments:

Post a Comment