A 2-wires LCD with HD44780 and 3 x 74LS74 (put 2 shift registers on same 2 pins) - Page 1
Forum section: electronics / projects

author: RoGeorge
author_rank: Super Contributor
timestamp: January 30, 2023, 04:17:05 pm
content: Found in the scrap boxes a few 2x16 text LCDs and many KM555TM2 (74LS74).The HD44780 controller of the LCD will need at least 4 data bits, an RS and an Enable pin, so a total of 6 microcontroller pins. This is also the minimum number of DO pins the LiquidCrystal library (from Arduino) will use.LCD pinoutThe number of DO pins can be reduced to only a CLK and a DATA pin, if a shift register is used. Even so, an Enable would still be needed if we are to obey the HD44780 requirements for data hold timing. The nice part is shift registers here are shifting on the raising edge of CLK. That makes possible a trick where two shift registers can be independently controlled with the same 2 pins, by swapping the DATA and CLK for the second shift register.2-wire to 6-wire shift registers schematic with 74LS74 D-type flip-flopsFirst, the RS bit and the 4 data bits D7..D4 are pushed in a 5 bits shift register implemented with 5 D-type flip-flps (FF) from the 74LS74 chips. Then, the 6th FF is used to pulse the Enable pin of the HD44780 controller, while the other 5 bits are kept without shifting. It is possible to do so if DATA line is used as a clock for the 6th FF.The existing 'LiquidCristal' Arduino library was modified to use only two Arduino pins instead of six, so to keep backward compatibility with already existing Arduino code and examples that are using the current LiquidCrystal library. The modified files were renamed to 'TwoWireHD44780_LCD'. Tested on Ubuntu 22.04, with Arduino IDE 2.0.3 AppImage and an Arduino Nano board.Breadboard circuit and TwoWireHD44780_LCD library testThe modified library can be packed as a standalone Arduino lib, if the original LiquidCrystal.h and LiquidCrystal.cpp are replaced by 'TwoWireHD44780_LCD.h' and 'TwoWireHD44780_LCD.cpp'. The easy way is to copy the TwoWireHD44780_LCD header and C++ files in the same directory with the main ino sketch, as they are in the attached code example.

author: SuzyC
author_rank: Frequent Contributor
timestamp: January 31, 2023, 02:59:18 pm
content: Seems a bit excessive using so many '74 FF when a single 74HCT164/74LS164/etc. or 74HCT175/etc. would do the job.

author: Ian.M
author_rank: Super Contributor
timestamp: January 31, 2023, 03:28:43 pm
content: Or use an 8 bit I2C I/O expander and share the pins with other I2C devices:https://github.com/duinoWitchery/hd44780/wikiThe library can do Deep Magic to auto-detect and configure an I2C HD44780 LCD, including autodetecting how its wired, even including the backlight! Run the sketch that searches for LCDs then 'bake' the correct configuration into your firmware.Roman Black's single wire shift register also deserves an honourable mention, although the risetimes are out of spec for the '595 shift register:https://www.romanblack.com/shift1.htm

author: RoGeorge
author_rank: Super Contributor
timestamp: January 31, 2023, 03:47:11 pm
content: It has to be one shift register of 5 bits, and yet another independent FF to control the Enable pin of the LCD. The 5 data bits are sampled by the LCD at the falling edge of the Enable signal.164 and 165 has all FF tied internally at the same CK, so a second IC would be needed (with at least one independent FF) where the D and CK inputs can be swapped, in order to control the Enable pin of the LDC.Either way, it happened that I was already heaving 20-30 of LS74 sitting in a box waiting for a project since the '90s.

author: pcprogrammer
author_rank: Super Contributor
timestamp: January 31, 2023, 04:15:28 pm
content: An interesting approach for sure, but far easier with a module like available here:https://nl.aliexpress.com/item/1005001395324663.htmlBut boy did they go up in price. In March 2021 I bought 5 for a total of 3 euro.

author: RoGeorge
author_rank: Super Contributor
timestamp: January 31, 2023, 07:02:38 pm
content: That's cheap indeed. Mine was disregarding the price. With the price of 3 NOS TTL from 1990 it would probably be possible to buy a brand new serial LCD with backlight (the LCDs I found have no backlit). The built was for the fun, using only whatever parts were found through the scrap boxes (trying to inventory all the boxes, and thus bumping into all kind of parts).The nicest idea I've seen about the minimum of wires for an LCD was this project (not mine), where a single wire was used to control the data pin, and the same wire was user as Vcc phantom power, so the whole LCD is connected by only 2 wires, one of which is the GND:https://blog.vinu.co.in/2019/04/16-x-2-lcd-controlled-via-power-line.html

author: pcprogrammer
author_rank: Super Contributor
timestamp: January 31, 2023, 08:03:52 pm
content: Quote from: RoGeorge on January 31, 2023, 07:02:38 pmI have used power schemes like that way back using RS232 signals as the source for the power. It is also the way one wire (Dallas/Maxim) can work. Just ground and the data line. The chips have build in capacitors to keep them going during bidirectional communication.