User avatar
hesam_m
Posts: 16
Joined: Thu Apr 25, 2019 9:45 am

Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Wed May 01, 2019 9:44 am

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.

Image
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).

Image
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.

Image
Figure-3, The top layer view of the PCB board

Image
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.

Image
Figure-5, A 3D side view of the board

Image
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.

References
Datasheet: https://www.nxp.com/docs/en/data-sheet/ ... F8574A.pdf
Schematic symbol and footprint: https://componentsearchengine.com/part. ... ID=1057587
Altium plugin: https://www.samacsys.com/altium-designe ... tructions/


Andyroo
Posts: 2827
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Wed May 01, 2019 11:12 am

About time that chip was made :lol:
The whole idea of tying up 8 pins for I/O to a screen was getting a pain esp with small ATTiny chips handling I2C but not having enough to do any display.

Wonder when Pimoroni or Adafruit will release a board?
Need Pi spray - these things are breeding in my house...


scotty101
Posts: 3563
Joined: Fri Jun 08, 2012 6:03 pm

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Wed May 01, 2019 3:12 pm

Does this come with any software library? Or is it just the plans to connect an off the shelf GPIO expander to an LCD?
Electronic and Computer Engineer
Pi Interests: Home Automation, IOT, Python and Tkinter

User avatar
hesam_m
Posts: 16
Joined: Thu Apr 25, 2019 9:45 am

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Tue May 07, 2019 11:44 am

scotty101 wrote:
Wed May 01, 2019 3:12 pm
Does this come with any software library? Or is it just the plans to connect an off the shelf GPIO expander to an LCD?
Actually in the library where you send the data in parallel, then just change that line to an I2C command.

for the Arduino the library has been written already.

User avatar
rpdom
Posts: 14081
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Tue May 07, 2019 11:54 am

Douglas6 wrote:
Wed May 01, 2019 2:40 pm
Like this: https://www.adafruit.com/product/292?
Or on ebay. 16x2 display + i2c module £2.50, if you're prepared to wait for it.
Signature is on holiday.

pcmanbob
Posts: 5891
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Tue May 07, 2019 9:57 pm

rpdom wrote:
Tue May 07, 2019 11:54 am

Or on ebay. 16x2 display + i2c module £2.50, if you're prepared to wait for it.
And most of the ebay ones can be driven using RPLCD using both the gpio parallel method and the i2c modules.

https://pypi.org/project/RPLCD/
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
hesam_m
Posts: 16
Joined: Thu Apr 25, 2019 9:45 am

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Fri May 10, 2019 9:53 am

pcmanbob wrote:
Tue May 07, 2019 9:57 pm
rpdom wrote:
Tue May 07, 2019 11:54 am

Or on ebay. 16x2 display + i2c module £2.50, if you're prepared to wait for it.
And most of the ebay ones can be driven using RPLCD using both the gpio parallel method and the i2c modules.

https://pypi.org/project/RPLCD/
It is not weird to find similar designs, these are not inventions, there are component manufactures and designs base on the existing components, but usually if somebody wants to make a product, he must design it himself instead of a modular header connection.

User avatar
joan
Posts: 13916
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Fri May 10, 2019 11:34 am

These PCF8574T based modules have been around for years. I bought a couple for 99p from eBay in June 2015.

One thing to note is many have pull-ups to 5V for the I2C bus on the module. It is safest to trace the tracks and cut the pulls on the module (the Pi has 3V3 pulls on SDA/SCL).

Brandon92
Posts: 769
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Fri May 10, 2019 2:43 pm

I have a couple of advise for your design:
  • I would place above R5, R7, R8 also a resistor and mark them as "np". So there is an option to change the adress of IC1, if you need more then one.
  • I would place a small electrolytic capacitors as well on that board
  • I think you can better increase the pull-up resistors to a higher value. If you are using more than one of this kind of board. The resistance could become eventually very small.
  • I saw that you place the + of the decouple capacitor close tho the IC1, what is a good thing. But the - connection to the IC1 is not a direct way. So it will not function as good as you would like to see.

User avatar
hesam_m
Posts: 16
Joined: Thu Apr 25, 2019 9:45 am

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Wed May 15, 2019 10:35 am

Brandon92 wrote:
Fri May 10, 2019 2:43 pm
I have a couple of advise for your design:
  • I would place above R5, R7, R8 also a resistor and mark them as "np". So there is an option to change the adress of IC1, if you need more then one.
  • I would place a small electrolytic capacitors as well on that board
  • I think you can better increase the pull-up resistors to a higher value. If you are using more than one of this kind of board. The resistance could become eventually very small.
  • I saw that you place the + of the decouple capacitor close tho the IC1, what is a good thing. But the - connection to the IC1 is not a direct way. So it will not function as good as you would like to see.
Thank you for the notes. the last issue can be solved by placing some Vias which I do regularly, but not for this design.

Brandon92
Posts: 769
Joined: Wed Jul 25, 2018 9:29 pm
Location: Netherlands

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Wed May 15, 2019 2:09 pm

hesam_m wrote: Thank you for the notes. the last issue can be solved by placing some Vias which I do regularly, but not for this design.
No problem. I know that it can be solved by a couple of Vias :) . But the question is more why you didn't it ;) :geek:

User avatar
hesam_m
Posts: 16
Joined: Thu Apr 25, 2019 9:45 am

Re: Connecting an HD4470 character LCD to the Raspberry PI (or an MCU) using just two wires I2C

Sat May 25, 2019 4:38 pm

Brandon92 wrote:
Wed May 15, 2019 2:09 pm
hesam_m wrote: Thank you for the notes. the last issue can be solved by placing some Vias which I do regularly, but not for this design.
No problem. I know that it can be solved by a couple of Vias :) . But the question is more why you didn't it ;) :geek:
I realized it is not that much important for this circuit, but anyway it is a good habit to always do it, although it may not seem necessary. your point is true ;)

Return to “Automation, sensing and robotics”