I'm making a prototype home automation gizmo with a brand new Arduino Uno (Rev. 3), a Sainsmart LCD2004 I2C display, and a three button interface menu system.
I want to be able to adjust backlighting of the LCD in software besides just on and off. Maybe the best idea would be to have it automatically dim in low lighting via a light sensor, but for now I'd like to just give the user an option to cycle through choices of "high" --> "medium" --> "low" --> "off" --> "high" (etc.), and to have it dim after 5 minutes of inactivity.
I spent several hours just getting the LCD to work-- AND by the way: MANY thanks to the advice of many who've gone through this lonely valley of hell before me (sellers not really supporting their products, as fm says). So now, after many hours of scouring the forums and elsewhere for hints on backlighting, I find myself asking for more specific advice.
Does anyone know how I control backlighting via software? Is it a simple undocumented command? I hope so.
I've read some old posts about how you need to connect the backlight via an NPN transistor to an analog pin and vary the voltage, so I am starting to think this is a hardware and software problem...
Here's a picture of an identical I2C "backpack" board. On the right are the four pins for I2C, power and ground. On the left are two pins connected with a slip-on jumper. I pulled the jumper off on mine and saw the backlight go off, so I assume this is where I would connect the transistor. The upper pin is connected via a trace to pin 15 on the LCD board, and the lower pin is connected to the bottom left pin of the PCF8574T IC. I found a 2N4401 NPN transistor from dipmicro. Would that work? How do I connect it?
Thanks in advance for your help. Sorry for being such a total newbie, and for asking several questions in one post. This is my first post, my first Arduino project, and I am excited about joining this supportive community of DIYers.