LCD backlight brightness control (TM12864L-2)

Hello everyone. That's my first post here.

I have Arduino Mega 1280 with 128x64 LCD (model TM12864L-2). Everything works perfectly, but I would like to control backlight brightness in my program, whereas in standard wiring it's always on...

Unfortunately I don't know how much current it takes...

Does any one know if it's safe to connect backlight pin directly to Arduino PWM out (with resistor of course)?

Greetings

It is not likely that the backlight can be powered directly from an Arduino pin, as backlights generally can draw >100mA of current, while Arduino pins should be limited to ~20mA or less (40mA absolute maximum).

Here is a recommended circuit for dimming a backlight:

http://ruggedcircuits.com/html/circuit__30.html

--
The MegaRAM shield: add 128 kilobytes of external RAM to your Arduino Mega/Mega2560

Thank you very much.

That ruggedcircuits.com is very cool. Do you know similar websites with even more circuits?

Here's a simpler circuit for PWMing an LCD backlight. The resistor R is needed for all the LCD displays I have used (it sets the current through the LED backlight), but there may be some displays that are designed to work directly from 5v without a series resistor.

Thanks. I think your circuit will be good enough for me :slight_smile:

That LCD I have, came to me already connected to Arduino (bought on ebay), and it's connected without resistor. But I think it should be, so I'll add 100 Ohms resistor, to be sure that's everything OK.

Hello again,

Backlight control works perfectly (I made circuit like dc42), but it interfere with IR receiver. I have IR receiver like this: IR Receiver Diode - TSOP38238 - SEN-10266 - SparkFun Electronics

When backlight is set to 255 there are no interferences, I can control my Arduino shooting from the remote almost at any direction (aiming the wall, ceiling, floor etc.).
Unfortunately when I dim the backlight, the remote works only from close range, and I have to aim directly to the receiver :frowning: ...

Any idea, what can I do with this?

T-1000:
When backlight is set to 255 there are no interferences, I can control my Arduino shooting from the remote almost at any direction (aiming the wall, ceiling, floor etc.).
Unfortunately when I dim the backlight, the remote works only from close range, and I have to aim directly to the receiver :frowning: ...

Any idea, what can I do with this?

I'm glad it worked for you. You could try changing the PWM frequency on that pin, see http://www.arduino.cc/playground/Code/PwmFrequency.

Hello T-1000.

I have to Arduino Mega 1280 with 128x64 LCD (model TM12864L-2) but I don't know how to to connect the LCD to the Arduino Mega 1280.

Can you help me or to send me link ?

Thank you.

Arduino Playground - LCD12864 may be useful.

I know that IR library uses one timer so it may interfere with PWM. If you happen to have use the PWM on your back light whose timer is also used by the IR library, you are heading towards a crash.

"In more detail, the receiver's interrupt code is called every time the TIMER1 overflows, which is set to happen after 50 microseconds."

Make sure you are not using a PWM pin that depends on the TIMER1. I don't know where to find that info.

@dc42, @liudr - thank you, I'll try to play with PWM frequency and timers. IR library is in fact using timers, so it's very probable, that this causes problems, I didn't think about it...

@930b - go to Arduino Playground - GLCDks0108 there is explained everything. This LCD is pinout B.