LCD I2C wiring issue

First time poster. Hope I do not mess up.

I am trying to create my own I2C LCD circuit for a PCB and wanted to test the wiring in Tinkercad.
I have used the attached schema and wired like in the image. (One 220 Ohm resistor is attached to the VCC-side of the LCD back light. Not in the schematic).

I have done a serial readout and the I2C-address should be correct in the code. However I do not get the display to print out "Hello World". Am I missing something obvious?

The code used is:

#include <LiquidCrystal_I2C.h>

//define I2C address......
LiquidCrystal_I2C lcd(0x25,16,2);


void setup() {
  lcd.init();
  lcd.clear();
  lcd.backlight();

  lcd.setCursor(2,0);
  lcd.print("Hello World");

}

void loop() {


}


With all 3 I2C address lines to the PCF8574 tied high, the I2C address should be either 0x27 or 0x3f.

The hd44780 library automatically determines the I2C address and the LCD to I2C backpack pin mapping.

1 Like

Welcome to the forum.
Can you give a public link to the Tinkercad project ?
Be careful, there are two links: one public link so others can make a copy to tinker with and one to share your project with others and then everyone can change your project.

Did you know that the potentiometer of 10k for the contrast can be a potentiometer of 1k between V0 and GND (5V is not connected) or a single resistor to GND of 470Ω or 1kΩ ?

1 Like

You could also run the I2C scan code that is provided with the IDE, or Nick Gammon's (improved) one; either should find your display. The PCF8574 will be found at addresses 0x20-0x27, while the PCF8574A will be found at Ox38-0x3F.

Thank you! Still learning.
Here is a public link: Circuit design LCD I2C - Tinkercad

I have tried 0x27 and 0x25 with no luck.
Do you mean that I can get the right contrast without the pot? That would be very convenient.

I checked the circuit in Tinkercad.
The address is 0x25, and I think that RS,RW,E,backlight,D4,D5,D6,D7 are according to the "LiquidCrystal I2C" library.

What we need is a working project in Tinkercad with a PCF8574 and a LCD display. But I could not find it. Maybe it does not work in Tinkercad.

The best thing you can do is run the I2C scanner, it is just like a normal sketch but it will give you all the I2C address that are active from 0 to 0x7F. With that you will need to put that into the code. Use that number in in place of 0x25. After that I expect you will get Hello World.

Thanks for all the help!

I did so, but to no avail. The adress reads out 0x25, but I have tried many options.
Do you think there might be a Tinkercad limitation?

I do not want to waist a perfectly good LDC on a faulty PCB design, that is why I try to confirm my designs in Tinker.

If you can find even just one example that the PCF8574 works with a display in Tinkercad, then it should work.
If you can find even just one mention that there is a issue with it, then it does not work.

I can find neither of them.
Since I can not find a flaw in your design, let's blame Tinkercad. It was a waste of time. Build a prototype in the real world.

1 Like

Hi, @jackflash80

Can I suggest you get into the real world and build your project in the real world.

Thanks... Tom... :grinning: :+1: :coffee: :australia:

You are absolutely right. I should get a PCF8574 and build my own circuit. Thank you!

That address would indicate a bad connection on A1. If this just a tinker cad simulation then I really do not have a clue, my experience has all been on hardware.

Indeed. I was puzzled about that too. I see, looking carefully, that in Tinkercad has allowed the OP to connect the middle 1k resistor to a non-existent hole on the breadboard.

1 Like

Great catch!

Great! This indeed caused the 0x25 address. I have updated and it now reads 0x27, but I still do not get a readout on the display. (And yes, I did update the code)

Maybe look for other Tinkercad "loose connections". Some of it clearly works because you can run the I2C scanner, however the wiring between the PCF8574 / contrast potentiometer to the display may be faulty. Also ensure you are using a code sample which matches the library you have installed. Maybe you need to explicitly initialise I2C with the Wire library:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);


void setup() {
  Serial.begin(115200);
  Wire.begin();

  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Hello, world!");
  
}

void loop() { }

Tinkercad might be cutting corners and solve simulation problems in software.

The Wokwi simulator simulates the hardware. Any software can run on top of that. That makes it possible to upload your own library or use MicroPython on the same (simulated) hardware. The Arduino Uno is even clock-accurate simulated and the ESP32 can connect to a real online server from within the simulation.
Enough talk about Wokwi :wink: here is your LCD backpack in a working simulation:

That is neat! I will look closer into it. Do you see any obvious errors in my Tinker design?

No, I already tested a I2C scanner and checked the wires and tried other things in a copy of your Tinkercad project. Therefor I concluded that Tinkercad is a waste of time (for the PCF8574 with a LCD display).

Instead of making your project from the start, I decided to make it in Wokwi. I was sure it would work in Wokwi, and it did :partying_face:

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