NOTE: This is a work in progress…
I created this page as a followup to my post about using the BeagleBone as a server for USB data acquisition hardware. I’m currently using the BeagleBone to try out these concepts. The underlying ARM system of the BeagleBone could be ported to a more lightweight device, or a standalone data acquisition device that incorporates these features.
The BeagleBone (or other ARM based system) would act as the server for collecting measurements from a USB device attached to it. It could also be modified to use peripherals already existing on the BeagleBone, e.g. it’s own ADC’s, digital IO, and PWM. I’m using node.js for the server backbone; it’s very flexible. Figure 1 illustrates some of the features on the BeagleBone. You can read more about the BeagleBone here.
There are several features I’m currently trying to implement with this server, and 3 general areas I think most applications will fall under. The BeagleBone comes with an ethernet jack, but a WiFi dongle could be added to this type of setup as well.
1. Standalone Data Acquisition
As a standalone device, the ARM system (in this case the BeagleBone) would act like a host doing the data collection and output data in some form. In this mode you can remotely control some feature’s, like writing to an analog output channel, or controlling digital IO. The BeagleBone’s microSD card can be used for storing data, this data would be available for download from the BealgeBone over the network. Some feature’s that could be available in this mode are explained below:
a. Collection From the network
In this case, the BeagleBone would host a web page and provide javascript graphs of temperature, voltage, digital IO, etc. of an acquisition with an attached USB device. The USB data acquisition device attached to the BeagleBone would be configured to make measurements and data could be viewed as it is being collected on a internet browser. The server (BeagleBone) would collect the data, allow you to download it after it’s complete or have it sent through email. See Figure 2 for a diagram of this setup. The USB-DAQ Board on the right is a Measurement Computing USB-2408 board.
Figure 2: BeagleBone as a Server Setup
Of the javascript based graph’s I’ve seen, I like dygraphs, so I may use them for now for seeing data as it is collected on the browser. Using these graphs, I’ve been able to display real time measurements with much ease. Figure 3 below illustrates what one of the dygraphs looks like:
Figure 3: Dygraphs javascript example graph
b. Bench-top Collection
When collecting data on the “bench”, an LCD or touch screen could be added to the BeagleBone and can be used to control or view an acquisition. This way, someone can take an existing USB data acquisition board (or other USB peripheral), and start collecting data without even using a PC. In this case, the ARM system would provide the display itself; similar to running an acquisition on a regular PC or a digital multimeter. The system could still be available remotely and host some other features.
The benefit of this is that if a new USB device is purchased, this system can be used as if it was a “cradle” and a PC wouldn’t be required for data collection. The user interface (UI) would be a LCD screen, touchscreen or something else, e.g. LED’s, a keypad, and buttons. See Figure 4 for a diagram of this setup.
Figure 4: Bench-top Setup – BeagleBone is the Host/Controller
2. Standalone Data Acquisition Controller
In this case, you can program the BeagleBone over a browser (or locally) so that it can make certain decisions based on the measurement’s it’s making with a USB data acquisition device. For example, if a temperature or voltage reach a specific value sound an alarm or flip a relay.
In this case the BeagleBone act’s as the “controller” and runs a program you can customize for a particular application.
Combining this “controller” mode with the data collection features listed from the previous section: 1. Standalone Data Acquisition would provide feedback of acquired data using graphs, provide data storage, etc. making this a very powerful platform. See Figure 5 for a general picture, a program would be running on the BeagleBone itself and data could be available over the network.
Figure 5: Standalone Controller using a BeagleBone
3. USB Peripheral Server
In this situation, the BeagleBone actually exposes it’s USB host port to the network. Send a UDP message to the BeagleBone with a packet containing enough information for the BeagleBone to run a USB control transfer (or more complex USB operations) and the BeagleBone will send the command down to a connected USB device or reply back with data.
This is potentially the most interesting application. This would allow you to setup the server, and use some other application elsewhere on the network to execute USB commands on the BeagleBone. This is very interesting because you can write applications that run on tablets, smart phones, or other computers and actually make remote measurement’s or control some of the features on a hanging USB device. In this scenario, a network connected PC, tablet, or smartphone could be the “Host” of the acquisition and actually control the USB data acquisition board remotely.
I have this working pretty well now, where you send the USB “packet” to the BeagleBone over the network and it actually executes the USB transfer for you. In this situation, I was able to write a LabVIEW application to communicate with the BeagleBone over the network and control my USB-2408 device to make voltage and temperature measurements. Figure 6 illustrates the principle of this setup. An external application running on a tablet, smart phone or PC on the network would “Host” the acquisition.
Figure 6: USB Peripheral Server – The BeagleBone is the Server
It would be really easy to make an application on iOS or Android and be able to make remote measurements or control the USB device hanging off the BeagleBone. I need to look into making this application and try it out…
a. Bluetooth (or other protocol) Function
The server itself need not be solely a web server. The BealgeBone (or ARM system) could be connected to through Bluetooth, or another method (Serial, Zigbee?), and it can be used to make measurement’s from a USB peripheral hanging off the BealeBone. Then again, a standalone ARM system could be designed with bluetooth and an advanced analog input front end. The benefit of doing something like this is that there are many USB data acquisition devices currently available, designing standalone bluetooth data acquisition devices from the ground up does take time. Figure 7 illustrates how you might connect a Bluetooth device to the BeagleBone to control an acquisition.
Figure 7: Bluetooth setup – The BeagleBone can be connected to via Bluetooth
b. USB Client Function
The BeagleBone has a USB client port which can be connected to another PC. The USB client port on the BeagleBone could be used from another PC to control some USB peripheral’s being hosted on the BeagleBone itself. This way another PC could also make measurements from a device connected to the BeagleBone or control it’s operation directly instead of communicating through the network or another protocol.
Link Section
I’ll be placing updates to the google code page for this project here.
I like the black box diagram #1 that treats the Bone like a web-based sensor. In this situation I would like to see a graph output (say PNG) with parameters of various time intervals, and also a Json/Xml feed of the most recent data reading.
So, a RESTful API of something like this would be great:
http://beaglebone/data/temperature/graph.png?hours=12
http://beaglebone/data/temperature/reading.json (current reading)
http://beaglebone/data/temperature/reading.xml
http://beaglebone/data/temperature/history.json?hours=12&interval=30 (last 12 hours readings at 30 minutes intervals)
With An external application running on a tablet, smart phone or PC on the network how could I read data from the BeagleBone i/o eg a Temp sensor?