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.

  • 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 '14 at 3:24

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

  • +1 for the schematic, although I'm not sure why there are two resistors (R7 & R8). – Madivad Mar 28 '14 at 12:27
  • 1
    @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 '14 at 12:42
  • I know this is "old", but hope someone will notice this... I'm having trouble understanding how the transistor connects (as i'm not familiar with the icon above for the transistor), where does the E, B, C connect to? – warath-coder Jun 21 '15 at 0:30
  • 1
    @wara - That's a Field Effect Transistor (FET), not a BJT. So you'll be looking to connect its drain, source and gate. In any case, you'll get better help by asking a separate question, linking to this one. – Ricardo Jun 21 '15 at 0:47

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.

  • 3
    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 '14 at 3:25
  • 2
    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 '14 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 '14 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 '14 at 3:31
  • @Mr.Floppy: IOW, pick something else. Something with fewer pieces. – Ignacio Vazquez-Abrams Mar 27 '14 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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