RGB LCD Shield - PWM control?

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

RGB LCD Shield - PWM control?

Postby alberth » Sun Apr 22, 2012 6:27 pm

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? :D)
alberth
 
Posts: 6
Joined: Wed Apr 11, 2012 10:56 am

Re: RGB LCD Shield - PWM control?

Postby adafruit_support_bill » Mon Apr 23, 2012 5:03 am

You can do PWM on the RGB by running jumpers from the RG & B cathodes to 3 unused PWM pins.
User avatar
adafruit_support_bill
 
Posts: 16055
Joined: Sat Feb 07, 2009 9:11 am

Re: RGB LCD Shield - PWM control?

Postby adafruit » Mon Apr 23, 2012 10:32 am

we have a USB/Serial backpack for the LCDs that can do full PWM control
User avatar
adafruit
 
Posts: 10491
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: RGB LCD Shield - PWM control?

Postby alberth » Mon Apr 23, 2012 9:25 pm

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!)
alberth
 
Posts: 6
Joined: Wed Apr 11, 2012 10:56 am

Re: RGB LCD Shield - PWM control?

Postby adafruit_support_bill » Tue Apr 24, 2012 4:35 am

would it be possible to simply solder wires to three of the header pins?

That is the easiest way. They are pins 16, 17 & 18 as shown on this diagram.
User avatar
adafruit_support_bill
 
Posts: 16055
Joined: Sat Feb 07, 2009 9:11 am

Re: RGB LCD Shield - PWM control?

Postby alberth » Sat Apr 28, 2012 6:50 am

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.
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);
}


Is this a software problem or a hardware one?
alberth
 
Posts: 6
Joined: Wed Apr 11, 2012 10:56 am

Re: RGB LCD Shield - PWM control?

Postby alberth » Sat Apr 28, 2012 6:51 am

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.
alberth
 
Posts: 6
Joined: Wed Apr 11, 2012 10:56 am

Re: RGB LCD Shield - PWM control?

Postby adafruit_support_bill » Sat Apr 28, 2012 9:06 am

If you connect to the PWM pins you have to cut the RGB connections to the shield.
User avatar
adafruit_support_bill
 
Posts: 16055
Joined: Sat Feb 07, 2009 9:11 am

Re: RGB LCD Shield - PWM control?

Postby alberth » Sat Apr 28, 2012 9:41 am

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?
alberth
 
Posts: 6
Joined: Wed Apr 11, 2012 10:56 am

Re: RGB LCD Shield - PWM control?

Postby adafruit_support_bill » Sat Apr 28, 2012 11:23 am

Is there any way, with software or hardware modification, I can use both PWM and the shield's control of the LED backlight?

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.
User avatar
adafruit_support_bill
 
Posts: 16055
Joined: Sat Feb 07, 2009 9:11 am

Re: RGB LCD Shield - PWM control?

Postby alberth » Sat Apr 28, 2012 1:05 pm

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):
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);
}


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.
alberth
 
Posts: 6
Joined: Wed Apr 11, 2012 10:56 am

Re: RGB LCD Shield - PWM control?

Postby adafruit_support_bill » Sat Apr 28, 2012 1:59 pm

a redish/pinkish hue with high brightness.

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.
User avatar
adafruit_support_bill
 
Posts: 16055
Joined: Sat Feb 07, 2009 9:11 am


Return to Arduino Shields from Adafruit

Who is online

Users browsing this forum: No registered users and 4 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [103]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[109]
 
Wireless[14]
Cables[61]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]