Onion Omega and Ubidots

The Omega is an ultra small Wi-Fi development board designed specifically for wireless IoT applications. Despite of its tiny size, it comes with everything you need to connect your project to the Internet.

Requirements

Setup

1.- Connect the Omega to your computer through USB and turn on Omega.

2.- Wait for the amber LED to stop blinking, indicating that the Omega has booted up.

3.- Connect to it using Command Line:

Windows:

  • Download and install the Silicon Labs CP2102 driver for Windows.
  • Go to Computer Management and look for Silicon Labs CP210x USB to UART Bridge under Ports (COM & LPT), and take note of the COM number in bracket.
  • Open PuTTY, select Serial for the connection, enter the COM port of Silicon and enter 115200 for the speed an click on the Open button.

OSX:

  • Download and install the Silicon Labs CP2102 driver for OS X.
  • Run ls /dev/tty.* to see if the USB-to-Serial device can be detected. If the driver is successfully installed, you should be able to see a device with a name similar to /dev/tty.SLAB_USBtoUART.
  • Now type screen /dev/tty.SLAB_USBtoUART 115200.

Linux:

  • Download and install the Silicon Labs CP2102 driver source files, for kernel 3.x.x and higher and for kernel 2.6.x.
  • Build and install the driver, if you don’t know how to do it, follow Onion guide here.
  • Type ls /dev/ttyUSB, if the driver is successfully installed you should be able to see a device with a name similar to */dev/ttyUSB0**.
  • Type screen /dev/ttyUSB0 115200.

4.- Type wifisetup and follow the prompt to connect the Omega to your Wi-Fi network.

5.- Now Type oupgrade to upgrade the firmware of the onion omega.

6.- Type opkg update.

7.- When the Onion ends with the update type opkg install ubidots-client and wait until it is installed.

Using Ubidots with the Omega

Send multiple values to Ubidots

In the command line do the nexts steps:

When you are connected to Onion, create a new file using “nano”.

Onion Omega create a file

    nano ubidots.sh

Then copy and paste “ubidots.sh” inside the file and save it. Modify the code to match your preferences:

  • -t: Your Ubidots token key.
  • -d: The name of the data source that will be created. “Omega” by default.
  • set: The data to send.

Code inside ubidots.sh

#The line below tells Linux which shell to use for execution

#!/bin/bash

fast-gpio -q set-input 5
fast-gpio -q set-input 6
VALUE=value
VALUE2=value

#Replace xxxx for your Ubidots TOKEN
TOKEN=xxxXXX
DS_LABEL=mydatasourcename

VALUE=$(echo  $(fast-gpio read 5) | awk '{ print $4}')

VALUE2=$(echo  $(fast-gpio read 6) | awk '{ print $4}')

echo $VALUE2

MESSAGE="{\"temperature\":${VALUE},\"humidity\":${VALUE2}}"
echo $MESSAGE
ubidots -t $TOKEN -d $DS_LABEL set $MESSAGE

To save the file changes in the nano editor press Ctrl + x, then type “Y” and press the enter key.

Finally, run the file inside the Onion Omega. If everything goes well and your Omega is connected to the Internet, you should see a data source called “Omega” in your Ubidots account, with the variables you set.

Run the file

    sh ubidots.sh

Did this answer your question?