Onion Omega Series Overview

The Onion Omega series consists of compact, Linux-based IoT development boards designed for embedded systems, automation, and networking applications. These modules provide built-in Wi-Fi, GPIO expansion, and support for various peripherals, making them ideal for IoT, robotics, and industrial automation projects.

Onion Omega Module Variants

Omega2

The Omega2 is the base model in the Omega2 series. It features a 580 MHz MIPS CPU, 64MB RAM, and 16MB flash storage. It is designed for IoT applications and can be expanded using Onion expansion boards.

Omega2+

The Omega2+ is an upgraded version of the Omega2, featuring 128MB RAM and 32MB flash storage, along with a microSD card slot for additional storage expansion.

Omega2S & Omega2S+

The Omega2S and Omega2S+ are surface-mount versions of the Omega2 and Omega2+, designed for integration into custom PCBs. They provide the same features but in a form factor suitable for embedded designs.

Omega2 LTE

The Omega2 LTE adds cellular connectivity with built-in LTE modem support, making it ideal for remote applications requiring mobile data connectivity.

Omega2 Pro

The Omega2 Pro is a fully integrated development platform featuring built-in power regulation, storage, and expansion connectors, allowing for easy prototyping and development.

Omega2 Dash

The Omega2 Dash includes a built-in 3.2" touchscreen LCD, enabling graphical user interfaces for IoT applications and control panels.

Feature Comparison Table

Model CPU RAM Flash Storage MicroSD Slot Wi-Fi LTE Touchscreen GPIO
Omega2 580 MHz MIPS 64MB 16MB No Yes No No 18
Omega2+ 580 MHz MIPS 128MB 32MB Yes Yes No No 18
Omega2S 580 MHz MIPS 64MB 16MB No Yes No No 18
Omega2S+ 580 MHz MIPS 128MB 32MB Yes Yes No No 18
Omega2 LTE 580 MHz MIPS 128MB 32MB Yes Yes Yes No 18
Omega2 Pro 580 MHz MIPS 128MB 256MB Yes Yes No No 18
Omega2 Dash 580 MHz MIPS 128MB 32MB Yes Yes No Yes (3.2") 18

Conclusion

The Onion Omega series provides a range of IoT and embedded development solutions, from basic microcontrollers to LTE-connected modules and touchscreen-enabled devices. Depending on your application, you can choose a model that best fits your performance, connectivity, and interface needs.

Onion Omega2 / Omega2+

Onion Omega2+ board (top view)

Image: Pittigrilli / Wikimedia Commons, public domain (CC0 1.0). :contentReference[oaicite:5]{index=5}

Onion, Omega2 is open-source hardware (see their documentation).

WiFi on Onion Omega Series

The Onion Omega series comes with built-in WiFi, enabling seamless wireless communication for IoT projects. With its WiFi capabilities, the Omega can easily connect to networks, communicate with remote servers, and interact with other devices in your system.

WiFi Features

Connecting to a WiFi Network

To connect the Omega to a WiFi network, follow these steps:

  1. Access the Omega's web interface or SSH into the device.
  2. Use the following command to scan available networks:
    iw dev wlan0 scan
  3. Connect to your network using the following command:
    wifi config wlan0 -i  -p 

Ethernet on Onion Omega Series

The Onion Omega series is designed primarily for WiFi connectivity, but it also supports Ethernet connections via a USB-to-Ethernet adapter. This feature allows the Omega to connect to wired networks, making it an excellent choice for applications requiring a stable, high-speed connection.

Using Ethernet with Onion Omega

To use Ethernet with the Onion Omega, you need to connect a compatible USB-to-Ethernet adapter to the USB port of the Omega device. The Omega will automatically recognize the adapter, and you can configure the network settings through the web interface or using the terminal.

Enabling Ethernet Connection

Once the Ethernet adapter is connected, the following steps can be followed to configure the connection:

  1. Connect the USB-to-Ethernet adapter to the Omega's USB port.
  2. Access the Omega's web interface or SSH into the device.
  3. Run the following command to configure the network interface:
    ifconfig eth0 up
  4. Use the following command to get the IP address assigned to the Ethernet interface:
    ifconfig eth0

I2C on Onion Omega Series

The Onion Omega series supports the I2C (Inter-Integrated Circuit) communication protocol, which is commonly used for connecting microcontrollers and peripherals such as sensors, displays, and EEPROMs. I2C allows multiple devices to communicate over a two-wire bus: one for data (SDA) and one for clock (SCL).

I2C Features on Onion Omega

Enabling I2C on Onion Omega

By default, the I2C interface is not enabled on the Omega. To enable I2C, follow these steps:

  1. SSH into your Onion Omega device.
  2. Run the following command to enable I2C:
    echo "i2c-gpio" > /sys/module/i2c_bcm2708/parameters/i2c0
  3. Confirm that the I2C bus is available by checking the device tree:
    ls /dev/i2c-0

Using I2C with Devices

Once I2C is enabled, you can start communicating with I2C devices. You can use a tool like i2c-toolsor a programming language like Python to interact with I2C peripherals. The common I2C tools are i2cdetect, i2cget, and i2cset, which allow you to detect devices, read, and write data to I2C addresses.

Example: Detecting I2C Devices

Use the i2cdetectcommand to scan for connected I2C devices:

i2cdetect -y 0

This will display a matrix showing the I2C addresses of all devices connected to the bus.

Example: Reading Data from an I2C Device

Once you have detected your I2C device, you can read data from it using the i2cgetcommand:

i2cget -y 0 0x48 0x01

This example reads data from address 0x48 (a common I2C address for a temperature sensor) at register 0x01.

Using Python for I2C

Python is a popular choice for communicating with I2C devices on the Omega. The SMBuslibrary makes it easy to communicate with I2C devices using Python.

Example: Python Code to Read from an I2C Device


import smbus

# Initialize the SMBus
bus = smbus.SMBus(0)

# Define the I2C address of the device
device_address = 0x48

# Read a byte of data from register 0x01
data = bus.read_byte_data(device_address, 0x01)

print(f"Data: {data}")
    

This example demonstrates how to initialize the I2C bus and read a byte of data from a device with address 0x48, which could be a temperature sensor or similar device.

Audio on Onion Omega Series

The Onion Omega series offers basic support for audio playback and input through various methods, including digital audio output, analog audio output, and software libraries. While the Omega does not have a dedicated audio chip like some other boards, it is flexible enough to interface with external audio hardware such as USB sound cards, audio shields, and I2S devices. Additionally, it can generate and process audio using its software capabilities.

Audio Output Options

The Omega offers multiple ways to output audio:

Audio Input Options

For audio input, the Omega can interface with USB audio devices or use GPIO pins in combination with external components. Some options include:

Configuring USB Audio Devices

To use a USB audio device, simply plug the USB audio adapter into one of the USB ports on the Onion Omega. The device should be automatically detected by the Omega. You can configure and control it using the following steps:

  1. SSH into your Onion Omega device.
  2. Run the following command to check if the device is recognized:
    lsusb
  3. If the device is detected, use the aplaycommand to output audio:
    aplay /path/to/audiofile.wav
  4. You can also control volume and playback settings using alsamixerand other ALSA tools.

Using I2S for Audio

The Omega can interface with I2S audio peripherals like DACs or audio codecs. The I2S interface allows for high-quality audio output at a lower latency than PWM. Here’s how you can enable and use I2S on the Onion Omega:

  1. Ensure that I2S peripherals (such as a DAC or audio codec) are connected to the correct GPIO pins.
  2. Use a library like onion-i2s to configure I2S and send audio data.
  3. Example Python code for sending audio data over I2S:
    
    import I2S
    
    # Initialize I2S interface
    i2s = I2S.I2S()
    
    # Send audio data to I2S DAC
    i2s.write(data)
                

Audio Software Support

On the Onion Omega, you can use a variety of software tools to work with audio. The Omega is compatible with standard Linux audio software packages such as ALSA (Advanced Linux Sound Architecture) and PulseAudio. These tools allow you to control audio settings, record audio, and play audio files directly from the command line or through scripts.

Installing ALSA for Audio Control

To install ALSA and related tools on the Onion Omega, use the following command:

opkg update
opkg install alsa-utils

Playing Audio Files

Once ALSA is installed, you can play audio files directly from the command line. For example:

aplay /path/to/audiofile.wav

This will send the audio to the default sound device on the Omega.

Limitations

While the Onion Omega provides several options for handling audio, it is important to note that it is not primarily designed as an audio-focused device. As such, high-quality, low-latency audio applications may require additional hardware or configuration. For critical applications, it is recommended to use dedicated audio interfaces such as USB sound cards or I2S DACs.

Supported Models

The audio features described here are available on all Onion Omega models. However, external peripherals such as USB audio devices and I2S DACs will determine the audio quality and functionality available on your device. Here’s a summary of the Omega models:

SPI on Onion Omega Series

The Onion Omega series supports the SPI (Serial Peripheral Interface) communication protocol, which is widely used for connecting high-speed peripherals like sensors, displays, SD cards, and EEPROMs. SPI is a full-duplex communication protocol that uses separate lines for data input, data output, clock, and chip select, making it ideal for high-speed data transfer.

SPI Features on Onion Omega

Enabling SPI on Onion Omega

By default, SPI is not enabled on the Omega. To enable SPI, follow these steps:

  1. SSH into your Onion Omega device.
  2. Run the following command to enable the SPI bus:
    echo "spi-bcm2708" > /sys/module/spi_bcm2708/parameters/spi0
  3. Verify the SPI bus is available:
    ls /dev/spidev0.0

Using SPI with Devices

Once SPI is enabled, you can start communicating with SPI devices. You can use tools like spidevor programming languages like Python to interact with SPI peripherals. Common tools for SPI communication include <code>spi-config, spidev-test, and Python libraries like spidev.

Example: Communicating with an SPI Device

Below is an example of how to use the spidevcommand to communicate with an SPI device.


# Send a command to an SPI device at SPI bus 0, chip select 0
spidev -d /dev/spidev0.0 -b 50000 -s 0x01
    

This example communicates with an SPI device using SPI bus 0, chip select 0, and sends the command 0x01at a clock speed of 50,000 Hz.

Using Python for SPI

Python is an excellent language for interacting with SPI devices, and the spidevlibrary is commonly used on the Omega. This library provides a simple interface for setting up the SPI bus and communicating with devices.

Example: Python Code to Communicate with an SPI Device


import spidev

# Initialize the SPI bus
spi = spidev.SpiDev()

# Open SPI bus 0, device 0
spi.open(0, 0)

# Set SPI speed and mode
spi.max_speed_hz = 50000
spi.mode = 0

# Send data to the device
response = spi.xfer2([0x01])

print(f"Response from SPI device: {response}")

# Close SPI bus
spi.close()
    

This Python example demonstrates how to open the SPI bus, set parameters like speed and mode, communicate with an SPI device by sending data, and then close the SPI bus.

Timer and PWM on Onion Omega Series

The Onion Omega series supports timers and pulse-width modulation (PWM), which are essential for time-based tasks and controlling actuators like motors and LEDs. PWM allows for efficient control of the duty cycle of digital outputs, making it ideal for applications like motor control or dimming LEDs.

Using Timers on Omega

Onion Omega provides a set of timers that can be used for generating time delays, scheduling tasks, or creating periodic events. These timers can be configured to trigger interrupts or execute tasks at specified intervals.

Using PWM on Omega

PWM can be used to control the brightness of LEDs, motor speeds, and other devices that require variable voltage control. The Omega series supports PWM on several GPIO pins, and you can control the frequency and duty cycle through software.

Configuring PWM

Use the following commands to set up PWM on a GPIO pin:


echo "pwm" > /sys/class/gpio/export
echo "50" > /sys/class/gpio/pwm0/duty_cycle
echo "1000" > /sys/class/gpio/pwm0/frequency
    

Serial Communication on Onion Omega Series

The Onion Omega series provides serial communication capabilities, allowing it to interface with a variety of serial devices like sensors, controllers, or other microcontrollers. The Omega supports both UART and USB-based serial communication.

Using UART Serial on Omega

To use UART on the Omega, you need to connect the appropriate UART pins (TX/RX) to the serial device. The Omega supports standard 3.3V logic levels for serial communication.

Setting Up Serial Communication

To communicate over serial, follow these steps:

  1. Access the Omega via SSH.
  2. Enable the UART serial port by running:
    stty -F /dev/ttyS0 115200
  3. Use a program like Minicom or screen to communicate over the serial interface.

GPIO on Onion Omega Series

The Onion Omega series offers GPIO pins that allow you to interface with a wide range of devices such as LEDs, buttons, sensors, and relays. These pins are capable of digital input and output and can be configured for various applications.

Using GPIO on Omega

The Omega uses a simple file-based interface to control GPIO pins. You can easily export GPIO pins, configure them as input or output, and read or write their states through the command line or scripts.

Basic GPIO Commands

To control GPIO pins, use the following commands:

  1. Export the GPIO pin:
    echo "X" > /sys/class/gpio/export
  2. Set the pin direction (input or output):
    echo "in" > /sys/class/gpio/gpioX/direction
  3. Write to the pin:
    echo "1" > /sys/class/gpio/gpioX/value

Onion Omega Web Interface

The Onion Omega series features a web-based configuration interface called the Console. This web interface provides an easy-to-use GUI for managing system settings, network configurations, and installing software packages.

Accessing the Web Interface

By default, the Omega runs a lightweight web server that hosts the Console. You can access it using any modern web browser.

  1. Connect your computer to the Omega’s WiFi (default SSID: Omega-XXXX).
  2. Open a web browser and go to http://omega-XXXX.local or http://192.168.3.1.
  3. Log in using the default credentials:
    • Username: root
    • Password: (Set during first setup)

Features of the Web Console

The web interface allows users to perform various system management tasks:

Installing Additional Web Applications

The Omega supports adding custom web applications via the web server. You can install additional packages to expand the functionality:


# Update package list
opkg update

# Install a lightweight web server
opkg install lighttpd

# Start the web server
/etc/init.d/lighttpd start
        

Developing Custom Web Pages

You can host your own web applications on the Omega by placing HTML, JavaScript, and PHP files in the web server directory:


# Default web server directory
cd /www

# Create an index.html file
echo "<h1>Welcome to my Omega Web Interface</h1>" > /www/index.html
        

Enabling Remote Access

To access the web interface from a remote network, configure port forwarding on your router or use Onion Cloud services for secure remote management.

Conclusion

The web-based interface on Onion Omega provides a convenient way to manage the device, configure settings, and even develop custom web applications. With its built-in Console and the ability to host additional web pages, it is a flexible tool for IoT and embedded applications.

Handling Interrupts on Onion Omega

Interrupts allow the Onion Omega to respond to external events asynchronously, making it ideal for handling real-time inputs such as button presses, sensor triggers, and other hardware signals.

Supported Interrupt Sources

Configuring GPIO Interrupts

Onion Omega GPIO pins can be configured to trigger an interrupt when their state changes. The typical edge detection modes include:

Example: Setting Up a GPIO Interrupt

The following example demonstrates how to configure an interrupt on GPIO 0 using the Omega's fast-gpioutility.


# Install fast-gpio utility if not already installed
opkg update
opkg install fast-gpio

# Configure GPIO 0 as an input
fast-gpio set-input 0

# Attach an interrupt to GPIO 0, triggering on falling edge (button press)
fast-gpio set-interrupt 0 falling
        

Handling Interrupts in Python

For more advanced applications, you can use Python to handle GPIO interrupts using the OPi.GPIOlibrary.


import OPi.GPIO as GPIO
import time

# Use GPIO 0 for the interrupt
interrupt_pin = 0

# Callback function to handle the interrupt
def button_pressed(channel):
    print("Interrupt detected on GPIO", channel)

# Set up GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(interrupt_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)

# Add event detection
GPIO.add_event_detect(interrupt_pin, GPIO.FALLING, callback=button_pressed, bouncetime=300)

# Keep the script running
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    GPIO.cleanup()
        

Using Interrupts in C

For high-performance applications, interrupts can be handled in C using the Omega SDK.


#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <poll.h>

#define GPIO_PIN "0"

int main() {
    char path[40];
    snprintf(path, sizeof(path), "/sys/class/gpio/gpio%s/value", GPIO_PIN);
    
    int fd = open(path, O_RDONLY);
    if (fd < 0) {
        perror("Failed to open GPIO");
        return 1;
    }

    struct pollfd pfd;
    pfd.fd = fd;
    pfd.events = POLLPRI;

    while (1) {
        lseek(fd, 0, SEEK_SET);
        char buffer[10];
        read(fd, buffer, sizeof(buffer));

        printf("Waiting for interrupt...\n");
        poll(&pfd, 1, -1);
        printf("Interrupt detected on GPIO %s\n", GPIO_PIN);
    }

    close(fd);
    return 0;
}
        

Interrupt Priority and Performance

For real-time applications, interrupt priority can be managed using kernel configurations or by handling events in low-level C instead of user-space scripts.

Conclusion

GPIO interrupts on Onion Omega provide an efficient way to handle external signals without constantly polling for changes. Using Python, Bash, or C, developers can build responsive and efficient embedded applications.

Operating Systems on Onion Omega Series

The Onion Omega series is primarily designed to run a Linux-based operating system, but it also supports alternative operating systems such as RTOS (Real-Time Operating Systems) and bare-metal programming for specialized applications. Below is a detailed guide on the default OS, how to reinstall it, and other operating system alternatives available for the Onion Omega series.

Default Operating System: Omega OS

The default operating system for the Onion Omega series is Omega OS, which is a custom Linux distribution based on OpenWRT. It is designed specifically for embedded development and IoT applications, providing a lightweight and flexible environment for running a variety of applications.

Omega OS is optimized for the Onion Omega's hardware and includes various tools and packages needed for embedded development. It comes with a minimal web interface for configuration and software management, making it simple to get started with your projects.

Key Features of Omega OS:

Reinstalling Omega OS

If you need to reinstall Omega OS on your Onion Omega device, follow these steps:

1. Download Omega OS Image

First, download the latest version of Omega OS from the Onion IoT website:

2. Prepare the SD Card

To reinstall the OS, you will need a microSD card with at least 4 GB of storage. Use an SD card reader to connect the card to your computer.

Format the SD card using a tool like SD Formatteror the built-in disk utility of your operating system to ensure the card is clean and ready for installation.

3. Flash the Image

Use an image flashing tool to write the Omega OS image to the SD card:

4. Boot the Onion Omega

Insert the SD card into the Onion Omega and power it on. The device will boot into Omega OS automatically. You can now proceed with the initial setup, which includes connecting to a Wi-Fi network, setting up SSH access, and configuring the system.

Alternative Operating Systems

While Omega OS is the default and recommended operating system, you can also run alternative operating systems on the Onion Omega series, including RTOS or bare-metal programming for more specialized use cases.

1. Real-Time Operating Systems (RTOS)

Real-Time Operating Systems are used in applications where precise timing and quick response times are critical, such as robotics or automation systems. Some RTOS options you can consider for the Onion Omega include:

To use an RTOS, you will need to build it from source and load it onto the Omega. For most RTOSes, this involves setting up a cross-compilation environment and flashing the firmware to the device.

2. Bare-Metal Programming

Bare-metal programming involves writing programs directly to the hardware without using an operating system. This is useful for applications that require maximum control over the hardware and minimal overhead.

To get started with bare-metal programming on the Onion Omega, you will need a toolchain that supports the MIPS architecture and tools for flashing the firmware onto the Omega. You can write code in C or assembly, compile it using a cross-compiler, and then load the program onto the device. Some key resources to help you get started include:

Conclusion

The Onion Omega series provides a versatile platform that supports the default Omega OS based on OpenWRT, as well as alternative operating systems like FreeRTOS, ChibiOS, and bare-metal programming. Whether you're working on an IoT project, real-time application, or need to run custom firmware, the Omega can accommodate a variety of use cases. By following the steps outlined above, you can easily install and configure the OS of your choice for your project needs.

Resetting the Default Password on Onion Omega

If you forget the password for your Onion Omega, you can reset it using either a direct serial connection or by booting into failsafe mode.

Method 1: Resetting the Password via SSH or Serial Console

If you still have access to the device via SSH or a serial connection, follow these steps:

  1. Connect to the Omega using SSH or a serial terminal:
    
    # If connected to Omega's WiFi:
    ssh root@omega-XXXX.local
    
    # Or use the IP address:
    ssh root@192.168.3.1
                    
  2. Once logged in, change the password using:
    
    passwd
                    
  3. Enter the new password twice to confirm.

Method 2: Reset Password in Failsafe Mode

If you cannot log in, you can reset the password by booting into failsafe mode:

  1. Power on the Omega and wait for the boot sequence.
  2. When you see Press any key to stop autoboot, press any key to enter the command line.
  3. Mount the root filesystem in writable mode:
    
    mount_root
                    
  4. Reset the password using:
    
    passwd
                    
  5. Reboot the Omega to apply the changes:
    
    reboot
                    

Method 3: Factory Reset to Default Settings

If all else fails, you can restore the Omega to its factory settings:

  1. Press and hold the Reset button for 10 seconds.
  2. The Omega will restart and reset all settings, including the password.
  3. After rebooting, connect to its default WiFi (Omega-XXXX) and log in using:
    • Username: root
    • Password: (empty, set during first login)

Conclusion

By following these methods, you can reset your Onion Omega's password and regain access. If you frequently forget your password, consider setting up SSH key authentication for secure, passwordless login.

Configuring Onion Omega to Boot from Internal Flash with SD Card as Main Storage

This guide will help you configure your Onion Omega device to boot from its internal flash memory while using the SD card as the main storage drive.

Prerequisites

Step 1: Prepare the SD Card

First, format the SD card with an ext4 filesystem. On Linux, you can use the following command to format the card:

sudo mkfs.ext4 /dev/sdX

Mount the SD card and create necessary directories:

sudo mount /dev/sdX1 /mnt
sudo mkdir /mnt/storage

Step 2: Prepare the Omega2

Connect to your Omega2 via SSH or serial console, and mount the internal flash partition:

mount -o rw /dev/mtdblock0 /mnt/omega

Step 3: Copy Data from Internal Flash to SD Card

Now, copy the relevant system directories (e.g., /home, /usr, etc.) from the internal flash to the SD card:

cp -a /mnt/omega/home /mnt/storage/
cp -a /mnt/omega/usr /mnt/storage/

Step 4: Modify Mount Points

Edit the

/etc/fstab
file to mount the SD card as the main storage:

vi /etc/fstab

Replace the relevant partition or directory entries that point to internal storage with the SD card’s directory:

/dev/mmcblk0p1 /home ext4 defaults 0 0
/dev/mmcblk0p1 /usr ext4 defaults 0 0

This will ensure that during boot, the SD card is mounted as the main storage while the internal flash will handle booting.

Step 5: Update Bootloader Configuration

The Omega2 uses U-Boot for boot management. You will need to adjust U-Boot settings to prioritize booting from internal flash while the SD card is used for storage:

Enter the U-Boot environment by pressing any key during boot to interrupt the boot process. Then check the current boot parameters:

printenv

Ensure the bootcmdis set to boot from internal flash. If necessary, change the bootcmdto use internal flash:

setenv bootcmd 'bootm 0x9f000000'
saveenv

Step 6: Reboot and Verify

After making the changes, reboot the system:

reboot

After rebooting, the Omega2 should use its internal flash for booting and mount the SD card as the primary storage.

Step 7: Check the Mounts

After the system has rebooted, verify that the SD card is properly mounted:

df -h

You should see that directories like /home and /usr are now being mounted from the SD card.

Troubleshooting

This configuration will allow your Onion Omega device to boot from the internal flash while using the SD card as the primary storage for data and system files.