Friday, May 12, 2017

Donut Counting with LabVIEW and BeagleBone Black



While creating tutorials for the LabVIEW Web Services feature of LINX, I needed a simple real-world example application.  I think I came up with one of the dumbest possible projects to serve that purpose.

Where I work, there is a long-standing tradition to bring in donuts when making some announcement.  So when we released LabVIEW support for Raspberry Pi and BeagleBone Black devices, I wanted to combine donuts with one of those devices in some way.  I also wanted to make the project electrically simple and easy from a software perspective as well.

What I came up with is a BeagleBone Black serving up a web page that shows how many donuts are remaining in a donut box.

The circuit is super simple, it's just a photo-resistor hooked up to one of the analog inputs of the BBB.  The LabVIEW application detects that the box lid is open or closed based on reading the resistance of the sensor, and then implements a simple state machine that decrements a counter when the box lid is opened and then closed (I assume that each person is only taking one donut).  The LabVIEW app then serves up a static web page that displays the current donut count that accesses the current counter value via a LV web service.  There is also a LV web service method that allows you to set the current count value so you can input the initial number of donuts in the box.



It's definitely a silly toy application, but I think it serves as a simple example of LabVIEW Web Services that interfaces to real-world I/O.  All of the source code is available on github.

No comments: