Octoblu is an Internet of Things platform that allows you to connect any of your devices and send messages from one device to another. If you have some sensors and a Raspberry Pi, Intel Edison, or any other microcomputer that can run Node.js, then you can easily stream sensor data into Octoblu. This is done by creating a custom Meshblu device, in the form of a simple JavaScript app, to interface with Octoblu. From Octoblu, you can pipe your information into a data store that can help you further analyze it, such as Splunk or Initial State.
In this walkthrough, I will be showing you how to create a Meshblu device, run it on an Intel Edison, and debug the sensor data in Octoblu.
Edison SetupPlease follow the official documentation to setup your Intel Edison.
Make sure that you configure your edison with WiFi, as you will need to be able to pull code from github. Step 4 in the official setup guide will walk you through this.
A neat feature of the Edison is that it comes with Node.js and it's package manager, npm, preinstalled.
Now that you have your Edison configured and setup with WiFi, you will need to install git by running the command:
npm install --global git
Now that you have Node and git installed, your Edison is almost ready to talk to Octoblu! This would be a good time to connect sensors to your Edison.
Custom Meshblu Device SetupI suggest you clone the boilerplate, as it will have everything you need.
From your Edison:
cd /node_app_slot
git clone repo-url
You can get the repo-url from the Code section at the bottom.
Look at the main.js file in the boilerplate. This would be a good time to configure it for your sensors. Currently, it is using a JavaScript robotics library called Johnny-Five. J5 makes it easy to interface with any sensor. If you would like more information, refer to their official documentation.
If you would like more information on Meshblu socket.io functions, refer to the official documentation.
Now that you have your code ready to go, we will need to generate some Meshblu credentials via meshblu-util:
npm install --global meshblu-util
meshblu-util register -t device:my-device > meshblu.json
meshblu-util claim
Once you run the final command, it should open a new tab in your default browser, walking you through the device claiming process.
Final Edison NotesThe node_app_slot folder should contain a main.js file. xdk-daemon is a service that is running on the Edison by default and will run node_app_slot/main.js when the device boots up.
Because it is looking for a main.js file inside of node_app_slot, you will need to move all the files from inside your repo folder out into the node_app_slot:
cd /node_app_slot
cd meshblu-custom-device-boilerplate
mv .git ../
mv main.js ../
etc...
Also make sure to stop the xdk-daemon service before manually running your script. You can check if it is running, and stop it with the following commands:
ps | grep xdk
systemctl stop xdk-daemon
Now that you have the boilerplate in the node_app_slot and the xdk-daemon service is stopped, you are ready to run your custom device!
Running Device and Debugging in OctobluNow we will install dependencies and run your device:
cd /node_app_slot
npm install
npm start
With your device running, go to app.octoblu.com
1. Create a new flow
2. Add your custom device to the flow
3. Add a Debug tool and connect it to your device
4. Click the green arrow in the top right to run your flow
You should now be able to see your sensor's data in our debug pane in the sidebar!
If you are having trouble or have any questions, hit us up on Gitter or via the chat bubble in the lower right on app.octoblu.com!
Comments