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)?
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:
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
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.
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 ...
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 ...
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...