A typical HD4470 character LCD comes with 16 pins. If we ignore the backlight and the power pins, the 8 data and 3 control pins remain. We can address the LCD in the 8 bits or 4 bits mode. Therefore we have to consider at least 11 I/Os (8 bits) or 7 I/Os (4 bits).
The circuit design could be more complicated when we realize most of these LCDs just operate with a 5V supply and typically they are not compatible with 3.3V MCUs. Many modern MCUs offer 5V tolerant pins but naturally in a limited quantity. Also, such logic mismatch circumstances limit the designer to just focus on specific MCU I/Os (5V tolerant) which might have a better use case.
We can fix this problem and control the LCD with just two wires! The PCF8574 chip introduced an LCD to I2C interface for us to communicate with the LCD with just two I/Os. According to the PCF8574 datasheet: “The PCF8574/74A provides general-purpose remote I/O expansion via the two-wire bidirectional I2C-bus (serial clock (SCL), serial data (SDA)). The devices consist of eight quasi-bidirectional ports, 100 kHz I2C-bus interface, three hardware address inputs and interrupt output operating between 2.5 V and 6 V. The quasi-bidirectional port can be independently assigned as an input to monitor interrupt status or keypads, or as an output to activate indicator devices such as LEDs. The system master can read from the input port or write to the output port through a single register. The low current consumption of 2.5 uA (typical, static) is great for mobile applications and the latched output ports directly drive LEDs.”
If there are no 5V tolerant I/Os, specifically for the I2C interface, then you must use a logic level converter circuit/module, but the good news is that you need it just for two pins
The figure-1 shows the schematic diagram. Even the LCD’s backlight can be controlled by the I2C and you don’t need an extra I/O line to handle this. The resistor R4 limits the backlight current. The LCD contrast can be adjusted by the potentiometer R3.
Figure-1, The schematic diagram of the circuit
The floating LCD data pin (D0 to D3) and the PCF chip address lines (A0 to A2) have been pulled down by 4.7K resistors.
I did not have the schematic symbol and footprint of the PCF8574. So instead of wasting the time to design it from scratch, I used the SamacSys search engine to quickly find the component libraries. I use the Altium designer, so I installed a helpful plugin which installs the libraries directly in the document (Figure-2).
Figure-2, Altium designer plugin search results for the PCF8574
I am interested in the 16 pins package from Nexperia or the NXP. So I just selected that.
Figure-3 and 4 show the designed PCB board. It is a double-sided board which has designed in the size of a 2*16 character LCD. All capacitors and resistors are 0805, except for the R4 which has a 1206 package.
Figure-3, The top layer view of the PCB board
Figure-4, the bottom layer view of the PCB board
Figure-5 and the figure-6 demonstrate 3D views of the assembled board. From the side and bottom view. You can see the majority of the components will be soldered on the bottom side.
Figure-5, A 3D side view of the board
Figure-6, A 3D bottom view of the board
K1 is a 4-pins 1mm pitch FPC/FFC connector. You should use a ribbon flat cable to connect the LCD board to your main circuit. The LCD will be mounted mostly on the panel, therefore such type of connection is useful.
Schematic symbol and footprint: https://componentsearchengine.com/part.php?partID=1057587