Sleep and LCD current

I have seen several posts when I searched this subject, of driving the LCDs logic from an arduino pin.

I have tried this on a remote control I am making, but when I measure the current from the battery, which used to be 1mA consumed by the LCD display, it actually increases to 20mA when the unit goes to sleep !

I was worried about removing the VCC from the display while its inputs are stilll connected to the 328, and sure enough, when in sleep mode , the DB4 data line from pin 6 of the 328 is still high, and presumably causing confusion through the input protection diodes or something.

I am using the <LiquidCrystal.h> library, and my sleep routine is

/* Setup pin2 as an interrupt and attach handler. */
    attachInterrupt(1, pin3Interrupt, FALLING);
    delay(50); // need this?
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);  // setting up for sleep ...
    sleep_enable();                       // setting up for sleep ...
    ADCSRA &= ~(1 << ADEN);
    PRR = 0xFF;
    sleep_mode();                         // now goes to Sleep and waits for the interrupt
    /* The program will continue from here after the interrupt. */
    
   //  Serial.println(" waking up ");
    detachInterrupt(1);                 //disable interrupts while we get ready to read the keypad 
    PRR = 0x00;
    /* First thing to do is disable sleep. */
    sleep_disable(); 
    // set all the keypad columns back high so can read keypad presses again

Would it be in order to digitalWrite the DB4,5,6,7 pins low at the beginning of the sleep call? or will this clash with the LCD routine ( which I dont think is refreshed at all )

and if so, is it ok to let the library set them to whatever it wants after waking up ?

You definitely don't want to power down the display with a HIGH logic input connected - you could
burn out the protection diode (CMOS chips will take all their power from such a pin) Have you
measured the current consumption with the display on (and backlight off)?

If you power down the display you probably need to re-initialise the driver for it on power-up
anyway, so changing all the pins to INPUT mode and LOW before sleep ought to be reasonable.

Yes, I must get that project finished today, I will give it a go, and try setting them to inputs, and put them back ( and reinitialise ) on waking.

I have an emitter follower from one of the pins to feed the backlight, contrast pot, and the transmitter, so the sleep current should be just the 328 in sleep.

This display takes about 1 mA from the batteries .

I tried making all 6 lines inputs before sleep mode, no different, I even tried making them output LOW, but they still have voltage on them at sleep - all of them this time , but not 5v, varies from 1 to 2.5 v ?.....

I will see if I can see anything in the library, but its usually a bit complicated for me to fiddle with...

Right, for some reason, if I move the setting of the LCD data lines to output LOW before the

attachInterrupt(1, pin3Interrupt, FALLING);

it works fine, all the outputs stay low during sleep, and my current is down to 20 microamps.

With 500mAh batteries that should last about the same as the shelf life of the batteries :slight_smile: