Embedded Webserver CrumbX1-NET from Chip45 with Bluetooth Module HC-06

Project Status

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


2.12.7 2015-08-05
Fix timer sporadically not working properly (atomic access to timer counter).

2.12.6 2015-05-21
Add support for ATmega128.
Improved compiler error message in case of unsupported ATmega type.
Applied a patch to protothreads to get rid of the "unused PT_YIELD_FLAG" warnings.

2.12.5 2015-05-12
Removed gcc command line option that is not supported by WinAVR.
Fixed compilation error when the AUTH module is disabled.

2.12.4 2015-04-13
Removed wrong and useless pull-up settings for serial ports.

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

2.12.1 2014-04-23
Fixed compiler warnings that have been introduced by new avr-gcc version.

2.12.0 2014-03-16
Reduced size of hex file.
Added support for more serial ports.
Serial echo is now disabled by default (in serialconsole.h).

2.11.12 2014-03-02
Made serial port much more stable on Xmega devices with R/C oscillator.
Fixed buffer overflow when receiving an oversized packet.
Fixed a missing byte in DHCP discover request.
Added DHCP status info to the "ip" command.

Start page   Deutsche Fassung dieser Seite

I/O Interface Modules for USB and Ethernet

I/O Interface modules allow you to control and monitor electrical equipment. Because PC don't have classical parallel ports anymore, I show you how to build a replacement with Ethernet, USB and Bluetooth. You will get 19 to 71 controllable Pins, depending on the microcontroller type. And you can get even more with the help of some cheap shift registers.

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 firmware contains an optional component which monitors 8 pins and sends configurable messages via Email when a signal changes from low to high level.

In addition, the firmware contains an embedded webserver (based on Adam Dunkels µIP) which can be used to configure the device. The webserver can provide access to files stored on an SD card. Even without an SD card, the software developer may add custom features as well as small functional websites.

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.

Download source code, compiled binaries (hex files).

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. To test serial, USB or Bluetooth connections, I recommend the Hammer Terminal program or Cutecom. To test the TCP/IP socket, I recommend Netcat (nc) or telnet.

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

In case of HTTP, the commands are appended to the URL:

Response: Ok

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


You can connect the ethernet controller to any pins of the microcontroller because the pin assignment is configurable.

You can order the ready-to-use CrumbX1-Net module with pre-installed firmware from Chip45. Or you can build the hardware yourself using the schematics of the download package.

To upload the firmware into the microcontroller, you need a programming tool (ISP for ATmega, PDI for Xmega).


An optional memory card can be connected directly to the SPI port of the AVR with 3,3V, which is useful to collect and store large amount of data.

The chinese Bluetooth modules HC-05 and HC-06 fit perfectly onto the CrumbX1-NET module. I can also recommend the BTM-222, which supports longer distances with an external antenna.

For USB use an USB-UART chip, for example an FT232R, CP2102, CH-340 or CH-341.

The number of I/O ports can be enhanced using shift registers of type 74HC165 and 74HC595. This way you get lots of additional inputs and outputs. There is also support for a serial 12bit ADC of type MCP3204 or MCP3208.



I/O-commands through TCP Socket:

I/O-commands through serial port (USB):

I/O-commands through HTTP:

Web server:

The example app "ioModule" controls two LEDs:

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.

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

Additional Commands