Interfacing LCD to Atmega using two wires

This is not a new idea of interfacing LCD using two wires, but it can help in many situations when there are not enough microcontroller pins. This example is based on the Hitachi 44780 Alphanumerical LCD.

This circuit I provide represents an idea, but I think it should also work if soldered. We know that to make LCD working, you need at least 6 (in 4-bit mode) wires to control. But what if you need as many pins as possible from your avr and still want to see results on LCD. Then you need to use a serial LCD or make one.

In this example, you need to convert serial data coming to LCD using a shift register. I suggest using the 74HC164. You need only two wires to push data to shift register and then give them to LCD using the “E” strobe signal.

How serial LCD operates?

Atmega’s PC1 pin clocks shift register, and PC0 is the data line. Before you write to the shift register, clean it by sending “0” in eight clock cycles. You can erase the register with an additional wire controlling register reset, but there would be 3 lines used.

After the register is cleared, send eight bits to the register. The first bit is always 1, as it is used to strobe LCD, the second bit is Register Select, and then one bit is not used and then follows 4 bits as data, and the last bit is always 0 to make strobe E work correctly. You should see that in the eight clock cycle last bit in the shift register enables LCD with a “1” value in the last bit. Then by sending “1” to the data line, you enable the LCD E pin. Resistor and Diode act there as AND elements. If only the registered Q7 signal is active but data low, then the LCD E pin is low. If the data line is high, but the 74HC164 register Q7 pin is low, then the diode pulls low this signal, and the LCD pin will become low. Only when both PC0 and shift register Q7 are high, ten LCD pin E is strobed.

Added some Test routine Programmed with WinAVR. I tested it, and it is working.


  1. I have corrected this schematic by including AND gate for enabling E pin of LCD. LCD will be enabled when both Data input and shift registers output Q7 will be logical “1”. Without AND gate it was impossible to clear LCD because while clearing data shifts forward through E pin and this enables LCD multiple times by by writing dummy data to it.

Leave a Reply