Pico 20x4 LCD with I2C backpack, Arduino Earle Philhower core

I'm not being able to operate a 20x4 LCD display with a PCF8574 I2C backpack on the Raspberry Pi Pico.

I have tried the following, sequentially:

  1. Power the LCD with 3.3VDC and set the pins for Wire library with:
Wire.setSDA(pin); //tried GP0-GP1, GP4-GP5
Wire.setSCL(pin);
Wire.begin();

etc...
UNSUCCESSFUL

  1. Set the pins as above and power the LCD with 5VDC
    UNSUCCESSFUL

  2. Used a 5VDC-3.3VDC level converter on the SDA and SCL pins and 5VDC supply to the LCD display.
    UNSUCCESSFUL

  3. Use the same thing with an Arduino Nano (ATMega328)
    SUCCESSFUL!

What's up?
Has anyone successfully used an LCD with I2C backpack with the Raspberry Pi Pico, using Earle Philhower's Arduino core?

RT

Which one? Please post a link to its datasheet.
If it's a 5 volt display powering it from 3.3 volt wouldn't work.

Yes, it is a 20x4 5VDC LCD display. Please refer to points 2 and 3 in my post.

The controller works from 3,3VDC to 5VDC. The liquid crystal requires 5VDC to operate. The ones which are advertised as 3.3VDC displays also boost the LCD voltage to 5VDC.

What are You thinking of? The Raspberry?

Please post proper schematics. Words is not the way to the solution.

I see nothing wrong there.

The Hitachi HD44780 LCD controller is compatible with 3.3VDC and 5VDC. What I am using is a PCF8574 8-bit port expander backpack connected to the LCD, to reduce the pin-count required to run the LCD.

image

I see nothing wrong there.

Exactly what I'm thinking. But this doesn't work. And the same arrangement works with the Nano.

Another interesting thing:
When I run the test program, there is a place where the backlight is toggled on and off. That works! Even while the LCD display doesn't, even with a 5VDC supply. That leads me to suspect that there is something the matter with the core itself, not the connections or the software.

Unless you can think of something else.

With the Arduino mbed core for the Pico, you have to open up arduino.h and edit the pin assignments for the I2C interface.

When changing from Vcc LCD 5 volt down to 3.3 volt, I can imagine that the contrast pot needs changing. Did You do that?

Regarding wire.setSDA/SCL You need to check what pins are available, will function, on the RB. I don't know that.

Did You connect that port expander or was it factory installed?
The LCD might work from Vcc 3.3 volt but does the expander do that?

Yes, checked contrast pot.
Yes, pins checked. The Pico has multiple pins that can be used for UART, SPI and I2C. That is why Earle has added the Wire.setSDA(pin) method for I2C.
I fitted the port expander myself and have done several dozens by now. In any case, it works alright with a Nano.
Yes the PCF8574 works alright with 3.3VDC according to the datasheet and as evidenced by the backlight toggling.

Okey.
And You use "allowed" pins for SDA/SCL? Setting, yes, but I guess that not every I/O pin works as I2C.
Check the connections between expander and LCD again. Was any unintended thing happening during the road from nano to RB?

I just remove the female plugs from the Pico pins and plug them into the Nano pins and everything works! :slightly_smiling_face:

Then You use the wrong pin/pins on the RB, or uses them the wrong way.

Let's see if some RB knowing helpers step in.

You are confusing the power supply to the LCD which must be 5 V, with the I²C interface on the backpack which can be 3.3 V if you remove the 4k7 pullups on the backpack and connect them separately to 3.3 V.

The problem here is having a library compatible with the Pi Pico.

1 Like

The problem appears to be with the I2C library. I have abandoned the I2C backpack and am now using 4-bit parallel mode to drive the 20x4 LCD display. Everything is OK now...

Just curious which LCD library are you using?
I haven't tested that platform with the hd44780 library and I don't yet have the h/w to test it.
If you aren't using the hd44780 library, could I get you to try it with that library to make sure it works?

After you install the hd44780 library, run the diagnostic sketch, I2CexpDiag.
For this to work you will need to use the default pins for the SDA and SCL.

--- bill

Hi...

I was using the LiquidCrystal_PCF8574 library. I could scan the bus and find the PCF8574. But it just refused to work with the Pico.

I have now discarded the PCF8574 I2C backpack and am using the plain vanilla LiquidCrystal library in 4-bit parallel mode. This works. Though I've lost 5 extra pins...

I have just downloaded Earle's updated Arduino core. I wonder if things are better now. I'll try that tomorrow I think, with an MPU9250 I2C port and report back to you...

Regards.

RT

Hi! I caught the culprit! :slightly_smiling_face:

I have a PCB on which there is an input of 12VDC, which is reduced to 9VDC by a 3A buck converter, for supplying the Pico VSYS pin and a 7805 strung, up on the 9VDC to supply 5VDC to the 20x4 LCD display.
What was happening is, that when the backlight was switched on, the 7805 supply would drop to 3.4VDC and the LCD would stop displaying. I caught this only when I experimented with switching off the backlight. Till then, I had the backlight on from the beginning of the program...

So, the problem was with the 5VDC supply to the LCD...

Thanks for your dogged pursuit of the problem... :slightly_smiling_face:

Regards,
Rajiv

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.