luminous Home   Feature   Space   Science   Atheism   Paranonsense   Technology   Offsite   About   Search
Home : Technology : A Cheap AVR Evaluation Board


A Cheap AVR Evaluation Board


Board Features

There are several development boards on the market for the AVR series of microcontrollers, from around £20 ($30) upward. I wanted to put my own together, though. First, I was interested in only one package size at the time (the 20 pin DIP devices such as the AT90S2313), and second I had most of the parts lying around anyway so why not?

What I wanted was a series of features, including complete port accessibility, LED outputs on at least one port, a piezo transducer for some basic sound capability, and simple inputs to trigger the interrupts. The interrupt requirement meant that the inputs had to be on Port D, and the LED outputs on Port B. Pin D6 was conveniently placed to drive the piezo output. As the design evolved, I also added a separate connector for the serial lines and an in-system programming connector.

Board Construction

Schematic Board layout Board photo
Schematic Layout Photograph
Click images to enlarge

Download all of the Eagle schematics as a zip file (75KB).

The whole board is assembled on stripboard, which has the advantage that you don't need to lay out or etch PCBs.

IC1, the AT90S2313, which is the whole raison d'etre for the board, is pretty much a stand-alone device. With just an external 4MHz ceramic resonator (Q1) and a couple of 22pF load capacitors (C1, C2), the processor will run quite happily. A 47uF decoupling capacitor C3 helps the stability of the power supply. Note that Q1 is actually mounted diagonally to make sure that the leads connecting it to IC1 are as short as possible (this is the blue component immediately to the left of the IC in the photo).

There is a power-on reset circuit consisting of a 100k resistor and a 100nF capacitor (R10 and C9), which takes a little time to charge up after switch-on, and thus holds the RESET' line low until the power stabilises. It also acts to debounce the reset switch S5, a cheap PCB-mounted push switch.

Ports B and D are both taken to 10x1 pin polarised connectors, each of which has pin 1 connected to ground, pins 2..9 to pins 0..7 of the port, and pin 10 to +5v.

Port B is connected to a series of LEDS and 1k current limiting resistors, D1..8 and R1..8. These will light when the port pin is driven with a 0 logic level, which may seem odd but the AVR ports can sink more current than they can source. All the LEDs are enabled via a jumper on the board, which can be removed to allow free access to Port B. Pins B5..B7 are used for in-system programming and are routed to a separate ISP connector, along with ground and the reset pin. This connector is not a standard Atmel-mandated 6-pin ISP connection, but what I happened to have at the time - a 6 pin mini-din socket like you might find as a mouse or keyboard port on your PC.

On port D, as well as the 10-way connection to all pins, pins D0 and D1 are also the UART outputs and are routed off to the RS232 connector along with ground and +5v. Pins D2..D5 are connected to four push switches, which pull the lines low when pressed. The AVR has internal pull-up resistors which can be enabled, eliminating the need for external pullup networks on switch inputs. Neat. Pin D6 drives a high impedance piezo transducer to give some simple sound output. There is no pin D7 - the package ran out of pins!

Finally, 5v of power is supplied to the board through the PWR connector, and is indicated by LED D9, which is fed through a 300R resistor R9. In my implementation, the power connector is a 2.1mm power plug rather than a 2-pin connector, but that's just engineering...

Programming

Schematic Photo
Schematic Photograph
Click images to enlarge

The AT90S2313, like the majority of the Atmel microcontrollers, is in-system programmable. If we make 5 lines available from the main board (GND, SCK, MISO, MOSI and RESET), then we can reprogram the flash memory in the device without removing it from its socket. Of course, we need a suitable programmer.

PonyProg, by Claudio Lanconelli of www.lancos.com has produced a general purpose programmer which will program virtually anything based on flash memory. The hardware he suggests for interfacing to the parallel port of an IBM PC is robust, but requires a chip I didn't have at the time. So I constructed a much simpler programming cable using four resistors in the signal lines, and a couple of links on the back of the 25 pin connector to persuade it that a printer is attached. R1 to R4 are all 220R resistors.

The whole thing fits neatly inside a cheap hood for the 25 pin connector (see photo).

Laying Out Stripboard with Eagle

Options Dialog 1 Options Dialog 2 Options Dialog 3
General Busses Route
Click images to enlarge

Although Eagle's autorouting module is not designed specifically to do stripboard layouts, it can be persuaded to make a good stab at it by setting up the right kinds of rules.

First, set the grid spacing to 0.1 inch. Then, around each component on the top side of the board, add a "top restrict" area. This prevents the top traces, which ordinarily would be pcb tracks but are wire links for stripboard, from interfering with components.

Then we need to set the routing grid to 0.1 inches, set the preferred direction for the bottom layer to be horizontal, and for the top layer to be vertical, and set an enormous penalty for routing steps away from the preferred direction. We can also weight the board sides to prefer bottom tracks over top tracks, and to minimise the number of vias. See the screen snapshots above for a complete set of rules and weightings. All the optimisation steps are turned off.

Placement of track cuts should be obvious from the end positions of the bottom side tracks. I generally represent these with small "bottom restrict" areas.

See Also

First, for more information on AVR Microcontrollers, see Atmel's Website which contains the latest data sheets and product information. The AVR Studio development software is also available for free from this site.

You can find the PonyProg programming software at Lancos.com which is single-handedly maintained by Claudio Lanconelli. I am very impressed with this piece of software, as it seems to be able to program virtually any EEPROM or Flash-based device in existence.

The popular Eagle layout software is available from CadSoft. It is free for educational and hobby use (limited by board size and number of layers).

Finally, there is a good online support and discussion forum at AVRFreaks.net which is a friendly and generally on-topic place, and is frequented by several of the guys from Atmel. You can also get the Atmel datasheets and both AVR Studio and AVR-GCC development systems from there.