How do you know when you’ve had a really good idea?
It’s when you go online and realize that a bunch of other people have all done the same thing.
I use often use LCD panels in my projects – they’re cool to look at, and can really help with tracking down bugs. Trouble is, they often take waaaay too many pins to control. Even using the 4-bit transfer mode you still use 6 pins.
The “Rolls-Royce” solution is to get an LCD to serial adapter, then hookup a software serial library and control the LCD from just one pin. You can get these boards here.
I own two from Modern Devices, but I own a lot more LCDs and it soon became apparent that buying a serial controller for each one was probably not the way to go. So I had a rummage around to see what I could use at instead.
I found a big bag o’ 74HC595 shift registers that I got for next-to-nothing on eBay. The 595 shift register can control an almost unlimited number of output pins from just 3 control lines. This seemed a good place to start – so I designed a small add-on board, much like the serial adapters – with a small pot for contrast control, and the option of controlling the backlight or two additional LEDs from one 595 chip.
The data sheet for the 595 is here.
I made the board as “single-sided” as I could – but it still requires 3 jumpers. The very top one can be the resistor used to run the backlight on the LCD (if one is required – check with the data sheet for your LCD). I left space for a small MOSFET to control the backlight – but I just jumpered this out so the backlight remains on all the time.
I updated the Arduino (22 release) LiquidCrystal library to use the 595 board. Download is here.
It was only after I’d finished it, that I realised a couple of other people had done a similar thing – although I think it’s fair to say this is the most compact solution.
UPDATE (via the adaftruit forum) – this is a neat idea – using a non-latching shift register, a diode and a resistor you can reduce the number of pins down to 2. It does require more work on the uController, as you have to shift out zeros to clear the register first, but it’s a clever solution.