Re-init LCD during runtime

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
kr0815
Normal user
Posts: 136
Joined: 18 Nov 2015, 18:24

Re-init LCD during runtime

#1 Post by kr0815 » 01 Feb 2016, 18:47

I built 2 sensors with attached LCD Display , one is running fine since 109 days, the other one always gets corrupt / empty after hours

Maybe it´s a hardware issue, but i found the following:

https://www.reddit.com/r/arduino/commen ... few_hours/

especially:
Your code probably assumes it is good enough initializing the LCD just once during setup() is ok then just push data to it forever. This is a flawed assumption, try re-initializing the LCD every minute.
May that be the cause ?
If yes could you please include that feature / change?

User avatar
costo
Normal user
Posts: 507
Joined: 21 Nov 2015, 15:03
Location: SW-Netherlands, NB

Re: Re-init LCD during runtime

#2 Post by costo » 01 Feb 2016, 19:15

This is very likely to happen when your connections are not good. When using a breadboard , connections can intermittently fail. Another possibility is that your SCL and/or SDA pullup resistors are not there or too high in value.
Or the length of your I2C wires is too long. All of these can corrupt the status of your LCD so that it needs to be reinitialised.
Under normal conditions reinitialization is not necessary.

kr0815
Normal user
Posts: 136
Joined: 18 Nov 2015, 18:24

Re: Re-init LCD during runtime

#3 Post by kr0815 » 02 Feb 2016, 08:45

Both are soldered directly, both same 3.3k resistors, cable length about 10 cm

But the working one, sitting at my desk, now i saw i have Uptimes of around 1000
So maybe the working one resets at night, and because of that it looks like always working ?

User avatar
costo
Normal user
Posts: 507
Joined: 21 Nov 2015, 15:03
Location: SW-Netherlands, NB

Re: Re-init LCD during runtime

#4 Post by costo » 02 Feb 2016, 22:11

Your LCD is not unique, a lot of devices needs some form of initialisation to work the way they are intended.
Some devices needs to be set up for a special mode, others have counters and registers that needs to be set to a predetermined value.

So to me it seems unlogical to reinitialise only the LCD display. Then it seems more logical to reinitialise all the I2C devices at the same time. But there should be no need for this in a good designed project. When your ESP resets this reinitialisation is automatically done for all devices.

If you have problems with I2C devices losing there initial status, you should have a good look at the hardware. Maybe there is another I2C device corrupting data on the bus every now and then. Maybe you have a 5V I2C device on the bus and feeding it with only 3.3V ?
Or maybe you have much noise or dips on your 5V supply that feeds the LCD. Do you have enough decoupling capacitors on both power rails, 3V3 and 5V ?

kr0815
Normal user
Posts: 136
Joined: 18 Nov 2015, 18:24

Re: Re-init LCD during runtime

#5 Post by kr0815 » 02 Feb 2016, 22:40

The strange thing is, two identical ESPs, 2 identical LCDs , one is working, one not/only for a few hours
But there should be no need for this in a good designed project.
Thats why i was asking the question if it makes sense to introduce that in ESP-Easy

I know about the 3.3V / 5V Problems, used a Diode to reduce the voltage from 5V to 4.3V to be in the suggested i2c range of 0.7x Vcc

At the Moment the LCD is running, i´ll wait till it dies, then try a Software reset of ESP-Easy, this will Show if it´s a hardware or Software Problem

User avatar
costo
Normal user
Posts: 507
Joined: 21 Nov 2015, 15:03
Location: SW-Netherlands, NB

Re: Re-init LCD during runtime

#6 Post by costo » 02 Feb 2016, 23:24

kr0815 wrote:
I know about the 3.3V / 5V Problems, used a Diode to reduce the voltage from 5V to 4.3V to be in the suggested i2c range of 0.7x Vcc

At the Moment the LCD is running, i´ll wait till it dies, then try a Software reset of ESP-Easy, this will Show if it´s a hardware or Software Problem
I believe you use a I2C interface board to connect a 5V LCD. Did you remove the 2 pull-up resistors from the interfaceboard ?
These resistors are usually 4k7 and connected between SDA-5V and SCL-5V.
After removing these resistors you connect new pullup resistors to the 3V3 line.

kr0815
Normal user
Posts: 136
Joined: 18 Nov 2015, 18:24

Re: Re-init LCD during runtime

#7 Post by kr0815 » 05 Feb 2016, 18:08

I already removed the resitors to 5V and added new ones to 3.3V

The LCD is running sometimes for like minimum 10 hours, sometimes 2 days, then it´s gone

The other one, that´s at least in my opinion running fine, i have no idea if it´s really running fine or if it only looks like, maybe it´s only because at the good one the ESP resets more often ?

I´m willing to do the change myself, does anybody know where to modify it in the code ? I think the initialization is not really done in the LCD part, but in the main part ? Only a subroutine is called ?

Or maybe even easyer as a workaround, have the ESP reset each 6 hours ?

User avatar
costo
Normal user
Posts: 507
Joined: 21 Nov 2015, 15:03
Location: SW-Netherlands, NB

Re: Re-init LCD during runtime

#8 Post by costo » 06 Feb 2016, 17:39

I think the problem is somewhere in your hardware so you have to search for this in your hardware setup.

A good candidate for troubles are your Vcc lines. It may be noisy or pickup disturbances from somewhere. If you look close to your LCD2004 board or the I2C interface you will see that there is no Vcc filtering capacitor to be found but they are very necessary to have for proper functioning.
So, do you have a good tantalium capacitor of +/- 4.7 uF close to your LCD board 5V line ?
If you want to use a ordinary electrolytic capacitor than you need to put a small ceramic capacitor of 100nF in parallel both close to the LCD board.

If you think that a 3.3V I2C signal is not enough to connect to your I2C interface board then you can use a 5V-3.3V level converter and remove the diode that makes Vcc for the LCD 4.3V. Sometimes diode's can generate much noise and the logic on the LCD board will not like that.

If you are curious if your ESP resets sometimes, look inside the webGUI , on the mainpage you can see your uptime in minutes.

themanfrommoon
Normal user
Posts: 48
Joined: 23 May 2017, 21:38
Location: Malente / Germany

Re: Re-init LCD during runtime

#9 Post by themanfrommoon » 02 Jun 2017, 21:42

Hi,

Did you solve the problem? (I know the last post is over one year old).

Do you run the same software on it or different software?
Maybe you can exchange the hardware mirror rotated and test it on the other place.
Then you can see if the problem is hardware or software related.
Maybe it is caused by the Environment (power supply, different place -> different EMC pollution)

Let us know your result.

Thanks and best regards,
Chris

Who is online

Users browsing this forum: Anthropic Claude Bot [bot] and 15 guests