Onion Omega2 Dash

by Onion

An open-source touchscreen & Wi-Fi-connected Linux dev board

View all updates Jan 27, 2020

Writing Text

by Lazar D

Hey everyone,

With the campaign coming to a close at the end of the week, we’ve realized we have yet to cover a fundamental use-case: writing text to the display on the Omega2 Dash!

But before we dive in, there’s still time for more backers to join us over the next couple of days before the campaign closes! If you know anybody who would get a kick out of the Omega2 Dash, send them a link to our campaign page.

Writing Text

In the Omega2 Dash Linux operating system, the Linux framebuffer is connected to the /dev/tty1 virtual terminal device. So anything written to this virtual terminal, will actually show up on the screen!

It’s as easy as piping your program output to /dev/tty1, and seeing it displayed on the screen.

Try it out:

echo "Hello world, it's the Omega2 Dash" > /dev/tty1

To clear the screen:

clear > /dev/tty1

Adding Color

But that’s not all, using ANSI escape characters we can add color!

For example:

echo -e "\033[94mWow\033[0m! So \033[92mmuch\033[0m \033[91mroom\033[0m for \033[4mactivities\033[0m" > /dev/tty1

Looking at the command it might seem confusing but it’s straightforward when it’s broken down.

Take \033[94mWow\033[0m:

  • \033 acts as an escape character
  • [94m sets the color to bright blue
  • Wow is the text
  • \033 escape character and [0m to reset the text formatting to default

Learn more about ANSI escape characters here and here, and see this list of color codes.

A Dash of Higher Level Programming Languages

Taking this one step further, we can incorporate ANSI escape characters in our scripts and programs.

For example, check out this Python program that loops through the available colors:

import sys
for i in range(0, 14):
    for j in range(0, 16):
        code = str(i * 16 + j)
        sys.stdout.write(u"\033[38;5;" + code + "m " + code.ljust(4))
    print(u"\033[0m")

Run it on your Omega2 Dash and pipe the output to /dev/tty1:

python3 color.py > /dev/tty1

More Python

We’ve also put together a little Python script that makes it easy to color your text with functions like term.red(), term.blue(), and so on.

python3 colorMessage.py > /dev/tty1

Grab the source code from Github.

About the Author

Lazar D

greenbreakfast  ·   Toronto, Canada


$34,720 raised

of $10,000 goal

347% Funded! Order Below

Product Choices

$75

Omega2 Dash

An Omega2 Dash IoT computer. Perfect for making internet-connected control panels and user interfaces.


$105

Omega2 Dash Essentials Collection

An Omega2 Dash and the Ethernet and ADC Expansions. Build projects that use wireless or wired networking and can communicate with all sorts of devices, digital or analog.


$145

Omega2 Dash Ultimate Collection

An Omega2 Dash and a whole set of Expansions: NFC/RFID Expansion, ADC Expansion, Servo (PWM) Expansion, Ethernet Expansion, Proto Expansion.


$15

Ethernet Expansion

From the Onion Omega2 Pro project.

An Ethernet Expansion board for your Omega2 Dash

The Ethernet Expansion adds an Ethernet port to your Omega with a maximum connection speed of 100Mbps. While the Omega is all about wireless connectivity, a reliable wired network connection can be a great addition to a project, and the Ethernet Expansion is a great tool for quickly reflashing your Omega’s firmware.


$20

NFC/RFID Expansion

From the Onion Omega2 Pro project.

An NFC/RFID Expansion board for your Omega2 Dash

Bring contact-less RFID and NFC communication to your Omega2. It supports reading and writing with several NFC and RFID protocols at 13.56 MHz. Comes bundled with two programmable Mifare Ultralight tags.


$15

ADC Expansion

From the Onion Omega2 Pro project.

An ADC Expansion board for your Omega2 Dash

Omega2 can now read all types of analog voltages and sensors with the help of this ADC Expansion. Read and interpret up to 4 analog voltage or sensor inputs, each with 16 bits of precision.


$5

Proto Expansion

From the Onion Omega2 Pro project.

A Proto Expansion board for your Omega2 Dash

The Proto Expansion for the Onion Omega allows you to create your very own expansion that interfaces with your Omega. It provides a small soldering area and 30-pin header that plugs into the Expansion Dock. With it you will have full control over what kind of project you design for your Omega.


$15

Servo Expansion

From the Onion Omega2 Pro project.

A Servo Expansion board for your Omega2 Dash

The Servo Expansion adds 16 PWM (Pulse Width Modulation) outputs to your Omega. Connect standard servos directly to the Expansion since each channel has its own 3-pin connectors, making it that much easier to get started with your project! This Expansion is great in any application that requires servos, like a robotics project or anything with moving parts. Given that PWM is so useful, you can also use this Expansion to precisely control LEDs or drive a DC motor using an H-bridge. The Servo Expansion is often also called the PWM Expansion.

Credits

Onion

Onion is a team of technology enthusiasts, creators, and strivers, looking to make amazing products and even better user experiences. Onion has been in business since 2014, graduating from the TechStars Startup Accelerator in Boston that year. In 2015, we introduced the world to the Onion Omega IoT computer.


Lazar Demin

Zheng Han

See Also

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects: