Go Down

Topic: I’m Building a 1602 LCD Shield with the PCF8574 - Which Library to Use? (Read 3337 times) previous topic - next topic


I'm building a simple 1602 Shield for the Arduino Uno with the PCF8574 (or PCF8574A). I'm trying to decide which library/configuration I should use? There seems to be two different standards for connecting the PCF8574 to the 1602. One uses the lower nibble on the PCF8574 (P0-P3) to control the 1602 D5-D7 pins (with the upper nibble managing the control wires). This standard is associated with the original Arduino I2C LCD library. This library has been supplanted by the "New" library by fmalpartida.

The other standard uses the upper nibble of the PCF8574 (P4-P7) to control the 1602 D5-D7 pins. This standard has been established by DFRobot and their 1602 I2C controller card. This standard is also the standard employed by many other low-cost boards currently being manufactured in China. All these use the DFRobot I2C library.

This difference is well explained in the post at http://arduino.cc/forum/index.php?topic=125455.0

The difference between these two wiring standards and associated libraries seems to have created quite a bit of confusion for folks trying to get their 1602 working with their Arduino I2C pins.

I'd like to design an I2C 1602 LCD shield but I don't want to create a new standard and I would like my shield to be able to use one of the two libraries already out there. I would like to make things as simple as possible and reduce the confusion that has been caused by these two different wiring standards.

The fmalpartida library is very good, but the DFRobot configuration seems to be quickly becoming the standard due to the flood of clone boards coming out of China.

I am seeking recommendations on which wiring/library standard I should use. I can't seem to determine which library is more widely used or preferred.


There is not really any standard for how to hook up a PCF8574 to a hd44780 interface.

The nice thing about fm's library is that it can work with any wiring
by simply setting up the constructor properly.

fm's library also also allows a PCF8574 output pin to be configured for backlight control
for either a PNP or NPN transistor(positive or negative logic).
I  have not seen any other library that offers this level of control and flexibility.
The other libraries I've seen all use a hardcoded wiring.
Also, fm's library is probably a bit faster than the other libraries out there since the timings have been optimized.
So in my opinion I would use fm's library.

One drawback to using fms' library for a PCF8574 to HD44780 backpack/shield is that
you do have to get the constructor correct and some users seem to have
issues with that. But I think a small  bit of documentation and an example should be able
help take care of that.

--- bill


Thanks for the advice. I'll look into some of the finer points of that library. I didn't realize that fm's library was not tied to a specific hardware configuration. It certainly seems like the best option.


Thanks again. My shield is done and is working great. Now that I started working more closely with the fm library I see how awesome and flexible it is. If only I had looked closer at it before.

All those hours I wasted searching for a good library to work with my China-made mkjdz board. Why do they scrape off the IC chip part numbers? It makes things so difficult.


Why do they scrape off the IC chip part numbers? It makes things so difficult.

I hope they didn't also put the open hardware logo on their board.


Go Up