Getting Started with Onion Omega2

The Onion Omega2 is a low-cost, small form-factor Linux computer with onboard wifi and storage. It has been successfully funded on both IndieGoGo and Kickstarter, and rewards have recently started landing on backers’ doorsteps.

In this post, I’ll show you how to get started with python and the GPIO pins.

Onion Omega2


Setting up the Omega2 only takes a couple of minutes. When started, an access point is available to guide you through the process of connecting the Omega2 to your own wifi network. The procedure can be found here: First Time Setup.

It is worth noting though, that the use of the “Expansion Dock” is recommended to power the board, as it accepts a microUSB power supply an regulates it to the required 3.3V input. The dock also facilitates access to the GPIO pins.

Once the Omega2 is connected to the local network, it’s possible to connect via ssh.


Using a terminal, it is possible to connect to the Omega2 using the same “omega-ABCD.local” address. The ssh username is “root”, the password “onioneer”.

That’s it! We’re now connected to the Omega2 via ssh. Time for some maintenance …


Chances are high that your Omega2’s firmware is no longer the latest version available. Upgrading the firmware of the Omega2 in order to benefit from the latest features, can be done with a single command. The Omega2 will connect to the internet, compare the installed version to the latest one and upgrade if necessary.

After the upgrade, the Omega2 will reboot and the banner will display the new version. In this particular case, I received the Omega2 with firmware “0.1.6 b136” and upgraded to version “0.1.9 b149”.


Now, upgrading isn’t always great either. Especially when the product is new and a lot of active development is still happening. Bugs can be introduced or previously working features can become broken.

This is the case for the multiplexing capabilities of the Omega2’s GPIO pins in version “0.1.9 b149”. Trying to list the current configuration of the pins returns an error:

I quickly found an open ticket, stating this was broken in the latest release. By downgrading, the functionality can be restored.

Downgrading requires you to download the desired firmware file and execute the “upgrade” using that specific file.

After a reboot of the Omega2, the banner has been updated and shows the downgraded version: “0.1.6 b137”.


Upgrading the firmware covers the core functionality of the Omega2, but the applications need to be updated separately.


The Omega2 has a bunch of GPIO pins which can be used to control things or serve as inputs for data. There is a tool called “gpioctl” installed by default, which can be used to do just that.


In its simplest form, an output can be used to control an LED, once you can do that, the LED can be replaced by more complex components.

Take an LED and resistor. Connect one end of the resistor to GPIO 0, the other end to the LED’s anode. Finally, connect the LED’s cathode to ground.

The syntax of the command is simple: gpioctl

The LED should turn ON and OFF respectively.


Connect one end of the button to 3.3V and the other end to GPIO 1.

Set the direction of GPIO 1 to input, press the button and read the state. It should toggle between HIGH (pressed) and LOW (released).


Some GPIO pins on the Omega2 can have multiple functions. That’s a feature called multiplexing. It is possible to reconfigure these pins on the fly with a simple application, depending on your project’s I/O needs.

Get the current GPIO configuration:

If you require more GPIO pins, the function of some pins can be switched using the “gpiomux” function.

The changes are reflected when listing the new configuration.

You now have a lot more “normal” GPIO pins to use.


Now that the basic GPIO functions work, let’s explore python and control these GPIO pins from code.

First step: install python.


As the name suggests, “python-light” is a lighter version of python, requiring less disk space. Ideal, since the Omega2 has limited onboard storage.

Once done, verify the installation is successful by querying the python version.

Python installed: check!


The folks at Onion have created a python module to make interfacing with the GPIO from code easier. It can be installed using the package manager.


To test python and the GPIO module, I created a simple script to light up an LED when a button is pressed.

Create a file and paste the code below.

Once the file is saved, make it executable.

Wire up the button and LED, run the script and start pressing the button!

Et voila, your are now controlling the Omega2’s GPIO from code, using python!

© Frederick Vandenbosch, 2014-2019. Unauthorised use and/or duplication of this material without express and written permission from this blog’s author and owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to Frederick Vandenbosch with appropriate and specific direction to the original content.