LCD 1602 (I2C) flashes after disconnecting GND, why?

after some time I want to completely disconnect the LCD 1602 (I2C) and I went the N-Mosfet route, which disconnects GND. But as soon as I disconnect GND from the LCD, the LCD starts flashing and after reconnecting GND, the LCD no longer listens and displays strange characters. A restart is then required.
Can you tell if it is even possible to disconnect the LCD via GND and switch it on again?

Removing the ground while the rest of the system is powered up is one of the things that will damage a system. This is because the system then tries to power itself parasitical either through a connection to ground or Vcc via the protection diodes. This often blows or damages those diodes, so switching off some connected device is not a very good thing to do.

It can only be done safely if before you do it you make all the pins connected to the device into inputs first.

Having said that it will not always work because of the processor inside the LCD display not starting up correctly. Just stop writing to it and turn off the backlight LED, which being an led can be turned off.

This is referred to as an "XY Problem".

You could as the saying goes "go through the hoops" to disconnect the LCD and start it up cleanly again, but why on earth would you ever want to do that?

Suspecting you are connecting this to an Arduino board, the LCD draws vastly less current than the Arduino, even if you attempt to put it in "sleep" mode. You certainly should ensure you do not have the contrast potentiometer connected to 5V as that is a longstanding mistake in published circuits and wastes some 500 µA which is half as much as the LCD itself draws.

Attempting to "disconnect" the LCD just makes no sense at all. :roll_eyes:

Well, it should work if you perform the correct sequence. :sunglasses:

Do you want to turn the entire LCD off, or just the backlight?

We need more info as to why you need to turn the LCD off.

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

Dear me!

Now you are jumping the gun! :worried:

My intention was to first obtain a more detailed explanation of the OP's comprehension of the overall situation.

The backlight - given that "R8" on the "standard" 1602 module is 100 Ohms, marked as "101" - does not require a transistor to switch it as it draws only about 22 mA when switched directly by an Arduino pin. There is some loss of voltage in the Arduino driver at this current level but it is not overloaded.

Using a separate Arduino pin to switch the LCD module proper is perfectly practical since there is negligible voltage loss as the LCD - with the correct potentiometer wiring - draws only about 1 mA but again it generally makes no sense at all to "save" that 1 mA in the context of a project using an Arduino board. :face_with_raised_eyebrow:

The simple answer to the question is technically yes. But as a few others have explained, it is not as simple as you are likely wanting it to be. So at least from a simplicity point of view, likely the answer is no given the additional h/w as well as s/w things that must be taken into consideration to actually make power disconnection / re-connection really work.

On the s/w side there is not only the initialization and state of the processor inside the LCD but also the initialization and state of the Arduino LCD library.
This is of particular concern if using 4 bit mode since if the LCD and library get out of nibble synchronization, the only way to recover is to go through a particular sequence of instructions that reliably gets them back in sync. This is only done when the sketch calls begin(). Yanking the power to the LCD puts the LCD into its default which is 8 bit mode and the library has no way of knowing this which means that if the library has transitioned to using 4 bit mode, it will no longer be able to communicate with the LCD since it will be talking 4 bit mode and the LCD will operating in 8 bit mode after powering back up.

So the real questions comes down as Paul_B asked,
What is the real problem you are trying to solve?
and what is the full environment you are using?

Until we know more, we simply can not offer any suggestions or solutions without having to make a lot of assumptions as to what you wanting / needing.
And hopefully you know the old saying about what happens when you assume something.

--- bill

At this point it is apparently 20 hours since the OP.

While I am up ridiculously late and just going to bed, I do hope that in the next four hours the OP will be at his computer again! :grin:

I supply the arduino externally to a 5V pin. I use servomotors, LCD display and other things that are measured up to 820mA. Before connecting USB, I always disconnect modules that have a high consumption, so as not to detonate the LDO. I disconnect the servomotors and I also want to disconnect the LCD. I solve the disconnection with N-Mosfet and just that GND disconnects the disconnected LCD, which I had no idea.

  • The LCD has a "nearly to nothing" current draw without backlight. Just switch off the backlight to save current.
  • You should not disconnect GND from components which are connected to the Arduino on other GPIOs.
  • If you really have to switch off components, switch off VCC (not GND) of the component.
  • If you have switched off a components VCC - you might need to do the initialization again after you have switched on the component.

Well you shouldn’t even do that by removing the ground, because of parasitic powering through the signal pins. Unless you don’t set the driver pins to outputs until after the power on them is up.

What does that actually mean?
Is there some sort of current limit on the Low Drop Out regulator?

Language translation oddity. :rofl: To "detonate" is to "blow up". I am sure you understand exactly what it means in electronic terminology to "blow something up". :roll_eyes:

I again invite the OP to explain why he even wishes to turn off any part of his system? He needs to explain in complete detail what this system is, what Arduino or other microcontroller he is using, what it is intended to do and how it is powered,

In general, we agree there is no reason to wish to switch off the LCD display, even to save power.

As I said, this is a classic "XY Problem ".

Can you please post a circuit diagram so we can see the scope of you project?
Not a Fritzy image, a picture of a hand drawn diagram would be fine.

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

I am but what I am not clear about is why it is thought it would blow up with a switch on surge?