{"id":16333,"date":"2016-09-23T10:00:46","date_gmt":"2016-09-23T17:00:46","guid":{"rendered":"https:\/\/blog.digilentinc.com\/?p=16333"},"modified":"2024-12-28T16:32:03","modified_gmt":"2024-12-29T00:32:03","slug":"using-a-raspberry-pi-to-control-a-beaglebone-black-over-wi-fi","status":"publish","type":"post","link":"https:\/\/digilent.com\/blog\/using-a-raspberry-pi-to-control-a-beaglebone-black-over-wi-fi\/","title":{"rendered":"Using a Raspberry Pi to Control a BeagleBone Black Over Wi-Fi"},"content":{"rendered":"<p>Recently I set out to create a project that involved open communication between the <a href=\"https:\/\/digilent.com\/shop\/beaglebone-black\/\">BeagleBone Black<\/a> and the <a href=\"https:\/\/digilent.com\/shop\/raspberry-pi-2\/\">Raspberry Pi 2<\/a>, in an attempt to\u00a0end their\u00a0age-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\u00a0over Wi-Fi using UDP. To do this I used\u00a0<a href=\"https:\/\/www.labviewmakerhub.com\/doku.php?id=learn:tutorials:libraries:linx:3-0:beaglebone-black-setup\">LINX 3.0<\/a>,\u00a0the newest edition of LINX from\u00a0<a href=\"https:\/\/www.labviewmakerhub.com\">LabVIEW Makerhub<\/a>.\u00a0LINX is a free\u00a0<a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW<\/a>\u00a0add-on that allows you to target the Raspberry Pi and BeagleBone.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-15774 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/Slack-for-iOS-Upload-431x600.jpg\" alt=\"Slack for iOS Upload\" width=\"431\" height=\"600\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/Slack-for-iOS-Upload-431x600.jpg 431w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/Slack-for-iOS-Upload-768x1069.jpg 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/Slack-for-iOS-Upload-735x1024.jpg 735w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/Slack-for-iOS-Upload-800x1114.jpg 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/07\/Slack-for-iOS-Upload.jpg 1470w\" sizes=\"auto, (max-width: 431px) 100vw, 431px\" \/><\/p>\n<p>When the code was finished we pitted the Beaglebone Black and the Raspberry Pi Sumobots against each other in an epic battle.<\/p>\n<p>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.\u00a0This 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.<\/p>\n<p>Currently LED&#8217;s controlled by the BeagleBone Black are turned on when a push button attached the Raspberry Pi is pressed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16787 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FJVGTCFIT22WFS4.LARGE_-600x450.jpg\" alt=\"fjvgtcfit22wfs4-large\" width=\"600\" height=\"450\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FJVGTCFIT22WFS4.LARGE_-600x450.jpg 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FJVGTCFIT22WFS4.LARGE_-768x576.jpg 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FJVGTCFIT22WFS4.LARGE_.jpg 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/FJVGTCFIT22WFS4.LARGE_-800x600.jpg 800w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>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.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16737 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/RPI__controld-600x190.png\" alt=\"rpi__controld\" width=\"600\" height=\"190\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/RPI__controld-600x190.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/RPI__controld-768x243.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/RPI__controld-800x253.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/RPI__controld.png 934w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p>Now let&#8217;s take a look at the BeagleBone&#8217;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&#8217;s out of the outer while loop we close LINX as well as the UDP socket.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-16739 aligncenter\" src=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/BBB__LEDd-600x195.png\" alt=\"bbb__ledd\" width=\"600\" height=\"195\" srcset=\"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/BBB__LEDd-600x195.png 600w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/BBB__LEDd-768x249.png 768w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/BBB__LEDd-1024x333.png 1024w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/BBB__LEDd-800x260.png 800w, https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/BBB__LEDd.png 1392w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/>If you are interested in making a similar project, please check out my <a href=\"http:\/\/www.instructables.com\/id\/Using-a-Raspberry-Pi-to-Control-a-BeagleBone-Black\/\">Instructable<\/a> where I posted my code and provided\u00a0detailed instruction on setting this up. if you are interested in making this project yourself but don&#8217;t have the right supplies, you can purchase the LabVIEW computing kit for the\u00a0<a href=\"https:\/\/digilent.com\/shop\/labview-physical-computing-kit-for-beaglebone-black\/\">BeagleBone Black<\/a>\u00a0or the\u00a0<a href=\"https:\/\/digilent.com\/shop\/labview-physical-computing-kit-for-raspberry-pi-2\/\">Raspberry Pi 2<\/a>. This kit includes a copy of\u00a0<a href=\"https:\/\/digilent.com\/shop\/labview-home-bundle\/\">LabVIEW 2014 Home Edition<\/a>\u00a0and everything you will need to run\u00a0<a href=\"https:\/\/www.labviewmakerhub.com\/doku.php?id=learn:tutorials:libraries:linx:3-0:beaglebone-black-setup\">LINX 3.0<\/a>\u00a0and start making projects. And as always, please comment below with any questions or suggestions\u00a0you may have!<\/p>\n<div class='watch-action'><div class='watch-position align-left'><div class='action-like'><a class='lbg-style6 like-16333 jlk' data-task='like' data-post_id='16333' data-nonce='758349f32d' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Like' \/><span class='lc-16333 lc'>0<\/span><\/a><\/div><div class='action-unlike'><a class='unlbg-style6 unlike-16333 jlk' data-task='unlike' data-post_id='16333' data-nonce='758349f32d' rel='nofollow'><img src='https:\/\/digilent.com\/blog\/wp-content\/plugins\/wti-like-post-pro\/images\/pixel.gif' title='Unlike' \/><span class='unlc-16333 unlc'>0<\/span><\/a><\/div><\/div> <div class='status-16333 status align-left'>Be the 1st to vote.<\/div><\/div><div class='wti-clear'><\/div>","protected":false},"excerpt":{"rendered":"<p>Austin showcases his latest project, working with the BeagleBone Black, Raspberry Pi and LabVIEW LINX.<\/p>\n","protected":false},"author":42,"featured_media":16792,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4327,4312],"tags":[],"ppma_author":[4493],"class_list":["post-16333","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projects","category-usb-scopes-analyzers-generators"],"jetpack_featured_media_url":"https:\/\/digilent.com\/blog\/wp-content\/uploads\/2016\/09\/Screen-Shot-2016-09-15-at-3.00.31-PM-e1473977115972.png","authors":[{"term_id":4493,"user_id":42,"is_guest":0,"slug":"astanton","display_name":"Austin Stanton","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/056fddaefc60a1f99c226ea5757a8c41?s=96&d=mm&r=g","author_category":"","user_url":"","last_name":"Stanton","last_name_2":"","first_name":"Austin","first_name_2":"","job_title":"","description":""}],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/16333","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/users\/42"}],"replies":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/comments?post=16333"}],"version-history":[{"count":2,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/16333\/revisions"}],"predecessor-version":[{"id":31224,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/posts\/16333\/revisions\/31224"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media\/16792"}],"wp:attachment":[{"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/media?parent=16333"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/categories?post=16333"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/tags?post=16333"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/digilent.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=16333"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}