Changes

Jump to: navigation, search
Ubidots
*How to upload data to the cloud.
The second part describes how to visualize on the dashboard of Ubidots. That last shows how to set up events so as to get a notification.
 
The procedure here described was tested on a SBC Lynx running Debian distribution. For more details, please refer to [[XUELK-AN-002:_Running_Debian_distribution|this application note].
====Connecting and uploading data to Ubidots====
As stated before, it is assumed that the board runs a Debian distribution:
</pre>
I) Connecting the SBC-LYNX devices To connect to the Ubidots IoT cloudby means platform, a client written in Python will be used. The client will make use of ubidot python api client To connect our SBC LYNX board to the ubidots using ubidot’s api Ubidots' client library, the first step is to install the “Python ubidots python API client” that is available on the PyPal as ubidots(https://pypi.python.org/pypi/ubidots/ (First we need to have a python installed on our board).) The command to To install it, please issue the API client to the sbcl-ynx board is following commands as follows<code>root</code> userFirst Login to Sbc<pre class="board-lynx board with root privileges (sudo) and excute these commands:terminal">
apt-get update
apt-get upgrade
easy_install pip
pip install ubidots
</pre>
Now we have installed to our target device (local gateway/device=SBC Lynx) On the necessary library python api ubidots client II) To connect our SBC LYNX board to the ubidot IoT cloud side, we need to have a user account on the ubidots cloud .com platform and get the API(a unique key for each account ) and token from the website, very simple.
Go to the [website of the ubidots Ubidots cloud, https://ubidots.com/ ] and click the sign up option on the right upper corner of the website and create the account .
I have created for my activity and here I put it in below
username =zerihun
To create an instance, the code is:
<pre class="board-terminal">
from ubidots import ApiClient
api = ApiClient(token=' fwSetosAgIG3d128YdzP5fi4hADzWU ')
</pre>
 
After establishing the instance with the cloud, we will retrieve the variable.
[[File:XUELK-AN-IIoT-7.png|thumb|center|600px|caption]]
<pre class="board-terminal">
from ubidots import ApiClient
import random
test_value_3 = random.randint(1,10)
test_value_3 = my_variable_3.save_value({'value':test_value_3})
</pre>
When we execute this python code from the SBC Lynx board, it will send random data to the ubidots (to each variable, in my case it is three variable)
4,650
edits

Navigation menu