Embedded AVR webserver CrumbX1-NET from Chip45 with Bluetooth Module HC-06
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.

Changelog

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.

...

2.11.0 2012-04-20
Add support for SD/MMC card slot

...

2.10.0 2012-03-09
Add support for CrumbX1-NET module and other Xmega devices.

...

2.9.0 2012-02-23
Add support for more I/O pins using shift registers

...

2.8.0 2009-12-10
Added support for configurable hardware layout.
Added display of stored settings in config.shtml.
Added support for AVR with more than 20Mhz.
Added support for port E, F, G, H, J, K and L

...

2.7.0 2009-10-03
Added authentication to httpd and socketd.
Added smtp client.
Added port D monitor with eMail notification.

...

2.6.0 2009-09-10
New web form to execute I/O commands via JavaScript (AJAX).

...

2.5.0 2009-08-30
Added serial port (USB) daemon
Added compatibility to Crumb-NET v2.0 and v2.1

...

2.4.0 2009-04-18
Added telnet server for faster i/o commands.

...

2.3.0 2009-04-17
Added the same commands as my USB firmware supports, through the URL http://address/io?command, see io_help.shtml for the list of commands.

...

2.2.0 2009-04-16
Added status display for port B and D.
Added display for the analog inputs.

...

2.1.0 2009-04-14
Added DHCP client
Added configuration page for IP-Address and DHCP
Added function to display the own MAC address
Added UDP protocol and statistics

...

2.0.0 2009-04-11
Major parts of the code has been rewritten to fix bugs, improve performance and add new features.
Add missing documentation.

...

1.3
Last version of Stefan Perzborn / Chip45.
My release 2.0.0 is based on release 1.3 with friendly permission of the author.

Start page    Deutsche Fassung dieser Seite

I/O Interface Modules for 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:

Request: http://192.168.0.123/io?oPC3,1
Response: Ok

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

Requirements

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).

Interfaces

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.

Protocols

Screenshots

I/O-commands through TCP Socket:
Screenshot of I/O-commands through TCP Socket

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

I/O-commands through HTTP:
Screenshot of I/O-commands through HTTP

Web server:
Screenshot of web server

Screenshot of web server

Screenshot of web server

Screenshot of web server

Screenshot of web server

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.

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

Additional Commands