LCD displays are available in either 8-bit parallel, 4-bit parallel, or very expensive serial. I needed a serial LCD for a project. If I'm going to have the expense of serial, I should also have some functionality over and above that of the cheaper parallel interface displays. Unfortunately, those expensive serial displays do not offer any more functionality than their parallel counterparts. It seems like rolling your own serial LCD is a reasonable alternative that allows you to add some value. The value I had in mind was the addition of a keyboard to make the display into a complete tiny terminal.
It's hard to talk about a design without having a use in mind. I have a need for a terminal for debugging. I can't always get to the PC when I need to run screen, or my new favorite, "cutecom" (they needed to give a little more thought to the name). I need a serial terminal I can hook to the board under test. The terminal doesn't need to be too fancy, it just needs to be able to send keyboard data and display output. To this end, an ATmega8 driving a 16 x 2 LCD and a PS/2 keyboard work nicely. The LCD displays ASCII characters, and the keyboard scan codes are decoded into ASCII characters and sent back on the serial line.
The real beauty is that it requires no external hardware to interface a PS/2 style keyboard to an ATmega8. The LCD requires just a little bit - a transistor to power the LED backlight for dimming, and a pot to set the contrast of the LCD itself. A separate power supply powers the terminal unit, which in turn provides power to the keyboard. The regulator gets hot providing around 60 mA for the LCD backlight, plus the power required by the keyboard.
The parts list for the terminal is short:
Assembly is like anything else. The wires for the LCD barely fit in the case. Like an overstuffed suitcase, if I sit on it to put the screws in, everything fits. Other than that, it turned out great!
Hint: If you get a row of solid rectangles (each a character with all pixels on), the display has done it's own power up initialization, but your configuration routine has not worked properly. You should have a couple of lines of text when it comes up. You may have to adjust the contrast to see the characters.
I picked up a small, cheap ($17.09 because it was returned) mini USB keyboard, USB to PS/2 adapter($1.99) and a keyboard extension cable($3.99) at Frys. The extension cable was made into a pigtail. The adapter and keyboard plug into the pigtail cable, and the whole thing makes a nice compact serial terminal.
I used an FTDI USB to TTL cable to connect the ATmega8 USART to the PC, and CuteCom to emulate an AVR. Anything sent via CuteCom wound up on the LCD display, and anything typed on the terminal's keyboard wound up on the CuteCom screen. There are a couple of options that are compile-time that I need to get hooked up to a key combination - the LCD backlight brightness and the toggle for display of control characters, chiefly the line feed. The code takes about 1900 bytes of the ATmega8's 8192 Bytes of flash memory.
I used a MOSFET for switching the cathodes to control the brightness. The one I chose was the IRF510, because I have a drawer full of them. It may not be the best choice. Since it takes 4 V to turn it on, and the power supply for the board is 5 V, the MOSFET may be operating in the linear region, using relatively high power. On subsequent versions of this project I have used the IRF7470 MOSFET. It has a Vgs(th) of 2 V, so it is definitely on when you turn it on.