A tiny USB device called OpenUI that adds an IR remote receiver, LCD display, RTC, and I2C bus to any headless Linux box — built around an ATtiny2313 acting as a USB HID device.
The problem
For most embedded applications, micro-controllers work well for their low cost and simplicity. But as soon as you need networking on an MMU-less processor, hardware becomes expensive and complex — you need a processor with an MMU and an OS for basic networking and file management.
Technology enthusiasts, hardware hackers, and DIYers find it difficult to use PC-like motherboards that are expensive, bulky, and power-hungry for tiny embedded needs. Over the past few years, we've seen the DIY community shift from micro-controller-based hardware to Linux single-board computers. The mobile market is driving semiconductor companies to build low-cost yet powerful SoCs capable of running Linux at the $5–$10 price range.
For hobbyists this is great news — cheap commercial products running open-source Linux are everywhere. But most of these devices are headless, with no keyboard or display, and lack GPIO, I2C, or UART interfaces needed for sensors, motors, and controls.
To bridge the gap between an off-the-shelf Linux box and the missing I/O interface, I built OpenUI — a USB device using Atmel's ATtiny2313 as a USB HID device. Since most Linux boxes have a USB port, an OpenUI add-on makes sense for anyone planning to use cheap Linux boxes for embedded projects.
Features
- IR remote receiver — acts as a user input device (keyboard)
- 16x2 LCD — acts as a user output device (display)
- I2C bus interface — for connecting peripheral chips
- I2C RTC chip — real-time clock with battery backup
- 5x2 male header — for AVR programming or extending the I2C bus
- 5V power — drawn from the host USB connector
Hardware design is based on Dick Streefland's usbtiny project. The only limitation of usbtiny is a missing I2C bus — OpenUI extends the design with an all-in-one solution for headless Linux boxes.
Building the ATtiny2313 firmware
Step 1 — Install the AVR toolchain:
sudo apt-get install gcc-avr binutils-avr avr-libc avrdude
Step 2 — Prepare a cheap AVR programmer (ponyser) from here.
Step 3 — Download Dick Streefland's usbtiny-1.6 sources and the OpenUI patch.
Step 4 — Build and flash:
mkdir openUI cd openUI cp /path/to/downloaded/usbtiny-1.6.tar.gz . cp /path/to/downloaded/usbtiny-1.6.openui-0.1.diff . tar -xvf usbtiny-1.6.tar.gz cd usbtiny-1.6 patch -p1 < ../usbtiny-1.6.openui-0.1.diff make clean make all cd ir avrdude -p attiny2313 -P /dev/ttyUSB0 -c ponyser -U flash:w:main.hex avrdude -p attiny2313 -P /dev/ttyUSB0 -c ponyser -U hfuse:w:0xdb:m avrdude -p attiny2313 -P /dev/ttyUSB0 -c ponyser -U lfuse:w:0xef:m
Your ATtiny2313 is now ready to run on the OpenUI hardware.
Preparing the headless Linux box
- Build
lircdalong withlirc_dev.koandlirc_igorplugusb.kofor your Linux box. - Load the kernel modules before starting lircd.
- Verify
/dev/lircdevice node exists. - Verify
/var/run/lircfolder exists. - Start lircd:
/usr/sbin/lircd --device=/dev/lirc /etc/lirc/lircd.conf
- Start the OpenUI daemon:
/path/to/openui &
If everything goes well, you'll see a message on the OpenUI's LCD.
Hardware photos
See OpenUI in action in the companion blog post.