Controlling Alphanumeric LCDs With Two Wires


The Hitachi HD44780 LCD controller is the most common interface to all those alphanumeric LCDs out there, and there are a million and one tutorials for connecting these displays to any microcontroller imaginable. This still doesn’t mean hooking up these displays is necessarily simple, though: you still need at least four wires for the data, at least two for control signals, and power and ground lines for connecting the LCD the traditional way.

Here’s a neat trick for connecting HD44780 displays that only needs two wires. In this setup there’s only a ground and power+data wire. The interesting part of this build is using the power pin to transmit serial data with an RS-232-like format. The only difference is keeping the data line at +5 V when idle; a reasonable-sized cap keeps the display and controller alive when the master microcontroller is transmitting.

This technique does require a bit of logic on the receiving end, which a small 8-pin PIC can handle with ease. Communication between a microcontroller and this “smart” LCD is done at 2400 bps, which even the wimpiest micro can handle. All the software to make this setup work are available here, and we expect an Atmel-based version to hit the Hackaday tip line shortly.

42 thoughts on “Controlling Alphanumeric LCDs With Two Wires

  1. You dawg, heard you like microcontrollers…
    There already is a micro in the LCD, no need to stick another one on, if it can’t interface with a serial bus, get one that can, the HD44780 “standard” is something like 25 years old, time to let it go for something less ancient…

    1. If you’re going to diss on ancient tech just ‘cuz it isn’t cool enough for you, you should probably provide a link to where one can new ones and talk about differences in price.

      At best, it’ll make your contribution actually useful.

    2. I have a box of parallel LCD screens I picked up at a hamfest. Some used, many not. I only spent a few dollars on the whole box! Sometimes you get deals like that if you are willing to play with some older tech. It may not seem worthwile if you are only thinking about one project at a time but it is nice to have stocks of parts like that. When you get an idea you can just hit the garage and start building!

      1. My point was that either you use a micro that can afford the IO for the parallel bus or use a different display driver that can do serial, inserting yet another micro in between is like fixing a leaking boat with duct tape…it works but that’s not the way it’s supposed to be done…
        Plus, it adds even more latency :P

        1. It’s not only a 1 line communication, the display module which comprise the pic12f508 is powered by the data line. the display can be installed at some distance without needing its own power supply. An LCD with rs-232 would need a power supply.

      2. Although I admire anybody building stuff like this, self build has become a numbers game.
        Nevertheless, the pic12F508 seems a bit of overkill, as one can use an HC595 for 1 wire protocol with even fewer components.
        If I look at prices (in euro’s)
        PIC12F508 1.75 or 65 cts in bulk
        HC595 .30 or 6 cts in bulk
        The HC595 is a much cheaper and easier (less components, no programming) solution. If you dont want to buy bulk, then remember that the single PIC12F508 is still more expensive than an entire arduino pro mini if ordered in china, or one could buy an i2C interface in china for around a dollar.
        I am not putting down your effort, absolutely not, but as said… it is a numbers game

    3. I bought a pack of ten 16×2 HD44780 displays with backlight for 16 bucks including shipping from china. How can you beat that with a serial lcd? Everyone still uses them because it’s super easy to interface with them, and because they’re super cheap. Add a board with an 8 pin micro and some almost-free components for a buck or two, and you have a serial lcd for $3~4.

  2. While I admire this guy’s desire to go for 1-wire type control, surely it would have been easier to design it with data and power as 2 separate lines? smaller cap, smaller footprint, cheaper component, and only one extra wire, with much less concern over having to keep the cap charged?

    1. Sorry, to add: Maxim has a whole series of “parasitic power” parts which allow you to communicate by providing only power and ground and toggling power in the same way. I’ve used their temperature sensors like that many times in the past. I assume other vendors do too.

      1. In small quantities, yes.

        I would hazard a guess that most people who have the skillset to do this earn at least $30/hr. So if they spend more than 5 minutes trying to design, implement or debug a hacked solution rather than an off-the-shelf one then they’re losing money.

        If you’re looking at a larger quantity system then that’s even more reason to use a reliable design rather than a hack.

        As purely a “do it yourself for fun” sort of thing, absolutely it’s neat, but I’m also not quite sure how it’s a hack since (as many others have mentioned) this design has been around for quite some time, and production parts also use the same idea. Someone probably has a patent on it too.

      1. I think ‘Discrete Logic’ is a pretty common designation for designs based on standard logic chips like the 74xx series instead of being based on microcontrollers or programmable logic. Isn’t that?

        1. Didn’t use to be. Maybe in the centuries to come anything that doesn’t grow it’s own wires at at a molecular level, or uses polarised semicondutors instead of entangling the circuit into a quantum dot, will count as “discrete”.

    1. But, of course, the power supply trick is ingenious. You can put your display away from the main board by using simply a pair of wires. Have you tried this using a rectifier bridge, so the polarity of the connection doesn’t matter ( still thinking about a remote display and a fool proof installation )

      1. UBS is the folks that posted this under the name EDN. No problem if permission was gained in advance as per their TOS… everyone wants their TOS respected. Am pretty sure HAD is in compliance… haven’t known them to be slackers…

  3. Upsize the cap (to a few hundred uF or more) and with a high current buffer on the host side, even a backlit LCD can be used.

    I have personally used a PCF8575 to connect a HD44780 LCD to a I2C bus in order to cut down on the number of wires going to the front panel of an air conditioner. It allows the use of the 8 bit interface and has plenty of left over GPIOs for backlight control, auxiliary indicators, and buttons. The PCF8575 (and the 8 bit PCF8574) have an interesting output circuit that acts as open drain with a 100uA pullup, except it will drive the line high for about 10us on a rising edge. I put a 4k7 from the clock pin to ground so the line falls back low shortly after a high transition, which nicely clocks the LCD and cuts down on I2C traffic.

    1. Original post: “Here’s a solution that requires two lines, just power+signal and ground”
      Your comment: “If you happen to have four (CK, DO, Gnd, Vcc) or five (+ /SS) spare lines, why not just use a shift register?”
      Did you not think? Or do you just think there’s no possible reason you might only have one spare line? Or that you might not want to run that many wires?

      1. As for me, the above one-wire solution is valuable in terms of “hacking”, but rather complex yet useless in a practical context. Almost any MCU offers a SPI, which typically is used for many devices, thus you actually don’t “waste” 4+ lines. Why programming an extra-MCU for doing the same thing I can do with a trivial logic? For instance, I don’t have any tool for dealing with PICs, but a shift-register costs < 1 €: the shreg looks straightforward.
        I'd also add that most of the times the LCD requires a backlight, so the auto-powering can't be applied.

        1. All of two comments above your original post someone points out that a backlight is a non-issue.
          Also, the cost of a suitable PIC (10@$0.48/) or Attiny (10@$0.66/) is small enough that the comparative cheapness of the shift register (10@$0.10/) isn’t a particularly compelling argument.
          SPI also doesn’t like branched lines, so hopefully that doesn’t get in the way for your more-lines solution, either.

  4. I would like to show some appreciation for the HaD staff that bring things like this to us, even if they seem like a popularity flop, they encourage disscussion and therefore indirect education for a number of people on a number of topics.

    p.s. post more of the hacks I send in would ya? I put lots of work into writing up that junk!
    Conversly, what are HaD staff looking for in a Tip? (why dont you like my stuff?)

  5. I can tell you all why it is better to use a micro instead of a shift register of dedicated I2C/1wire expander:
    -the micro will cost you about the same as the expander(ok, shift reg is cheaper)
    -you can add electronic contrast adjust in software(PWM channel)
    -you can control the back light intensity(PWM)
    -you can also read some buttons/rotary encoders
    -drive some LED’s
    -all in all make a nice great front panel with a lot of functionality with a simple 2K micro
    -need 4 wires to connect back to the micro(i2c) not 30.
    -if your front panel is far from the micro it may be cheaper to use another micro and less wires(just look at the auto industry).
    -character lcds with serial interfaces are available in so little shapes/sizes/colors, from very few vendors and a lot more expensive than the regular ones

    I need to make a write up of this and post … i’ve used this quire a few times…

  6. Many of the keypad home burglar alarms built in the 1990’s only used 3 wires to send and receive data from the keypad. The keypads only used descreet logic and transistors and send the data on the same line as the power. This allowed up to 16 keys for input and 16 led’s for out. No MCU was required in the keypad. Some of the current models still use the same method

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.