All Collections
Connect your Devices
Connect a BeagleBone Green Wireless to Ubidots over MQTT
Connect a BeagleBone Green Wireless to Ubidots over MQTT

Learn how to setup the BeagleBone Green Wireless with Ubidots

S
Written by Sergio M
Updated over a week ago

The BeagleBone Green Wireless is an IoT device with Wi-Fi and BLE. The wireless components support MIMO which makes data transmission quicker. BeagleBone Green Wireless has included a high-performance flexible WiFi/Bluetooth interface and two Grove connectors, making it easier to connect to the large family of Grove sensors.

In this post, you’ll learn how to program your BeagleBone Green Wireless to connect to Ubidots cloud where any raw data can be visualized, analyzed, and made valuable for your business' solutions.  

Requirements

Step-By-Step

  1. Hardware Setup

  2. Firmware Setup
    – Sending values from analog inputs (POST)
    – Receiving values from analog inputs (GET)

  3. Summary

1. Hardware Setup

1. Connect your BeagleBone Green Wireless to your PC via the USB Port.

2. BeagleBone will appear in your PC as an USB pendrive, goto and open the “BEAGLEBONE” folder.

3. Click on the “DRIVERS” and select your OS (Operating System) and follow the on-screen guide to download and install the correct drivers needed for your OS.

4. Now, let's setup WiFi for the BeagleBone Green Wireless.

Because the BeagleBone Green is an autonomous device, with the correct drivers installed, the device will then broadcast its own available WiFi network. 

From your computer, scan for available WiFi networks and select the one titled: BeagleBoneXXXXXX to establish connection to WiFi from your device.

NOTE: "XXXXXX" from BeagleBoneXXXXXX is the Beaglebone ID.

 5. Next, using either Chrome or Firefox (Internet Explorer will NOT work) type in the URL: http://192.168.7.2.  The below page will load giving you access to your BeagleBone.

6. Enter the WiFi SSID and its Password and click OK to complete your WiFi connection.

7. If all steps are correctly followed your device will be connected to the internet and you will be prompted to the BeagleBoard.org web resource to program and control your device. 

Now your BeagleBone Green Wireless is connected to the the WiFi network.

NOTICE: To verify if your device is connected you will see a display at the top of the BeagleBoard page like this:

2. Firmware Setup

To complete the firmware setup and installation of your BeagleBone device, we will be using the programming tool Node-RED. This programming manager is available from IBM and can be used for hundreds of different Application data logic mapping and data flows. For additional insights to the awesomeness of Node-RED, check out this great getting started guide

To access Node-RED, you need only select the program from your web-based BeagleBoard.org control system, as shown here.

Following the onscreen guide or by being a Node-Red pro, you can access to Node-RED by typing http://192.168.7.2:1880/ into your browsers URL.

Node-RED library installation 

1. From your Node-RED main menu dropdown (located in the top-right of the program) select “Manage palette”.

2. In the “Manage palette” section, you will be able to manage and install the nodes needed to run your application. To install the Ubidots nodes, go to the “Install” tab. Then, search "ubidots" using the search bar. Select the "ubidots-nodered" node and press the install button to complete:

Sending (POST) values from analog inputs

The easiest way to interact with Ubidots when working with analog inputs is using Node-RED. 

IMPORTANT NOTE: Make sure your WiFi is setup to BeagleBone. If not, please refer to the Hardware Setup instructions previously provided in this tutorial.

  1. To the left hand side of the BeagleBorard.org page. you will see the Node-RED section. Click on the Node-Red to begin programming your device.

  2. Following the onscreen guide or by being a Node-Red pro, you can access to Node-RED by typing http://192.168.7.2:1880/ into your browsers URL.

3. Node-RED will open in your browser, click on Node-RED menu in the upper right corner, then “IMPORT” -> “CLIPBOARD”.

4. Paste the following code in the modal space provided from your clipboard.

[{"id":"2e149338.de9a7c","type":"bbb-analogue-in","z":"5600d8f5.a42228","pin":"P9_39","topic":"","breakpoints":[{"input":0,"output":0,"mutable":false},{"input":1,"output":1,"mutable":false}],"averaging":false,"name":"Analog Pin 0","x":341,"y":162,"wires":[["e88cfc7f.28aec","4c7bee83.16fa6"]]},{"id":"d688524c.45b9","type":"inject","z":"5600d8f5.a42228","name":"Reading Activation","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"x":124,"y":162,"wires":[["2e149338.de9a7c"]]},{"id":"be8e1936.efc228","type":"debug","z":"5600d8f5.a42228","name":"","active":false,"console":false,"complete":"false","x":749,"y":284,"wires":[]},{"id":"e88cfc7f.28aec","type":"debug","z":"5600d8f5.a42228","name":"","active":false,"console":false,"complete":"false","x":522,"y":287,"wires":[]},{"id":"4c7bee83.16fa6","type":"function","z":"5600d8f5.a42228","name":"Parse Function","func":"var response = {};\nresponse.payload = {\"temperature\": msg.payload};\nresponse.topic = \"/v1.6/devices/BeagleBone\";\nreturn response;","outputs":1,"noerr":0,"x":540,"y":160,"wires":[["be8e1936.efc228","72521339.8d76ac"]]},{"id":"72521339.8d76ac","type":"ubidots_out","z":"5600d8f5.a42228","name":"BeagleBoneUbidots","token":"","label_device":"BeagleBone","tier":"business","x":763.5,"y":155.29998779296875,"wires":[]}]

In the following steps 5 - 10 you will need to specify the following;

  • Your Ubidots token

  • The analog input where your sensor is connected, 

  • The label identifier of 'Ubidots’ data source and the label identifier of the variable.

Note: In this code the “BEAGLEBONE” is the device label with “TEMPERATURE” as the variable label, and “AIN0” for analog pin 0. If the Ubidots nodes aren't installed, refer to Node-Red library installation above to install Ubidots nodes.

5. Once your flow has been dropped onto the working board, double click on “ANALOG PIN 0” to open and adjust the node. 

6. Then, within the analog pin 0 node, locate the “INPUT PIN” section and select the pin used in your device and click “OK”.

7. In the same node options, find and double click on “PARSE FUNCTION” and update “TEMPERATURE” to be the identifier of your variable, and update “BEAGLEBONE” to be the identifier of your Ubidots device.

8. Next, select the Ubidots node to update and configure to your Ubidots account information.

  • Select the type of your account:
    – Ubidots for Business..... (industrial.ubidots.com)

  • Assign the device label desired for the device. In this case, BeagleBone is the default. 

Once the parameters of your Ubidots node are properly configured, you will have something similar to the following. To save the changes, press the Done button.

9. Now it is time to deploy the flow and publish data to Ubidots cloud. For this, just press the Deploy button located at the upper right-hand side.


10. The behavior presented in the Ubidots node after deploying the flow will look as follows:

11. Go you the Device section of your Ubidots account and verify that the new device is created:

12. If you desire to change the device name to a more friendly one and you don’t know how, please reference the following guide.

Receiving (GET) values from analog inputs

1. From the Node-RED menu in the upper right corner, select “Import” -> “Clipboard.” Then copy and paste the code provided below. To access Node-RED, be sure to complete the hardware setup previous covered in this Tutorial. 

[{"id":"ec63b1a1.cc054","type":"ubidots_out","z":"5600d8f5.a42228","name":"BeagleBoneUbidots","token":"","label_device":"beaglebone","tier":"business","x":436,"y":117,"wires":[]},{"id":"6563e012.239ea","type":"ubidots_in","z":"5600d8f5.a42228","tier":"business","name":"BeagleboneUbidots","token":"","label_device":"beaglebone","label_variable":"Temperature(Celsuis)","x":184.5,"y":208.20001220703125,"wires":[["c90718d6.019b08","68099677.872318"]]},{"id":"c90718d6.019b08","type":"function","z":"5600d8f5.a42228","name":"Parse Ubidots Value","func":"var lastValue = msg.payload.value;\nmsg.payload = lastValue;\nreturn msg;","outputs":1,"noerr":0,"x":444.5,"y":208.20001220703125,"wires":[["6f2c5ca.feeeea4","b1dbba2a.3098f8"]]},{"id":"68099677.872318","type":"debug","z":"5600d8f5.a42228","name":"","active":false,"console":false,"complete":"false","x":444.5,"y":288.20001220703125,"wires":[]},{"id":"6f2c5ca.feeeea4","type":"debug","z":"5600d8f5.a42228","name":"","active":false,"console":false,"complete":"false","x":684.5,"y":288.20001220703125,"wires":[]},{"id":"5619ac27.0064b4","type":"inject","z":"5600d8f5.a42228","name":"","topic":"","payload":"{\"control\": 0}","payloadType":"json","repeat":"","crontab":"","once":true,"x":188,"y":120.70001220703125,"wires":[["ec63b1a1.cc054"]]},{"id":"b1dbba2a.3098f8","type":"upm-grove-led","z":"5600d8f5.a42228","name":"","platform":"0","mode":"blink","pin":"0","interval":1000,"x":692,"y":193.89999389648437,"wires":[]}]

2. Assign your Ubidots TOKEN where is indicated in both Ubidots nodes.

3. Once your flow has been dropped onto the working board, double click on “Grove LED” to open and adjust the node.

4. Then, within the grove led node, locate the  “PIN” and select the pin that you want and click “OK”.

5. Now it is time to deploy the flow and publish data to Ubidots cloud. For this, just press the Deploy button located at the upper right-hand side.

6. The behavior presented in the first Ubidots node is “Connecting...”  then “published”. At this point, a variable called "control" is created in the device in your Ubidots account. This variable will be used to control your devices - in this case an LED

7. To CONTROL YOUR DEVICE you need to create a control widget in your Ubidots Dashboard. Go to the Dashboard section of your Ubidots account and create a new Control Widget.
Press the plus (+) icon located at the upper right corner of your Dashboard, then press Control > Switch > control (variable previously created) > Finish:

With this final step you will now have a new widget to control your BeagleBone device - in this case the LED attached: 

8. To Verify your work, you can see the status of the Device, if the value of your widget is 0 (or OFF) in Ubidots, the LED will be OFF, and your Node-RED flow will verify with a value of OFF in the Grove LED node. If your Ubidots account has a widget status of ON, this same functionality can be expected but will report the LED as ON.

3. Summary

BeagleBone enables your access to the BeagleBoard product offerings in a simple to utilize bundle. Ideal for sending and receiving data to/from the Ubidots platform, the BeagleBone Green is simply programmed and connects to the server via Node-RED. By following the steps presented in this guide you have now connected your BeagleBone device to the internet and successfully transmitted its data to Ubidots where you can now continue your Apps designing and functionality to monitor and control a system or environment.

Other readers have found useful...

Did this answer your question?