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. It is designed to be a general purpose module allowing its use in other projects.

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 satisfied by means of an external USB to serial adapter which is readily obtained from computer stores.

  • Separate interface for downloading firmware programs. This uses the devices SPI interface with the addition of a reset and power pin.

  • Generic interface to signal conditioning modules.

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

  • Extensible EEPROM storage for acquired data.

An LCD interface was added, but is not used in the Acquisition project.

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 application must provide UART and SPI interfaces, and need to have 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 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 ATMega16/32/64/128 with larger memories and package formats that will generally require a custom printed circuit board. The 28 pin packages have a disadvantage in having limited numbers of ports, all of which are multifunctional.

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 SPI 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 a 26 pin IDC header. Four analogue inputs on Port C are taken to a separate 16 pin IDC header; chosen for compatibility with larger ATMega devices which can have up to 8 inputs. Only half the pins on the connectors 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: 4-pin for RS-232, 6 pin for SPI program download, 3-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 29 January 2010