Microcontroller Module

The microcontroller module was developed to provide the basic functions of PC interface, storage of acquired data and interface to the signal processing modules. It consists of a serial RS-232 interface, a programming interface and the interfaces for digital and analogue signal conditioning modules.

Specification

  • RS-232 serial interface standard for communication with a PC. A USB interface is preferred but this interface is somewhat expensive and relies on special drivers in the PC. It is currently being investigated.

  • Separate interface for downloading firmware programs. This depends on the device chosen.

  • Generic interface to signal conditioning modules.

  • A/D converter compatible with the analogue signal conditioning modules.

Component Selection

The AVR series of microcontrollers were used mainly due to existing familiarity and availability of tools. However they do turn out to be quite inexpensive and also very capable both in terms of clock speed and feature richness. There are quite a large number of different types aimed at different purposes.

The AVR microcontrollers to be used for this aplication must provide UART and SCI interfaces, and may need A/D conversion and TWI interfaces. This limits the selection to the ATMega series. The device selected was initially the ATMega8. This has a slimline 28 pin package that is ideally suited for use with prototyping boards. However that has now been superseded by the ATMega48/88/168 series (having 4K, 8K and 16K flash memory respectively). These are pin compatible with the ATMega8 but not entirely software and function compatible. Beyond this series are the ATMega32/64/128 with larger memories and package formats that will generally require a custom printed circuit board.

The RS-232 interface is provided by a MAX232 chip that provides charge pumps for generating the required RS-232 signal levels from a 5V power source, and two sets of receiver and driver circuits. Thus it reduces chip count significantly over other solutions.

Design

The AVR microcontrollers lack substantial memory storage for application to remote data acquisition. Therefore a large capacity external EEPROM was used. This interfaces to a processor with the Philips I2C bus, called the two-wire interface (TWI) which is intended to be I2C bus compatible.

The module includes a 4-bit DIP switch or jumper block to set a module ID. To free up the maximum number of port pins on the smaller AVR microcontrollers, this is passed to the AVR through a tristate buffer that is activated only during a calibration phase controlled by one of the AVR outputs. The other half of the tristate buffer is used to isolate the programming interface from the AVR SCI pins except for the period during an external reset that is applied when downloading the program.

A selection of AVR port pins is taken to an IDC header, which can be either 26 pin or 34 pin. Only half the pins on the connector are used for signals. Alternating wires on the connecting cable are connected to signal and power grounds to protect analogue signals and to allow good grounding practice by bringing data capture module grounds separately back to the microcontroller module.

The remaining connectors are headers selected for their general availability and robustness. Different numbers of pins are used to prevent accidental mis-insertion of cables: 3-pin for RS-232, 6 pin for program download, 4-pin for TWI.

Circuit

The final circuit used is given below. Eventually this will be produced on a PCB with appropriate care given to protection of the analogue signals.


A gEDA atmega48-module.sch schematic file is also provided, along with the following symbols. These may need to be modified to provide the attributes necessary for producing a netlist and gerber file and will be updated as time permits.

Serial EEPROM 24LC512-1.sym, voltage reference LM336Z.sym, and diode diode-4.sym. All other symbols are available from the gEDA symbol collection.


First created 13 May 2007

Last Modified 22 July 2007