Photo of microcontroller module Crumb168-USB
Crumb168-USB from Chip45

Photo of a HC-05 Module
HC-05 Bluetooth Module

Project Status

This firmware runs very stable and has all features that I planned to implement. Therefore you should not expect new features in future.


1.4.4 19.02.2015
Update documentation.

1.4.3 28.10.2014
Fix for wrong output on Port Y after oPY command with bit number 15-31. The problem did not occur on all gcc versions.

1.4.2 20.09.2014
Changed fuse settings to enable brown-out detection at 2,7V.

1.4.1 23.04.2013
Fixes compiler warnings introduced by new avr-gcc version.

1.4.0 17.03.2014
Added support for more serial ports.


1.3.0 09.03.2012
Added support for Xmega microcontrollers

1.2.0 23.02.2012
Added support for up to 64 additional I/O pins through external shift registers of type 74HC165 and 74HC595.


1.1.0 10.12.2009
Major code cleanup. The files ADC.h, ADC.c, io-commands.h and io-commands.c are now the same as in the net_io firmware.
The status LED flashes now two times during power-on.
Added support for using backspace character in commands.


1.0.0 25.03.2009
first release

Start page    Deutsche Fassung dieser Seite

I/O Interface modules, serial with USB or Bluetooth

I/O Interface modules allow you to control and monitor electrical equipment.

The informations on this website let you build an I/O interface module which connects to the host computer via serial port, USB or Bluetooth. That makes 18 to 84 controllable Pins, depending on the microcontroller type. And you can have even more with the help of some cheap shift registers.

The Bluetooth option is best suited for hobby electronics engineers who don't want to risk damaging their personal computer. Also they are cheap - a Microcontroller module + a Bluetooth Module cost less than 10 Euros (or US-Dollars).

Access to the I/O ports is provided via simple text commands, eliminating the need of special drivers and libraries. It works with almost any programming language and any operating system, like PC, smartphones, tablets, Raspberry Pi, ...

The C Compiler for the microcontroller is free availabe for Windows (e.g. GNU Toolchain), Linux (avr-gcc) and Mac OS. The example app "ioModule" for PC and smartphones can be compiled with Qt Creator.


How it works

Open a connection to the I/O module. Then you can send commands in text form and receive answers on this connection. For testing, I recommend the Hammer Terminal program or Cutecom.

For Example, the following command sets the pin PC3 to high:

Send: oPC3,1
Response: Ok

To query the port D in hexadecimal format:

Send: iPD
Response: PD=60

The whole command set is described at the page bottom. You can execute more than 100 commands per second.


As an alternative to raw microcontroller chips, I recommend Arduino Nano and Uno, as well as AVR Modules from Chip45, which are available with pre-installed bootloader, so you don't need an extra programming adapter.

Notice: Mobile devices from Apple do not support the Bluetooth SPP protocol. Use WLAN or Ethernet as an alternative.


Test using a terminal program:
Screenshot of I/O-commands through serial port (USB)

The example app "ioModule" controls two LED's:
Bildschirmfoto von der Demo App in C++ Bildschirmfoto von der Demo App in C++

Command Set

Digital I/O

You control the module with four basic commands, which are d, p, o and i.

These commands can be used on a single I/O line (PB7), a port (PB) or all ports together by a single command:

PB7 and PB are examples, all ports are accessible in the same way. When accessing all ports together, the size of the hexadecimal number depends on the size of the AVR, referring to the ports: DDCCBBAA or HHGGFFEEDDCCBBAA.

The commands for single pins support characters as an alternative to 0 and 1:

The commands d, p and o respond always with "Ok". The i command responds this way:

Analog Inputs

The available references depend on the capabilities of the Mikrocontroller:

Example for the r command:

The a command expects the channel number of the analog input, for example:

Input Extension

A shift register may be used to enhance the number of inputs. I call these additional inputs "Port X". They can be read using the i command:

The length of the hexadecimal number depends on the size of the shift register (8-32 bits).

Output Extension

The number of outputs can be enhanced with a shift register. I call these additional outputs "Port Y". The o command writes to that port:

Again, the length of the hexadecimal number depends on the size of the shift register (8-32 bits). The current status of port Y can be read out by the command i.

The Commands d and p are not available on the port extensions!