Cant get LCD working with I2Cbus on mega

hi all,
i'm really at desperation !

What worked a week ago, does not work now !

i have 2 different mega's, one is a "declared rebuild" (JOY-IT MEGA) working fine with usb ,
the other is a clone (?) with usb-problems, but thats not the point i'm delaing with.

a week ago my 2rowLCD (hd44780) worked fine with I2C one the "Clone".
for SDA , SCL the pins near the usb-jack were used.

the LCD shows 2 lighted rows, but not any char is shown,
adjusting light does not show chars

at the "Joy-it" - Board there is no text near the usb-jack but 3 pins unused,undeclared.
anyways i tried connecting like above : not any char !

After reading this forum, there was something about pin 20/21 (what i didnt realize is
that this is printed on both boards).

Ok, i tried connecting the lcd to "Joy.." and "Clone" at pins 20/21: not any char !

both boards upload programs without problems, so i guess they are ok !

Can it be, that only the I2C-bus is destroyed ?

whatelse i should check ?

voltages are 4,95V at VCC and 3,0 V on both SDA and SCL..

Sketches are the same as a week ago, when it worked all fine..

please help !

I think you need to post your sketch and wiring diagrams ( hand drawn) . A picture of your setup would be good too .

How are you powering it , anything else connected etc rtc

If it all worked fine but not now , what’s changed ?

And please post a link to the exact LCD you are using.

It should be Vcc at both SDA and SCL. Perhaps the pullup resistors are tied to 3.3V instead of 5V? A level shifter may be required?

thanks for answers !

at now the LCD is separatedly powered by a switching regulator (5V),
the ardi-mega is powered by a switching regulator 7,8V .

is it recommendable for quick testing to wire VCC , GND of LCD with
same pins of ardi-board ?

i have here lcd 1602A V3 and 2004A V1.1, which work fine a week ago..

good morning to all here,

Solved !

What i forgot - but rememberd this night
is the issue, that wiring between ardiuno ... and LCD via I2C is critical
in type and length !

replacing the multible plugged wires SDA / SCL with directly wires
it taked success and my beloved Ardi shows what he does :grinning:

Very good :smiley:

Can you tell more ? I am interested in the I2C bus and things that can go wrong.
What kind of cable did you use and how long was it ? Can you show a photo of it ?

Did you know that all the Qwiic, Stemma and Gravity buses are wrong ? See also my Wiki on Github.

hi,
i'm sorry that i dont know much on this issue..

first i used flat-ribbon-cable which wires are distanced less than 1 mm
to each other : so it didnt work.

then i used Jumper-Wire-cable each wire distanced more than 1cm from each other :
that worked !

Now, separating the wires of the flat-ribbon-cable : this works !

Think, you can estimate what going on here ..

for my project with much wires between Ardiuno Mega and LED'S or capacitive sensors or servos - at now wired with flat-ribbon-cable - and mysterious behaviour i have to test with different wiring :astonished:

my question to all is :
why does my PC work with rather long flat-ribbon-cables ?

The signals in the flat-ribbon cables in your computer are specifically designed to go through a flat-ribbon cable. There might be a ground wire between all the data wires.

The I2C bus is not designed for a flat ribbon cable. I was not designed to go in a cable at all. It is a weak bus and it is not supposed to go somewhere else.
Could you look at page 54, paragraph 7.5 of the official I2C standard UM10204.pdf (Vss = GND).

The I2C bus can not deal with crosstalk between SDA and SCL. Putting them next to each other in a flat-ribbon cable the worst possible situation.

thanks to Koepel !

What about the wiring from other pins of Ardiuno Mega or Nano ?
at now nearly all other pins are wired with flat-ribbon-cable what i got from an older PC :
should i replace them with separated wires ?

The other wires are probably not a problem. A glitch might occur in the next wire. Perhaps the SPI bus could have a problem with it, but the SPI bus has strong signals and a glitch is most likely to happen in a part that is no problem.

The I2C bus is weak because the high level is kept high will a pullup resistor.
An edge in the signal from a nearby wire does not need much to cause a drop in the signal. Some modern sensors can deal with high speed I2C signals and can act on that glitch.

It's essential that every other wire in a flat ribbon cable is GND or Vcc. This arrangement keeps the signals separate and thus minimizes cross talk. The 2 row ribbon cable connectors support that arrangement, where one row can be connected to GND and the other row connects to the signals. It works like each signal were routed through a shielded cable of its own.