Thursday, July 10, 2014

What's up with HD44780 LCD displays?

There's lots of projects and code online for using character LCD displays based on these controllers, particularly the ones with 2 rows of 16 characters (1602).  They're low power (~1mA @5V), and for only $2 each, they're the cheapest LCD modules I've found.  The controllers are over 20 years old, so as a mature technology you might think there's not much new to learn about them.  Well after experimenting with them for a few days, I've discovered a few things that I haven't seen other people discuss.

Before getting into software, the first thing you need to do after applying power is set the contrast voltage (pin3).  The amount of contrast is based on the difference between the supply voltage(VDD) and VE.  The modules have a ~10K pullup resistor on VE (pin3), so with nothing attached to it there is no display.  If VE is grounded when VDD is 5V, the contrast can be too high and you may only see black blocks.  With a simple 1N4148 diode between VE and ground, there's 0.6V on VE, and a good combination of contrast and viewing angle.

Like many other projects, I chose to use the display in 4-bit (nibble) mode, saving 4 pins on the Pro Mini.  There's also more software available to drive these displays in nibble mode than byte mode.  I like to keep wiring simple, so I spent some time figuring out the easiest way to connect the LCD module to my Pro Mini board.  After noticing I could line up D4-D7 on the module with pins 4-7 of the Pro Mini, here's what I came up with (1602 module on the left and the Pro Mini on the right):
It fits on a mini-breadboard and only requires 3 jumper wires - one for ground, one for power, and one for RS (connecting to pin 2 on the Pro Mini).  If you use the pro mini bootloader to program the chip, you may have to temporarily unplug the LCD since it connects to the UART lines.  If you use a breadboard programming cable to flash the AVR using SPI, then you can leave the module in.

These modules are also available with LED backlights powered from pin 15 and 16.  Those pins line up with pins 8 and 9 on the Pro Mini, which could be used to control the backlight.

Power Usage

A datasheet I found for a 1602 LCD module lists the power consumption as 1.1mA at 3V.  To measure the actual power usage, I put a 68-Ohm resistor in series with the 5V supply, and connected a 270 Ohm resistor between Gnd & VE.  The voltage drop on the power line was 45mV, and solving for I in V=IR means 0.66mA of current.  The voltage drop across the VE resistor was 120mV, so 2/3 of the power consumption is from the VE current, with an internal pullup resistance of 11.2K.  Most circuits I've seen for these modules recommend a 10K trimpot for controlling VE, which would add another 500uA (5V/10K) to the power consumption.

The internal pullups on the data, RW, and RS lines are another factor in power consumption.  If the AVR pins are left in output mode, four data lines and RS set low will draw 125uA each (datasheet pg. 51) a total of 750uA.  A good HD44780 library will set the AVR pins on those lines high (or to input mode) when not in use.  Speaking of software, it's a good point to finish this post and start on my next post about AVR software to control these displays.