Introduction: Atmega16/32 Development Board With LCD

This instructable shows, how to do your own development board for Atmega16 or Atmega32 processors.The Internet is full of home made development boards, but I think that, there is room left for another one. This board have been very useful on my projects and I actually designed and made it to serve one of my project.

What it offers?

- ISP-connector.
- Adjustable reference voltage for AREF with trimmer.
- 8 leds connected PORTA with removable jumpers, so you can use leds also with another ports.
- Spike bars for PORTA, PORTB, PORTC and PORTD.
- Modified spike bar for LCD-screen (4 bit)
- rs232 serial port connector
- Removable rs232 module
- Regulated 5V

What you will need? (parts for main board)

- 1x Atmega16 or Atmega32 processor
- 1x crystal (It is your choice how many Mhz it will be)
- 2x 27 pF capacitors for crystal
- 1x 7805 voltage regulator
- 1x 47uF 16V capacitor
- 3x 100nF capacitor
- 1x DC-jack 2,1mm or 2,5mm (what ever you want use)
- 1x 1K potentiometer
- 8x led (any colour)
- 8x 330 Ohm resistors
- lot of spike bars

Parts for rs232 module

- Max232 IC
- 4x 0,1uF capacitors
- 2x led (green and red)
- 2x 330 Ohm resistors
- Spike bar
- D9-connector

Step 1: The Circuit Boards

There is circuits from the both boards and the pdf-file contains print out files from these boards. You can etch your boards from these pictures. The zip-file contains all Eagle-files from these boards. Feel free to modify these how do you want.

Step 2: Etching or Milling

There is two ways to make these boards, etching or milling. I'm not a chemist, so I used the last option. I made my mill from these great instructables, so If someone have also nc-mill and want to use it for make these boards, just let me know and I will send the G-codes.


Step 3: Soldering

The picture on below will show the name of the component and where it should be on board.

Step 4: Testing

Before we can test our development board, we are going to need AVR-programmer cable. Here is good instructable about the programming cable. We need only 6 wires. SCK, MISO, MOSI, RST, Ground and +5V and that's why my connector have only 6 pins.

IMPORTANT! SCK, MISO, MOSI and RST signals needs 390 Ohm resistors which are usually soldered on board, but I wanted save some space from the board and that's why the resistors are inside the cable. Without these resistors programming won't work.

We also have to do a cable between rs232 module and the main board.

There is also couple "test wires" on the picture and these are really useful when we are going to test our board.

Step 5: Programming and Simple Test Program

Next we are going to need some "test" programs for testing our board.
IMPORTANT! We have to disable JTAG from PORTC, if we don't do that, the lcd-module won't work, so it is necessary.

In Linux operating we can do it with avrdude command:
avrdude -p m16 -c stk200 -U lfuse:w:0xe4:m -U hfuse:w:0xd9:m

This command disables JTAG and set 8Mhz internal oscillator up and use. Our board have external crystal, but people use different size of crystals, so this command is safe for all. If you wanna use your external crystal here is sitefor calculating correct fuses.

IMPORTATNT! Be careful with fuse programming. If you set wrong fuse values, your processor will be inoperative. There is a way recover it with external pulse, but let's hope that you don't have to do that =)

Simple testing program:

#include (avr/io.h)
int main(void)
{
DDRA = 0xff; // set port as output
DDRB = 0xff;
DDRC = 0xff;
DDRD = 0xff;

PORTA = 0x00; // disable all pull-ups
PORTB = 0x00;
PORTC = 0x00;
PORTD = 0x00;
}

It is time to power up the board and send this little test program to processor with the winavr or what ever you wanna use.
Now we can test that our ports works correctly. Put one end from the wire to the one of the leds pinhead and touch with the another end every ports spike step by step. The led should shine every time. If it not shine, then there is something wrong with the soldering. Remember test also that every led works.

Step 6: Testing Serial Port

If everything worked perfectly, it is time to test our rs232 module. There is a little program which testing that our TX and RX works.

Usage in Linux:

Create file called Makefile and copy below text in the file.
The Makefile code assumes that you are using Atmega16 and your programming cable is stk200
Remember set correct permissions to your serial port /dev/ttyS0

CC=/usr/bin/avr-gcc
CFLAGS=-g -Os -Wall -mcall-prologues -mmcu=atmega16 -std=gnu99
OBJ2HEX=/usr/bin/avr-objcopy
AVRDUDE=/usr/bin/avrdude
TARGET=test

program : $(TARGET).hex
$(AVRDUDE) -p m16 -P /dev/parport0 -c stk200 -u -U flash:w:test.hex

%.obj : %.o
$(CC) $(CFLAGS) $< -o $@

%.hex : %.obj
$(OBJ2HEX) -R .eeprom -O ihex $< $@

clean :
rm -f *.hex *.obj *.o

Download atteched file serial.c and put it in the same folder where Makefile is.
Power up your development board and put cable between rs232 module and main board. The leds on module should light now. Put test wire between PA0 pin and some of leds pin.
Use your terminal and go to the folder where is test.c and the Makefile. Connect ISP-programmer to the board. Now it is time to send our code in the processor and it happens with terminal command: make

Download software called GTKterm(Serial Port Terminal).
Fedora: yum install gtkterm
Ubuntu: sudo apt-get install gtkterm

Start GTKterm and format it use 9600Kbs speed, 8 data bits, 1 stop bit, no parity, overflow none.

If everything works, it should write "works!" on the GTKterm screen when you press the "z" button and when you press "x" button the led on board should turn on and when you press "c" its should turn off.

Attachments

Step 7: LCD-module Test

Now it is time to test our LCD-module. I attached a great software for controlling the LCD-screen. I downloaded the code from Scienceprog.com and modified it little. Program the processor with this code and plug your lcd-module on board.

LCD-module pin connections:

1 = VSS(Ground)
2 = VDD(5V)
3 = VO(Ground)
4 = RS
5 = R/W
6 = E

11 = PC4
12 = PC5
13 = PC6
14 = PC7

My lcd-module contains 2 connectors(see the picture), because the text goes up side down if you put the module as it should be. I mirrored and glued new connector to other side. Now it works both ways.

Attachments

Step 8: Some Videos

Dimmer

accelerometers