I2C LCD display getting corrupted

for unknown reasons my 20x4 LCD display get sometimes corrupted. At otherv times everything looks OK.
I suppose the power consumption is too high.

Is there a possibility to diminue the backlight-intensity via the software :
e.g. by putting a value between the brackets in the line lcd->backlight():

I include <LiquidCrystal_I2C_Spark.h
and <Serial_LCD_SparkFun.h

I don’t find what to include between those brackets to have the desired result.
THX for your help.

@chip Why are you including Serial_LCD_SparkFun.h? How are you wiring the display from I2C (D0, D1 pins)?

If you are using I2C then you will need to add pull-up resistors (4.7K say) on SDA and SCL lines to 3.3V. If you have not done this then the lines will float when not driven low by the photon and thus you could get corrupted messages.

It terms of controlling the backlight LEDs - the library provides backlight(); and noBacklight(); I am not sure if the display controller on the unit you have supports this. As for gradual dimming that would require driving the backlight LEDs from a PWM capable pin - you need to be careful of the current taken by the LEDs and this may not be feasible without some form of switching MOSFET.

1 Like

THX for your help !
For the first question : I tried the program without including Serial_LCD_Sparkfun.h and it works perfectly.
So that line was canceled.
For the second point : I tried the position noBacklight() but at that moment the figures aren’t readable anymore. So I went back to the original position.
For the third point : I measured the power on the SDA and SCL-lines and got ± 3.3 V as asked for. So this seems to be correct.
The last proposal is too technical for me. I’m not skilled to do so.
Again, THX for your help !

You can put this adapter plate to adjust the brightness with the included potentiometer.

That would be contrast not brightness

You didn’t answer his question. If there are no pullups on both lines it will not work properly.

The pull-up resistors are mounted