LCD screen won't shut down during sleep mode

Hello everyone ,

I’m trying to make a weather station with a mega board. For the moment the code seems to work but I have a problem with electronics.
Before the arduino goes into the sleep mode, it shutdowns my lcd screen and my temperature sensor with a relay.

But when the relay is open , my lcd LED still brights and I don’t understand why. It brights lower than when the relay is close , but still. And I want to save energy when the arduino is sleeping.
It is the same for my temperature sensor , its LED still brights a little.

I’ve tested all the components individually, and everything seems to be ok . But when connected, they are still supplied with voltage whereas the relay is open.

I put in attachement my circuit, it’s quite a mess and I’m a sorry . My relay commute the ground for the right part of the breadboard. Can you see any anomalies ?
My guess is that the voltage from the digitals ports supplies the LED of the lcd , but I’m not very sure.

If you have any idea ideas it will helps me a lot ! Thanks everyone


How to post an image

I know, it's a pain!

Your relay is disconnecting ground from the display, leaving +5V connected. There is a circuit (probably multiple circuits) through the display protection diodes, the connections to the Uno, its protection diodes to ground, keeping the display powered.

You need to disconnect the 5V from the display instead.

[EDIT]
I am assuming that the power rails on you breadboard are split in the middle, if they are not then your relay is not disconnecting anything.

[EDIT EDIT :o ]
I'm pretty sure that based on what I can see on your diagram the power rails are not split, so the relay is not doing anything.

I know, it's a pain!

Hardly, I fix up posts all the time. What's worse is cleaning up embedded color tags when something is copy/pasted.

Thanks for your answers ! And my bad for image, it won't happen again :')

The power rails are split in the middle, that's the first thing I've check !

I've tried to put the 5V instead of the ground in the relay but the same thing happen, I don't understand !

Is the power coming from the Digital Pins of the Arduino ?

The power rails are split in the middle, that's the first thing I've check !

In that case how is +5V getting from the right hand side of the breadboard where it goes in to the left hand side where it feeds the DHT11, the button and display?

Is the power coming from the Digital Pins of the Arduino?

Probably. Try setting the outputs low before disconnecting the power to the display, or set them as inputs without pull up resistors.

The relay is a very poor way of approaching this. :astonished:

Pin 2 of the display can be directly switched perfectly well with an Arduino pin. It requires no more than 2 mA. The contrast potentiometer should not be connected to 5 V, only to ground - this makes contrast setting more flexible and saves half a milliamp, reducing the overall drain to the actual LCD to less than 1 mA.

If the display is a common "1602" with Resistor R8 labelled "101" which is 100 Ohms, pin 15 can safely be supplied with another Arduino pin as the current is no more than 25 mA. Must not be the same pin as controls pin 2.

PerryBebbington:
In that case how is +5V getting from the right hand side of the breadboard where it goes in to the left hand side where it feeds the DHT11, the button and display?

I forgot to draw a wire that connect both sides in the picture .

Paul__B:
The relay is a very poor way of approaching this. :astonished:

Pin 2 of the display can be directly switched perfectly well with an Arduino pin. It requires no more than 2 mA.

I need the realy because I want to cut the power to the LCD and the DHT11 in the same time, I don't see how it is a "very poor way" ?

Problem solved by putting the digitalPin to LOW before shutdown the LCD , thank you PerryBebbington !

I doubt we have heard the last of this.

tangoscar:
I need the realy because I want to cut the power to the LCD and the DHT11 in the same time, I don't see how it is a "very poor way" ?

Because the relay itself consumes more current than all the remainder of your circuit together.

But as long as you are not hoping to run this on batteries, that will not matter - though if you are not hoping to run this on batteries, I do wonder what the point of putting it to sleep is. :roll_eyes:

tangoscar:
Problem solved by putting the digitalPin to LOW before shutdown the LCD , thank you PerryBebbington !

My pleasure.

Paul__B is correct though, a relay might have proven the concept to you and been easy to work with and good as a way to learn, but really a relay is not a good solution. You need to take another step and use a MOSFET for switching the power if switching the power is what you need to do.

PerryBebbington:
You need to take another step and use a MOSFET for switching the power if switching the power is what you need to do.

Quite unnecessary. As I explained in #6.

One Arduino pin can switch the LCD driver on pin 2 and the DHT11 - total current consumption 4.5 mA, will result in a voltage drop of 100 mV on the Arduino pin (Figure 35-24 on the ATmega datasheet) which should not be a problem.

A second Arduino pin can switch the LED on pin 15 if it is the standard 1602 display as per #6. Voltage drop to 4.4 V should not be a great concern but you could use a FET to switch pin 16 instead if you wished.

PerryBebbington:
My pleasure.
You need to take another step and use a MOSFET for switching the power if switching the power is what you need to do.

Yes this is what I need to do, I didn't know the relay consumes current everytime. I'm gonna try with a MOSFET then !

tangoscar:
Yes this is what I need to do, I didn't know the relay consumes current everytime. I'm gonna try with a MOSFET then !

Actually, I missed part of Paul__B's earlier comment, read his reply #6 and #11 and follow his suggestion.

Paul__B:
Quite unnecessary. As I explained in #6.

One Arduino pin can switch the LCD driver on pin 2 and the DHT11 - total current consumption 4.5 mA, will result in a voltage drop of 100 mV on the Arduino pin (Figure 35-24 on the ATmega datasheet) which should not be a problem.

A second Arduino pin can switch the LED on pin 15 if it is the standard 1602 display as per #6. Voltage drop to 4.4 V should not be a great concern but you could use a FET to switch pin 16 instead if you wished.

Thank you ! Indeed it's better than using a relay. But what is a point of having a 5V pin in arduino if every digital pins can supply in 5V ?

tangoscar:
But what is a point of having a 5V pin in arduino if every digital pins can supply in 5V ?

The 5V pin can supply several hundred milliamps (depending how the Arduino is supplied). A digital pin can only supply 40mA absolute maximum (25~30mA for long term use).

You have not answered an important question that was asked: how are you powering the whole project? You seem to be concerned about power consumption, so are you using batteries? If so, what number and type?

For a battery powered project, a Mega is a bad choice. It can never achieve very low power. You can use the Mega for building the prototype, but you should use something else for the final version. A 5V 16MHz Pro Mini would be a good choice. A 3.3V 8MHz Pro Mini would be even lower power, but I think you will need 5V for your display and sensor, so unless you want to change the display and sensor also, stick with 5V.

To achieve a low power circuit, there is something very important that you need: a multimeter. Do you have one? Without a multimeter, you cannot tell if a change you make is better or worse. For example trying to use a relay to reduce power consumption. A multimeter would have told you immediately that the relay was a bad idea, because you would see that the relay uses more power than any of your other components. It does not need to be an expensive top-brand multimeter, just a 10£/$/€ meter will be helpful for this any many other projects.