What is the easiest way to collect data from your Beaglebone and push it in real-time to the cloud and visualize it from anywhere in the world?
The answer is in following this tutorial.
Step 1: Get the S2chttp Library From Npm Repository Into Your BB
1. ssh to your beaglebone and use root as the login. no password is required
2. cd /var/lib/cloud9
3. npm install s2chttp
4. cp /var/lib/cloud9/node_modules/s2chttp/examples/s2c_io_client.js /var/lib/cloud9/autorun/s2c_io_client.js
this will copy the sample code into the autorun directory
Step 2: Run Client
1. cd autorun
2. node s2c_io_client.js
3. you should get response as shown in picture. what is happening is that the client does not provide a valid authentication key with s2c.io. So, let's get a valid key. Before you go: please take a note of your macaddr as shown in picture. we will need later.
Step 3: Sign Up for an Account With S2c.io
To get a valid key, you need to sign-up for a free account with s2c.io
1. Go to https://s2c.io
2. click 'Register'
3. Follow the Instructions to create then activate your account
4. Login to your s2c.io account
5. Click 'Device Manager'
6. Click 'Add Gateway' and select 'Beagelebone' then fill out the information. The 'macaddr' is the one noted from the previous step
7. After your added your BB, click 'Edit Gateway' then copy the 'SecureKey'. That the key we need for the next step
Step 4: Add Your API_KEY
now go back to you SSH session with your BB.
1. cd /var/lib/cloud9/autorun
2. vi s2c_io_client.js
you can now edit the client to add the key we captured from previous step.
click insert navigate to gat.API_KEY = 'YOUR API KEY HERE'
replace the API_KEY with the API KEY of your beaglebone
type wq! then ENTER
_Note_: Get API_KEY from s2c.io device manager > Edit Config > SecureKey
3. run your client again, node s2c_io_client.js
4. look at the print out now, you should see
POST response S2C.io ACK Message: OK!. Request from IP: x2x.4x.9x.19x
now that your BB can push data to the cloud, let's visualize it
Step 5: Data Visualization
1. login to your s2c.io account
2. Click 'Application Manager' then click 'add' to create a new application with the following:
name: choose anything
template: select 'Beaglebone'
select device: click checkbox next to you BB from the list
3. Click 'Run'
a new window open where you can see a number of widgets that display the values push by your BB
Congratulations! your BB is now pushing and you can access your data from anywhere in the world.
There are other more features that you might want to try:
- add a logo to your application
- add users to view your application
- create alerts to receive email alerts when a condition is met in the field
- modify your application by adding more widgets
- and more.....
if you need any help please email me at email@example.com