Category Archives: Onion Omega

20151028_112810.jpg

Onion Omega First Steps

I had ordered an Onion Omega during their KickStarter campaign, and I received my unit sometime in October but had not taken time to try it out.

My intent is to use it as some sort of a home IoT hub or gateway to Cloud, running the Mosquitto MQTT server and Node.js with Node-RED.

This Web Log is exactly that, a log of my early tests ans some tips for usage, that I intend to use as reference later on.

Power usage

I measured the Onion’s power fraft using a simple meter on the USB power cord.
Connected to the dock, it draws about 45 mA@5V idling, so about 0.225 Watt.

20151102_220623.jpg

Omega with power meter

Pinout

Onion Omega comes with a 2mm pitch row on the main board, and20151028_115421.jpg

the docking board has 1/10″ standard pitch headers:

20151028_115436.jpg

Beware that the I/Os are neithe 5V nor 3.3V, but 2.8V.

USB/TTL Connectivity

Out of the box, connect at 115200 bps (with e.g. TeraTerm) to the COM port brought through the USB socket on the docking board.

Wifi setup

Run wifisetup command interactively
or run

wifisetup -ssid <ssid> -password <password>

To verify status, use  wifisetup -checkconnection
Then run ifconfig to verify. There should be two wlan interfaces, one for AccessPoint (AP), one for STAtion mode (e;g. client)
The AP defines the 192.168.3.* subnet, STA connects to your router’s subnet, e.g. can be 192.168.0.*
On my Onion, I get AP on wlan0-1, and STA on wlan0

Web interface

The Web interface is available on the AP or STA IPs. So this will be on port 80 on the IP address.  Credentials for connection are: root/onioneer
Of particular interest is the Status page which shows memory usage.

Upgrade Firmware

Run oupgrade -check
See https://onion.freshdesk.com/support/solutions/articles/6000069919-how-do-i-update-the-firmware- for details.

Beware that “Firmware upgrade will erase all files outside of the /etc directory. “, and this includes any program that may have been installed, as well as the packages list.

Linux shell

Most built-in linux commands redirect to /bin/busybox (multi-call binary). To find out available commands, call busybox directly.

To run commands in background, use Ctrl-z.
bg command to resume
jobs command to list
fg %job_id to bring back to front
Or append & at the end of command to put in background directly

Updating packages list

run opkg update
then opkg list

Dock RGB LED

To change the dock RGB LED, use the expled command:

expled FF0000 -> red
expled 00FF00 -> green
expled 0000FF -> blue
expled 00FFFF -> cyan
expled FFFF00 -> yellow
expled FF00FF -> purple

This actually drives pwm GPIO on I/O pins 15,16,17:

fast-gpio pwm 17 200 0
fast-gpio pwm 16 200 100
fast-gpio pwm 15 200 0

To flash slowly:

fast-gpio pwm 15 2 80 -> blue
fast-gpio pwm 16 2 80 -> green
fast-gpio pwm 17 2 80 -> red

OLED expansion

Use oled-exp command:

oled-exp -i power on
oled-exp write Hello
oled-exp -c power on cursor 3,6 write "zoulou was here"
oled-exp scroll diagonal-right

Mosquitto (MQTT server) setup

opkg install mosquitto
opkg install mosquitto-client
[opkg install libmosquitto] -> done by install mosquitto-client

subscribe in background:

mosquitto_sub -v -t /test/#&

publish message:

mosquitto_pub -m 'Hello' -t /test/pub

Node.js setup

nodejs – 0.1-1 – Event-driven I/O server-side JavaScript environment based on V8:
opkg install nodejs
reports v0.10.5 (history says it is 2013-04-26), see https://nodejs.org/en/download/releases/

/usr/bin/node (or just node, since /usr/bin is in the path)

Test Node, copy this to hello.js

    var http = require("http");
    http.createServer(function (req, res) {
      res.writeHead(200, {"Content-Type": "text/plain"});
      res.end("Hello World\n");
    }).listen(8000);

Run in background using node hello.js&
Then Check URL at http://ip:8000

npm is supposed to be standard with node.js since 0.6.3, should have npm 1.2.18

NodeRED setup

Not sure this can fit or if the node version is high enough