Recently I set out to create a project that involved open communication between the BeagleBone Black and the Raspberry Pi 2, in an attempt to end their age-old feud. My fellow LabVIEW intern Ella and I wrote code for the SumoBots, and this code allowed a BeagleBone Black or Raspberry Pi 2 on a controller to communicate with its counterpart attached to a Sumobot over Wi-Fi using UDP. To do this I used LINX 3.0, the newest edition of LINX from LabVIEW Makerhub. LINX is a free LabVIEW add-on that allows you to target the Raspberry Pi and BeagleBone.
When the code was finished we pitted the Beaglebone Black and the Raspberry Pi Sumobots against each other in an epic battle.
Later on when people started showing interest in the communication part of my code, I saw an opportunity to create a project that would unite the microprocessors. I chose to make a simple project so I could keep my code generalized and easy to modify. This means you could attach many different types of sensors or controls to the Raspberry Pi 2, and have them control any number of things attached to the BeagleBone Black over Wi-Fi. Below you can see the circuit setup for each microprocessor.
Currently LED’s controlled by the BeagleBone Black are turned on when a push button attached the Raspberry Pi is pressed.
Below you can see the LabView code for the Raspberry Pi. Once you open the VI you would simply enter the IP address specific to your BeagleBone Black and then change the DI channels to the DIO pins attached to the switches or whatever you wanted to read from. The block diagram for this VI is also very simple. It starts with opening LINX, then it sets to Local I/O. Since we are using a Raspberry Pi, the code that you write in LabVIEW actually gets deployed to the board. After LINX is opened, it opens a UDP socket and then enters the while loop. 4 digital reads inside the loop get data from each switch, then it is it is all bundled together and UDP write sends it to the BeagleBone Black over Wi-Fi. Once the stop button is pressed we leave the loop and close the LINX reference, as well as the UPD socket.
Now let’s take a look at the BeagleBone’s LabVIEW code. You can see that again we start with a LINX open set to local I/O because we are deploying this code to the BeagleBone Black. Next, we enter the while loop and open up a UDP socket, then split it into two different while loops. The top while loop uses a UDP read to collect the data sent over from the controller, the bottom loop gathers uses that information to determine whether or not each specific LED should be lit. To end this code we press the stop button, which will exit both the inner loops. Then when it’s out of the outer while loop we close LINX as well as the UDP socket.
If you are interested in making a similar project, please check out my Instructable where I posted my code and provided detailed instruction on setting this up. if you are interested in making this project yourself but don’t have the right supplies, you can purchase the LabVIEW computing kit for the BeagleBone Black or the Raspberry Pi 2. This kit includes a copy of LabVIEW 2014 Home Edition and everything you will need to run LINX 3.0 and start making projects. And as always, please comment below with any questions or suggestions you may have!