How-To: Super simple serial terminal using ATMEGA128

LCD screen

This hack shows how to make a dumb terminal out of a keyboard, LCD screen, and an 8-bit microcontroller. From time to time, a portable dumb terminal can be handy for when you have to rescue a headless server that’s acting up or if you are building a minicomputer out of a WRT, or if you just want to learn how to run a keyboard and LCD screen with a microcontroller. This super simple serial terminal will use RS-232 to control a headless linux system. Additionally, you might want to check into some of the command line interface programs that allow web browsing, AIM and IRC chatting and more directly from the terminal, but nothing beats being able to track your pizzas with this device.
The Linux system in question here will be Linux Mint. It’s a young distro based on Ubuntu that’s gaining a lot of attention lately, though the principles can be used for other Linux distros.

LCD screen

The Hardware:
For this How-To we’ll be using an ATMEGA128 running at 16MHz. Since this device will be communicating through RS-232, we’re going to need a level shifter. RS-232 uses 12 volt signals which will fry our 5V microcontroller. To fix this problem, we’re going to use a MAX233 chip.

This is an example layout.

I’m using the ET-AVR stamp module with the stamp board for this project. This dev board is cheap and has the essentials built in. I’ll be using the on board power supply and the MAX232 RS-232 level converter.
The LCD chosen for this project is a very common 4×20 character LCD. These LCDs are really easy to control with a microcontroller(PDF), and even without one(PDF). The HD44780 chip allows for several bit widths for parallel programming, as well as commands, and even custom characters. This LCD has nice software library, which makes it even easier to use.
A more attractive choice would have been to go with a graphical LCD, which are also supported by our library, however, we only had the character LCD on hand.
A common AT keyboard will be used for character input, again these aren’t hard to find, you probably have an extra one laying around somewhere .
If you don’t want to buy the ET-AVR, you can build the circuit for this hack yourself. (Click for larger pic).

The Software:
We used WinAVR with AVRlib installed. AVRlib is a set of libraries that can run servos, set up A/D conversions, etc. It can do pretty much anything else you need it to do. To install WinAVR, get the newest version here and follow the directions on the installer. We generally don’t follow the directions here for installing AVRlib and place it into the include folder of WinAVR installation found at C:/WinAVR/avr/include/AVRlib. This way your included headers are easier to see and find.

eg. #include <AVRlib/servo.h>

Once this is done, you can open up Programmer’s Notepad and begin coding. We’ve already written the code for this project (with room left over for some adventurous readers to modify).

Read more: How-To: Super simple serial terminal using ATMEGA128

Leave a Comment

Your email address will not be published. Required fields are marked *