I haven't gotten to messing around with the shield (or better yet, assembling it!), but I've poked around in the code. And as your site says, you can't change the RGB precisely - you can only choose certain values. (I'm drooling at this video because just because of that precise control: http://www.youtube.com/watch?v=8ZDXuR6EIi4)
That said, is there any way software-wise I could do that? If not, since I haven't assembled it yet - is there any way I could modify it to enable PWM control?
Finally, are you guys planning to offer a new version of your shield that would enable PWM control? (And maybe, just maybe, could I exchange this old one for the new version if you do have a new one? )
RGB LCD Shield - PWM control?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88091
- Joined: Sat Feb 07, 2009 10:11 am
Re: RGB LCD Shield - PWM control?
You can do PWM on the RGB by running jumpers from the RG & B cathodes to 3 unused PWM pins.
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: RGB LCD Shield - PWM control?
we have a USB/Serial backpack for the LCDs that can do full PWM control
- alberth
- Posts: 7
- Joined: Wed Apr 11, 2012 11:56 am
Re: RGB LCD Shield - PWM control?
adafruit_support: Which side is the cathode side? The PCB has no markings for this. Also, since you did say to connect it to the unused PWM pins, would it be possible to simply solder wires to three of the header pins? (Hence no wire connecting - I like the small profile of shields.)
adafruit: I've looked on your site and have searched many times, but it seems that you only offer the USB/Serial backpack inside the pack. I think I'll stick with the PWM connection solution for now.
Another product question: Will you guys offer a shield kit for the bigger 20x4 RGB LCDs anytime soon? (Again, I love the small profile of shields!)
adafruit: I've looked on your site and have searched many times, but it seems that you only offer the USB/Serial backpack inside the pack. I think I'll stick with the PWM connection solution for now.
Another product question: Will you guys offer a shield kit for the bigger 20x4 RGB LCDs anytime soon? (Again, I love the small profile of shields!)
- adafruit_support_bill
- Posts: 88091
- Joined: Sat Feb 07, 2009 10:11 am
Re: RGB LCD Shield - PWM control?
That is the easiest way. They are pins 16, 17 & 18 as shown on this diagram.would it be possible to simply solder wires to three of the header pins?
- alberth
- Posts: 7
- Joined: Wed Apr 11, 2012 11:56 am
Re: RGB LCD Shield - PWM control?
I've soldered little metal "jumpers" from LCD pins 16, 17, and 18 to the top of the shield header pins 6, 5, and 3, respectively. I tried to then write PWM values from 0-255 to those pins at the same time (that is, 255 to pins 6, 5, 3) and I get a weird redish/blueish color instead of white. (Using the regular library to set the backlight to white works.)
Here's my dumbed down code to test the backlight setting. Note that I've removed any references to your library to prevent any initialization on the LCD that may prevent this from working.
Is this a software problem or a hardware one?
Here's my dumbed down code to test the backlight setting. Note that I've removed any references to your library to prevent any initialization on the LCD that may prevent this from working.
Code: Select all
// Test for the RGB backlight control via PWM
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
void setup() {
// Debugging output
Serial.begin(9600);
// Init backlight PWM outputs!
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
// Oddly enough, 0 = full brightness
analogWrite(3, 0);
analogWrite(5, 0);
analogWrite(6, 0);
Serial.println("Displaying full brightness (white)");
delay(2000);
}
void loop() {
analogWrite(3, brightness);
analogWrite(5, brightness);
analogWrite(6, brightness);
Serial.print("Setting overall brightness to ");
Serial.println(brightness);
brightness = brightness + fadeAmount;
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
delay(30);
}
- alberth
- Posts: 7
- Joined: Wed Apr 11, 2012 11:56 am
Re: RGB LCD Shield - PWM control?
I should also mention that I found out that setting it to 0 makes it display full brightness, not 255, as indicated in a code comment.
- adafruit_support_bill
- Posts: 88091
- Joined: Sat Feb 07, 2009 10:11 am
Re: RGB LCD Shield - PWM control?
If you connect to the PWM pins you have to cut the RGB connections to the shield.
- alberth
- Posts: 7
- Joined: Wed Apr 11, 2012 11:56 am
Re: RGB LCD Shield - PWM control?
Oh... So I can't use them simultaneously? I really like the feature (or non-feature) of having the LCD on when the Arduino is resetting...
Is there any way, with software or hardware modification, I can use both PWM and the shield's control of the LED backlight?
If not, do I disconnect the RGB connections by removing the resistor?
Also, is there any way of maintaining the backlight color through resets and such, like with the current shield?
Is there any way, with software or hardware modification, I can use both PWM and the shield's control of the LED backlight?
If not, do I disconnect the RGB connections by removing the resistor?
Also, is there any way of maintaining the backlight color through resets and such, like with the current shield?
- adafruit_support_bill
- Posts: 88091
- Joined: Sat Feb 07, 2009 10:11 am
Re: RGB LCD Shield - PWM control?
It is probably possible to modify the library to set those pins on the i2c port expander to input mode when you want to use PWM pins. And when you want to use the shield backlight control, you could do the same for the PWM pins.Is there any way, with software or hardware modification, I can use both PWM and the shield's control of the LED backlight?
- alberth
- Posts: 7
- Joined: Wed Apr 11, 2012 11:56 am
Re: RGB LCD Shield - PWM control?
Actually, I don't think that test code I've used touches the I/O expander at all. From looking at the library code, you must call lcd.begin() to make it start working.
The I2C expander doesn't even start until that is called.
That said, I also added this bit of code into Adafruit_RGBLCDShield.cpp (and the prototypes in its header):
I call lcd.disableBacklight() to set those pins to INPUT, but it still fails.
It still gives me a redish/pinkish hue with high brightness.
The I2C expander doesn't even start until that is called.
That said, I also added this bit of code into Adafruit_RGBLCDShield.cpp (and the prototypes in its header):
Code: Select all
/* ADDED COMMANDS FOR ENABLING/DISABLING i2c BACKLIGHT CONTROL
* (in favor of PWM control)
*/
void Adafruit_RGBLCDShield::enableBacklight()
{
_i2c.pinMode(8, OUTPUT);
_i2c.pinMode(6, OUTPUT);
_i2c.pinMode(7, OUTPUT);
}
void Adafruit_RGBLCDShield::disableBacklight()
{
_i2c.pinMode(8, INPUT);
_i2c.pinMode(6, INPUT);
_i2c.pinMode(7, INPUT);
}
It still gives me a redish/pinkish hue with high brightness.
- adafruit_support_bill
- Posts: 88091
- Joined: Sat Feb 07, 2009 10:11 am
Re: RGB LCD Shield - PWM control?
You might try reducing the PWM cycle on the Red line - or add a ~100 ohm resistor in series. The red led is more efficient than the blue or green and tends to overpower them.a redish/pinkish hue with high brightness.
Please be positive and constructive with your questions and comments.