Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

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.

share|improve this question
    
Whether this can even be done is entirely dependent on how you have the LCD screen connected. The HD44780 command set has no provisions for backlight control. You would need to add some external mechanism of your own for controlling the backlight. –  Connor Wolf Mar 27 at 3:24
add comment

2 Answers 2

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.

share|improve this answer
2  
Sleeping the MCU is pointless, since the rest of the parts on a common uno consume so much power it doesn't provide any meaningful reduction in overall consumption.. –  Connor Wolf Mar 27 at 3:25
1  
Really, if you want to actually get an arduino to be low-power, you need an arduino pro (or any other board with no onboard usb-serial), and then you'd need to put a regulator with decently low quiescent current draw on it. It's a bit involved. –  Connor Wolf Mar 27 at 3:28
    
Absolutely. Someone that wants to conserve every last bit of energy will design their own board and spec their components out accordingly. –  Ignacio Vazquez-Abrams Mar 27 at 3:30
    
Yep, but my point is that you can't even get meaningfully relevant power conservation on most any arduino boards, since even their vregs have horrible quiescent current (2 ma +, IIRC). Then there is the FTDI/ATmega16U2, which you can't turn off, etc.... –  Connor Wolf Mar 27 at 3:31
    
@Mr.Floppy: IOW, pick something else. Something with fewer pieces. –  Ignacio Vazquez-Abrams Mar 27 at 3:48
add comment

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.

LCD Brightness control

share|improve this answer
    
+1 for the schematic, although I'm not sure why there are two resistors (R7 & R8). –  Madivad Mar 28 at 12:27
    
@Madivad - I'm guessing it's to increase maximum dissipated power that the resistors can take. The two 68R resistors in parallel result in an equivalent 34R resistence but doubles the maximum power that can be dissipated through a single resistor. I don't remember what resistors were recommended by Freetronics, but in my case, I've used two 1/4W 68R resistors and the board is working ok. Also, I suppose that 68R resistors are more common. That certainly holds true for me as I have plenty of 68R resistors in my bins and no 33R ones. –  Ricardo Mar 28 at 12:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.