Download PC Board files, schematics, and source code
This project is a remake of the ATmega8 serial terminal project using an ATtiny2313. I wanted to add a few things for reliability, like a real PC board, connectors rather than pigtails, and in addition to the keyboard adjustable brightnesss, add keyboard adjustable contrast. The addition of the contrast required omission of 4800 Baud from the table of available Baud rates, and even then, the code uses 2046 bytes.
The size of the packaging and the number of pins required limited me to using an ATtiny2313 or ATtiny4313 instead of the ATmega8. Most aspects of the electrical and software design remain identical. Both the ATtiny2313 and the ATtiny4313 were tested in the application, but I had more ATtiny4313's so I left one in it.
The PC board, schematic, and source code are in the zip file above. Also there are .eps files of the top and bottom copper as well as the silk screen.
The ATmega8 terminal had two boards with a 14 conductor cable assembly between them. The space occupied by the cable was greater than the space occupied by the two boards. On the ATtiny2313 version, the two boards mate directly, with no cable between. The display has two identical 18 position single row header pads, one on each long side of the PC board. Although only one is used to communicate with the LCD display, both have connectors in them for structural support. Additionally, spacers hold the boards at the correct distance for the connectors to mate reliably. The connectors are the same type used on the Arduino, but are 18 position. Some of the alternatives require so much insertion force that I was afraid I might break the glass putting the boards together.
An IRF7470 MOSFET is used to PWM the display backlight, which can be set from 1 to 15. The brightness of the display is set using the ALT-F3 and ALT-F4 keys. Timer0 in fast PWM mode supplies the 7.2kHz drive signal for the MOSFET. This MOSFET is a "logic level" MOSFET, in that Vgs(th) is around 2 volts. An emitter follower is used to set the contrast. I have found the spec for current at the Vo input for only one LCD display, and that was 0.8 mA. The range of the contrast control is extreme compared to the Vo voltage required. The real Vo voltage range is around VDD-4.0 to VDD-5.0 (+1V to 0V). If you're interested, there is an inverter in the display controller that turns that into a negative voltage for the LCD "glass" bias, somewhere around (Vdd-7)V. I'm not sure how or why it is referenced to VDD.
There are a few things I have started doing on all of my projects to make development easier:
So, features:
The parts list for the terminal is a little longer than the ATmega8 terminal. "Special" parts:
Junk box parts:
The ATtiny4313 is a beefed up ATtiny2313, in that it will run ATtiny2313 code, but has more features. Code that takes advantage of these features will not work on an ATtiny2313. This code is completely ATtiny2313 compatible.
Of course you can do this project with any size and shape (and cost) LCD character display. You can pick up transflective displays (the ones that have no backlight, but have a mirror-like yellow or green background) for less than $10.00 at Mouser. I picked this particular LCD display because it is negative, and has the ability to do white, which I like, and red, which is needed for the astronomy use it was originally purchased for.
The keyboard translation table can be changed to map any key combination to any 8-bit value. The values I chose, other than the standard ASCII key values, are completely arbitrary. Any code written to accept those keys would simply need to include the keycodes.h file so all the pieces of code would be talking about the same keys.
Because I made two decisions up front to save space, it is a bit difficult to get some resistors to fit. I decided not to make the PC board larger than the display and the connectors. I also decided I was not going to use surface mount resistors. I regret not using surface mount resistors, and advise you to use the smallest 1/8W metal film resistors wherever you can. The resistor pads are 0.35 inches apart, and most 1/4W resistors are a minimum of 0.35 inches long.
The boards came from Futurlec. The quality is very high. It took five days to manufacture the boards, and two weeks to receive them. I needed one, ordered two, they sent four. It would have been fairly simple to do this with a perfboard, since there are so few parts. Although the pin spacing on the display is 0.1 inches, the spacing between the rows on the display board is 1.22 inches, so it isn't a perfect fit with 1.20 on the perfboard, but it won't do any damage cramming it in. But then the manufactured PC board is so you don't have to cram things in. Either way works.
I picked up a little a4tech KL-5usb keyboard, which is a mini USB keyboard and a USB to PS/2 adapter from Frys. The terminal was tested using a program on the Dev40A board with an ATmega32, just sending a couple of strings to the terminal and echoing back whatever is typed. Very handy. I'll get a lot of use out of this thing.
The SCK signal is the same line as the MOSFET gate, which is isolated by a resistor. When I program the MCU the LCD backlight flashes on and off rapidly. Harmless, and kind of funny looking.