Controlling Alphanumeric LCDs With Three Wires

shift

The HD44780 LCD controller is the defacto way of adding a small text display to your next project. If you need a way to display a few variables, a few lines of text, or adding a small user interface to a project, odds are you’ll be using one of these parallel LCDs. These displays require at least six control lines, and if you’re using a small microcontroller or are down to your last pins, you might want to think about controlling an LCD with a shift register.

[Matteo] used the ubiquitous ’595 shift register configured as a serial to parallel converter to drive his LCD. Driving the LCD this way requires only three pins on the Arduino, [Matteo]‘s microcontroller of choice.

For the software, [Matteo] modified the stock Arduino LiquidCrystal library and put it up on his Git. Most of the functions are left untouched, but for this build the LCD can only be used in its four bit mode. That’s not a problem for 99% of the time, but if you need custom characters on your LCD you can always connect another shift register.

If you just can’t spare three pins for a display, you could squeeze this down to just two, or add a second microcontroller for a one-wire-like interface.

Comments

  1. bobfeg says:

    I just use a drop of epoxy to dead-bug mount an ATtiny84 on the back of the LCD. That way you can use 1-wire or I2C or whatever you want. I get the tinys in 100 lot at Mouser for $0.80 ea. I get the LCDs off Ebay for about 3.00 ea. So for less than 4.00 you have an LCD that is really useful.

  2. voxnulla says:

    Like it, but not enough to stop using the standard i2c board for the LCD and only using 2 analogue pins.

  3. steves says:

    I don’t have any blue wires. Would it still work if I used white instead?

  4. gejoiae says:

    Hey! You can use this to tweet the state of your toilet seat in realtime!

  5. Rob says:

    I saw one yesterday that was literally 2 wire (including power).

  6. tekkieneet says:

    Straightly speaking when you use the SPI hardware, the HW reserved the MISO whether you are really using it or not. So in reality this is taking up 4 I/O lines instead of 3 as claimed unless you are bit banging in software.

    There are LCD with SPI interface. “Nokia 5110″ (graphics) which are around the same price $3 as character display from China from the usual places.

    • TRON says:

      Technically speaking, you can still use the MISO pin for something else, driving something from it. The ATmega SPI interface does not set up I/O automatically, setting up the pin’s DDR is left to the user. That being said, nothing stops you from using the MISO pin as generic I/O, even with the SPI interface active. You must, however discard any data that you would obtain from SPIDR after any SPI transaction as it would be garbage in this situation [lest you are driving a second slave from the same port, in which case, four wires be needed, the fourth one as a slave select for this circuit, with its glue logic of course].

    • chango says:

      You can pair the ’595 with some ’165s to latch and scan out buttons while driving the LCD. You can get away with having more ’165s than ’595s or vice-versa since the registers are latched on /CS.

  7. luke says:

    nad here we have another great alternative to the PCF8574 (i2c port expander). I guess this adds to the list of ways to save pins/routing effort/whatever. however this method doesn’t give a way to read data, which probably hardly ever is an argument.

  8. Circuitmage says:

    Ummm…Just use a serial display???

  9. rue_mohr says:

    pwm contrast control next? anyone?

  10. Peter Thompson says:

    Parallax already did this, with backlighting. http://parallax.com/product/27979
    Just a happy customer. :)

  11. here is a way to control a HD44780 LCD with ONLY 1 WIRE…
    http://wp.me/p4jHZx-4

    it monitors the serial monitor and prints anything that comes across on the LCD.

  12. Jan says:

    It’s more efficient to tie both sck and rck pins to the same arduino pin and the third arduino pin to the display’s enable line. The shift register outputs will be updated on every clock cycle but that’s ok because they will only be read by the display once it’s enable pin is toggled. This way it’s not necessary to update all the bits twice serially just to toggle the enable line. I’ve done it, works like a charm.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s