1 Wire LCD interface: Part 1

The one wire LCD interface has been around on the internet for some time already and made popular by Roman Black, although he claims he is not the inventor of the principle. His article is mainly PIC processor oriented, but it gives a good explanation of the principle. Myke Predko is also a name that  should not be unmentioned as pioneer in 1 wire LCD driving. Also this article about  one wire driving of a shift register is very informative

The ShiftRegLCD123 website from Raron used to give a lot of information as well, along with circuits, but that (the Wiki) seems to have disappeared. But his library is in codebender.

In brief, the One Wire interface uses a latched shift register in which the clock and the latch are taken from the data signal through two RC networks that produce the necessary delay. Circuits are a plenty on the interweb, but finding the proper driver for it can be confusing sometimes.

Although the interface on the data, clock and latch lines is rather standard, the connection between the shift register and the LCD has thre major variants that for now i will just call the Roman Black, the LCD3Wire circuit (yes, it is 1 wire) and the ShiftRegLCD123 circuit. Also Elektor has published a 1 wire interface (Detlef Hanemann)(Published in issue 9/2015 on page 92) with yet again a different shift register to LCD connection. Their setup is said to have several advantages over the setup used by Roman Black, it uses the Q7′ direct output of the shift register to trigger the output latch register to carry over automatically the shifted data to the output pins. But for that it requires a monoflop built around a BS170 FET to generate the E-pulse. The setup to be used in Francisco Malpartida’s LCD library is yet again different from the other 3 and uses a diode to create an AND gate

Roman Black






Malpartida LCD library

. Roman Black LCD3Wire Shiftreglcd Elektuur Malpartida
RS  Qc  Qb  Qc  Qg  Qg
E  Qd  Qd  Qh  Qh’  Qh’ sort of
D4  Qe  Qh  Qd  Qa  Qe
D5  Qf  Qg  Qe  Qb  Qd
D6  Qg  Qf  Qf  Qc  Qc
D7  Qh  Qe  Qg  Qd  Qb

Driving these OneWireLCD’s thus differs per configuration. The ShiftRegLCD123 library can do both the ShiftRegLCD and the LCD3Wire protocol. The Liquid Crystal Library of Francisco Malpartida  does have a One Wire protocol but make sure you have the latest version. However, it relies on connections different from the others mentioned:
// Bit #0 (QA) – not used
// Bit #1 (QB) – connects to LCD data input D7
// Bit #2 (QC) – connects to LCD data input D6
// Bit #3 (QD) – connects to LCD data input D5
// Bit #4 (QE) – connects to LCD data input D4
// Bit #5 (QF) – optional backlight control
// Bit #6 (QG) – connects to RS (Register Select) on the LCD
// Bit #7 (QH) – used for /CLR on the HW_CLEAR version (cannot be changed)
// (Q’H) – used for Latch/EN (via the diode AND “gate”) (cannot be changed)

// -----------------------------------------------
//                         74HC595     (VCC)
//                       +----u----+     |          2.2nF
// (LCD D7)------------1-|QB    VCC|-16--+      +----||----(GND)
// (LCD D6)------------2-|QC     QA|-15         |
// (LCD D5)------------3-|QD    SER|-14---------+--[ Resistor ]--+
// (LCD D4)------------4-|QE    /OE|-13--(GND)         1.5k      |
// (BL Circuit)--------5-|QF    RCK|-12---------+                |
//                       |         |             \               |
// (LCD RS)------------6-|QG    SCK|-11-----------)--------------+--(Seri
//                     7-|QH   /CLR|-10--(VCC)   /               |
//                  +--8-|GND   Q'H|--9---|<|---+--[ Resistor ]--+
//                  |    +---------+     diode  |      1.5k
//                  |                           |
//                  |      0.1uF                |
//                (GND)-----||----(VCC)         +----||----(GND)
//                                              |   2.2nF
// (LCD EN)-------------------------------------+
// (LCD RW)--(GND)

The Elektuur/Elektor configuration has its own program, or here (both direct download link)

12 thoughts on “1 Wire LCD interface: Part 1”

    1. Interesting article Mike. As i am not registered to the site, I cant see the pictures sadly.
      There is a lot of discussion about 4 bits vs 8 bits but the experts seem to agree that there isnt really much advantage in using 8 bits over 4. Theoretically the transfer speed would double, but that transfer speed is insignificant in relation to other speed bottle necks.
      Also… not sure if a 595 for instance would have enough pins for that.
      As a matter of fact… I saw that I had started an article about 8 vs 4 bits, but it is still unfinished in my drafts. May take a look at it again

    1. Thanks.. that is indeed a pretty nifty solution. Need to sacrifice backlight control. Still not too convinced about the advantages of 8 bit bit if there are then this is a great solution. Now as I understand you developed this originally with the PIC in mind. Using any library, or just the demo code as in the article?
      When I finish my 4 vs 8 bit article (i had actually forgotten abt it) I wil make sure to put in a link, but Will try to build one as well. Would be good if I can port the library (if existing) to the Arduino platform, rather than reinvent the wheel. Otherwise I will just go by your code
      (I did presume you are the author)
      Great work

  1. I developed it on the PIC awhile back using the low-level PutLCD() driver in the demo code (no library). That low-level driver (11 or 12 instructions) would need to be added to an existing library, like LiquidCrystal (or derivatives).

    The big disadvantage is using two pins instead of one. On the other hand you only need to send a single byte per character instead of two or four bytes per character for those 4-bit methods. For example, my 2-pin method requires 100-usecs to write a single character to the LCD while the Black method requires well over 2-msecs (best case).

    I’m not sure if this may be an advantage or not but the Hitachi HD44780 LCD controllers native power up mode is 8-bit interface mode. While you might rely on the controllers power-up auto-initialization capability to save some code, I would still recommend including code for the “initialization by instruction” procedure outlined in the HD44780 datasheet for the reasons mentioned in that datasheet.

    The 74HC164 version can be used to drive up to 8 column lines on a single row of switches or on a keypad matrix. Simply load 8 bits into the shift register with a single ‘0’ bit (active lo) or a single ‘1’ bit (active hi) without strobing the LCD ‘E’ line and then sample additional pins connected to the switch or keypad row(s). Note that isolation diodes would be required.

    Anyway, thanks for letting me babble… Cheerful regards, Mike

    1. Mike, I always enjoy a technical babble and as a matter of fact I was reading the Hitachi datasheet right now. I built several of the 1 wire solutions purely out of curiosity and yes they are slow but not really noticeable, the comparison with a 1 wire ofcourse might not be entirely fair 🙂
      100us is fast, is that including checking the busyflaq/waiting for a set time, till it clears?
      Roman Black developed his 1 wire originally for the pic as wel I believe.
      Were I to write a library for the arduino platform (dear Lord, still somany projects) I would probably make a seperate one rather than make it a fork of one of the existing ones as those have become rather bloated.
      Currently my interest in it is purely curiosity as I still do not see a situation where 8 bits would be a huge advantage but no doubt someone at some moment will.
      I love the 164 and the 595 but the 164 has my preference, cute little chip’
      Thanks for your input

      1. Oh it is a looooong time ago. I am really not sure anymore what libraries I used.
        In all honesty, I just wanted to try and see if I could do it with 1 wire. In the end I didn’t have much use for it as I didn’t really use many more small microcontrollers 🙂
        thanks for the link. I still do use shift registers albeit for other purposes

  2. You wrote “100us is fast, is that including checking the busyflaq/waiting for a set time, till it clears?”.

    The 100-usecs between LCD writes is way longer than the LCD inter-write delay spec. You really only need to worry about the ~2-msec delay for the LCD ‘home’ and ‘clear’ instructions.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

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