I am finishing up a project- an LED game alarm clock. Seeing as this is a clock, I need to have a way to conserve power, which right now my Uno R3+ is eating up like a politician. My question is, how do I turn the screen off, or turn the back-light off using software only on a Hitachi HD44780 16x2 LCD screen? Or how do I set a sleep mode on one component? The way I plan on turning it off is with an ultrasonic range finder, if I get close it turns on the screen. If anything I say doesn't make sense, ask me to clarify, I'm in a bit of a rush.
2 Answers
Place a transistor in series with a 33R resistor between the LCD pin 16 (backlight ground) and GND and switch the transistor on and off with a digital pin. That way you'll be able to turn the backlight on and off.
You can have a finer control over brightness if you put a PWM pulse on said pin. Just call analogWrite(D3, value) where value is the desired brightness.
The schematics is below. It's from Freetronics 16x2 LCD SHield.

- 3,390
- 2
- 26
- 55
Instead of tying the backlight directly to V+ and GND, connect it to a PWM pin (you may need to use a separate driver if the pin cannot source/sink enough current). This will allow you to control the brightness via analogWrite().
Turn the LCD display off (LiquidCrystal::noDisplay()) when not actively in use. The contents will remain in memory but the LCD segments will not be driven.
Set the various bits in the PRR register to disable any peripherals not it use.
And don't forget to sleep the CPU when it doesn't need to run. See the "Power Management and Sleep Modes" section of the datasheet for more information about this and the PRR register, as well as the <avr/sleep.h> documentation for AVR Libc.
- 17,733
- 1
- 28
- 32