Using a Raspberry Pi to Control a BeagleBone Black Over Wi-Fi

by Austin Stanton in Circuits > Raspberry Pi

2214 Views, 22 Favorites, 0 Comments

Using a Raspberry Pi to Control a BeagleBone Black Over Wi-Fi

IMG_8217 2.JPG

In this Instructable I will show you how to use a Raspberry Pi to control a BeagleBone Black over Wi-Fi using LabVIEW and LINX 3.0. In this simple project, LED's controlled by the BeagleBone Black are turned on when a push button attached the Raspberry Pi is pressed. My code is simple enough that it could easily be modified, 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. Before you can start this project you will need to download LINX 3.0 which gives you the ability to deploy LabVIEW code to run on BeagleBone Black and Raspberry PI 2 and 3. For help with the setup visit this Labviewmakerhub.com.

Materials

Screen Shot 2016-09-14 at 9.06.45 PM.png

Hardware

  1. Raspberry Pi 2
  2. BeagleBone Black
  3. Wi-Pi WiFi dongle
  4. 4 LED's
  5. 4 push buttons(momentary switches)
  6. 2 Breadboards
  7. External power source (I use Anker Astro External Power Banks)

(The push buttons, breadboards and the LED's are included in the LabVIEW Interaction Parts Kit)

Software

  1. LabVIEW 2014 Home Edition
  2. LINX 3.0

Raspberry Pi Circuit Setup

buFiU.jpeg

First, connect the 3.3V pin(pin 1 or 17) to the bus on one side of your breadboard. Next, connect the bus on the opposite side to one of the ground pins(pin 9, 14, 20, 25, 30, 34, 39).

Screen Shot 2016-08-12 at 1.30.00 PM

Add 4 momentary switches across the center of the breadboard. Connecting one side of each to the 3.3 Volt bus. Add a 10 Kohm pull-down resistor in series with ground on the output of both switches, Next connect wires from the DIO Pins(I chose 12, 16,18 and 22) to the other leg of the same side of the switch that is connected to ground.

screen-shot-2016-09-14-at-7-35-49-pm

BeagleBone Black Circuit Setup

YCb5R.jpeg

First, connect one of the busses to one of the ground pins(pin 1, 2, 47, 48, 89, 90, 91, 92).

Screen Shot 2016-08-12 at 1.24.05 PM

Add 4 LED's breadboard, connect the shorter leg(the cathode) of each LED to the ground bus with a wire. Next wire 4 of your DIO pins to your breadboard(I chose 8, 10, 12, 16), then run a 220 Kohm resistor from each to the longer leg(the anode).

screen-shot-2016-09-14-at-5-17-02-pm

LabVIEW Code

Screen Shot 2016-09-14 at 4.09.43 PM.png

Download the LabVIEW project attached below. Before you open the individual VI's you will need to change the IP address shown to the specific IP addresses of your BeagleBone Black and the Raspberry Pi. To do this right click on the Beaglebone Black and select "properties".

screen-shot-2016-09-14-at-10-39-34-pm

Change the IP address in the input that says "IP address/DNS name". Repeat this process with the Raspberry Pi. Once the IP address is correct right click each and select connect, this will open a connection to each device.

Downloads

Raspberry Pi LabVIEW Code

RPI__controlp.png

Start by opening the RPI control VI under the Raspberry Pi category. Before you can deploy you will need to change some things on the front panel. Start by changing the DI channels to the DIO pins you attached to the switches. Next, input the IP address of your BeagleBone Black. Finally, you will choose the Local port and the port you will be sending to, I would keep these the same unless you have reason to change them.

rpi__controld

Above is the block diagram for this VI, the first block is a LINX open. It is set to Local I/O because we are using a Raspberry Pi the code that you write in LabVIEW actually gets deployed to the board. After LINX is opened open a UDP socket and then enter the while loop. 4 digital reads inside the loop get data from each switch then it is it is all bundled 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.

BeagleBone Black LabVIEW Code

BBB__LEDp.png

Next, open the BBB_LED VI under the BeagleBone Black category. Again, before you can deploy you will need to change some things on the front panel. Start by changing the DO channels to the DIO pins you attached to the LED's. Next, input the IP address of your BeagleBone Black. Finally, you will choose the port, make sure this matches the port you set in the RPI control VI.

bbb__ledd

Above is the block diagram for this VI, 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, it then splits 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 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.

The End

IMG_8213 2.JPG

Thank you for reading my instructable, 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. Please comment with any questions or comments you may have.