Sunday, January 03, 2016

RBox: Lightweight Linux Distro for IoT Devices

RBox (RemoteBox) is a lightweight Linux distribution built with Buildroot, designed for IoT devices that need reliable connectivity over the public internet. It runs on low-cost hardware and uses XMPP chat messaging for remote control — no cloud services, port forwarding, or dynamic DNS required.

The Raspberry Pi image provided here works only on Raspberry Pi B+.

Key features

  • Runs on Raspberry Pi B+, BeagleBone Black, and BeagleBone Green
  • Small update image — under 20 MB for Raspberry Pi, under 10 MB for BeagleBone
  • Over-the-air updates with dual-boot failsafe against power outage or network failure
  • Always-on XMPP chat-bot keeps the device accessible via any Jabber server
  • Remote GPIO read/write via chat messages
  • Health monitoring commands
  • GSM SIM management with Huawei E173 USB modem — read/send/delete SMS, dial USSD codes, voice dialling
  • Open source — hosted on GitHub

Applications

Deploying RBox on Raspberry Pi B+

  1. Create two XMPP accounts on a public Jabber server (tested with jabber.de, xabber.de, ubuntu-jabber.de) and authorize them to chat with each other
  2. Download the RBox SD card image
  3. Decompress with 7-Zip or your preferred tool
  4. Write the image to the SD card using Win32DiskImager
  5. Remove and re-insert the SD card — a boot drive appears
  6. Create xmpp-login.txt on the boot drive using this template — replace the sample credentials with your device's XMPP username and password
  7. Insert the SD card into the Raspberry Pi, connect an Ethernet cable, and power on
  8. On your phone, open Xabber and log in with the master XMPP account
  9. The Raspberry Pi should appear online — send Help to see the list of available commands
  10. Send Sysupdate;reboot to update to the latest RBox image — see the full command reference

RBox is in active development. Contributions and feedback are welcome — leave a comment or open an issue on GitHub.

SOURCE CODE

github.com/hackboxguy/brbox — RBox sources and build instructions

XMPP Account Setup Guide for IoT Remote Control

A step-by-step guide to creating XMPP master and slave accounts on a public server (tested with xabber.de, jabber.de, ubuntu-jabber.de) using the Psi desktop client. These accounts enable remote control of embedded Linux devices over the public internet via XMPP chat protocol.

Shortcut: If you have two Google accounts, you can skip this guide entirely — just authorize both accounts as contacts and use one as the master (your phone/PC) and the other as the slave (chat-bot). In the second account's Google security settings, set "Allow less secure apps: ON".

Why XMPP for IoT?

XMPP is widely used as a chat protocol between humans. The technique described here repurposes it for remotely accessing and controlling embedded devices over the public internet. XMPP was chosen for its wide adoption, built-in security, and ease of connectivity.

Typical client-server communication over the public internet requires exposing a server port through a firewall and registering a dynamic DNS name — a common challenge for home routers or 3G-connected devices with non-static IPs. Using existing public XMPP server infrastructure sidesteps these connectivity challenges entirely.

In this setup, the master account is for the person controlling the device (from a smartphone app like Xabber or a PC client like Psi), while the slave account runs on the remotely deployed Linux machine (Raspberry Pi, BeagleBone, etc.) as a chat bot. As long as both devices have internet access, they can communicate regardless of location.

Creating the master account

Step 1: Install Psi XMPP client on your Windows machine.

Step 2: Start Psi, go to General → Account Setup.

Psi Account Setup dialog

Step 3: Click on "Add".

Account list with Add button

Step 4: Follow the numbered fields as shown below.

New account dialog — follow fields 1 and 2

Step 5: Enter the public server as xabber.de and click "Next".

Server selection — entering xabber.de

Steps 6–10: After pressing "Next", wait for the registration form to load. Fill in the fields:

  • Field 1: Choose a username (e.g. "master")
  • Field 2: Enter your password
  • Field 3: Open the captcha link in a browser
  • Field 4: Enter the captcha number shown by the browser

Click "Next".

Registration form with username, password, and captcha fields

Step 11: If registration succeeds, click "Ok" on the confirmation dialog.

Registration success dialog

Step 12: Click "Save" on the account properties dialog.

Account properties — click Save

Step 13: Click "OK" on the next confirmation dialog.

Confirmation dialog — click OK

Step 14: Back in the Psi main window, right-click on the "Master" entry → Status → Online.

Setting master account status to Online

Step 15: Enter your full name and nickname, then click "Close".

Profile setup — enter name and nickname

Step 16: Master account creation is done. Log out by right-clicking on the "Master" entry → Status → Offline.

Setting master account status to Offline

Creating the slave account

Repeat steps 1–15 for the slave account. Pay attention to these differences:

  • Step 4: Use the string "Slave" instead of "Master"
  • Steps 7–8: Choose a different username and password
  • Step 15: Use "Slave" as the full name and nickname

Pairing master and slave accounts

Once both accounts are created, go to General → Account Setup. Enable both the Master and Slave account checkboxes, then click "Close".

Account Setup with both accounts enabled

Right-click on "Slave" → Status → Online (wait for the grey star to turn yellow). Repeat for "Master". When both stars are yellow, both accounts are online.

Both master and slave accounts online — yellow stars

The master and slave accounts now need to authorize each other — this is XMPP's standard mechanism to block unsolicited messages. Send a few test messages between the accounts to confirm bi-directional communication works.

Next step: Proceed to Rbox — A Lightweight Linux system for IoT to set up the slave device.

Monday, January 09, 2012

OpenUI: IR Remote, LCD & I2C for Headless Linux

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.

OpenUI schematic

OpenUI schematic — ATtiny2313 with USB, IR receiver, LCD, RTC, and I2C expansion.

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

  1. Build lircd along with lirc_dev.ko and lirc_igorplugusb.ko for your Linux box.
  2. Load the kernel modules before starting lircd.
  3. Verify /dev/lirc device node exists.
  4. Verify /var/run/lirc folder exists.
  5. Start lircd:
/usr/sbin/lircd --device=/dev/lirc /etc/lirc/lircd.conf
  1. Start the OpenUI daemon:
/path/to/openui &

If everything goes well, you'll see a message on the OpenUI's LCD.

Hardware photos

OpenUI board top view

OpenUI board — top view showing the ATtiny2313, IR receiver, and I2C header.

OpenUI board with LCD

OpenUI with 16x2 LCD display mounted.

OpenUI board close-up

Close-up of the OpenUI board.

OpenUI connected to router

OpenUI plugged into a router's USB port — the complete setup.

See OpenUI in action in the companion blog post.