Go Down

Topic: TLC5947 flickering - and RGB LED control (how to?) (Read 2277 times) previous topic - next topic

Anon2014

Sep 01, 2014, 01:08 pm Last Edit: Sep 01, 2014, 01:12 pm by Anon2014 Reason: 1
Hello,

I have two questions for this module, lets begin with the first.

recently I´ve received this module: http://www.adafruit.com/products/1429
Set everything up according to the datasheet here: http://www.adafruit.com/datasheets/tlc5947.pdf
On a experiment board.

The module is powered by the 5V output and GND on the arduino. The "Arduino Nano" is powered from the USB Port on my PC.
The LED´s are powered by a 3V/300mA universal power supply (not a switching power supply).

Each GND is connected to the common GND "rail".

All 24 Channels are connected to a "standard" white LED where I don´t have any datasheet for but the power supply is something around 3V or 3,2V and 20mA. Now after some testing I noticed a "flickering" of the LED´s.
This flickering does occur when a programm is running or when I upload a new code to the arduino.

Also tried to connect some capacitors already as seen in the Datasheet, but this seems to not help really much.
Ideas?



The second problem:

My original intention was to use this module to extend the PWM ports of the arduino as I need to control larger number of RGB LED´s for some project in my car.

I bought some "PLCC-2 SMD LEDs 3528" from Ebay (I will put a link to the datasheet as soon as I get it) which powersupply should be:

- Voltage: RED max. 2,4V / GREEN&BLUE max. 3,5V
- Current: ca. 30mA

Now the problem is, that this LED´s are not "plug and play" as you see the voltage for the RED Chip is less that the GREEN/BLUE Chip. So which circuit setup would be good to overcome this issue.

To "Put 2,4V to all" is not the solution here, the GREEN&BLUE ones need over 3V there is even a big brightness difference between 3V - 3,5V

Additionally I should probably anticipate the rather "rough" power supply in the car.

Any help would be appreciated.



AJITnayak

AMPS

Anon2014

#2
Sep 01, 2014, 03:20 pm Last Edit: Sep 01, 2014, 03:24 pm by Anon2014 Reason: 1
Original TLC 5947 test Code. (only with modified pin Nr)

You can observe the flickering here too.

Regarding the code for the car project, there is no code yet, as I have first to figure out how to do it, as there should be some sensor readings too. I will open another thread for this though.

Code: [Select]
/***************************************************
 This is an example for our Adafruit 24-channel PWM/LED driver

 Pick one up today in the adafruit shop!
 ------> http://www.adafruit.com/products/1429

 These drivers uses SPI to communicate, 3 pins are required to  
 interface: Data, Clock and Latch. The boards are chainable

 Adafruit invests time and resources providing this open source code,
 please support Adafruit and open-source hardware by purchasing
 products from Adafruit!

 Written by Limor Fried/Ladyada for Adafruit Industries.  
 BSD license, all text above must be included in any redistribution
****************************************************/

#include "Adafruit_TLC5947.h"

// How many boards do you have chained?
#define NUM_TLC5974 1

#define data   8
#define clock   9
#define latch   10
#define oe  -1  // set to -1 to not use the enable pin (its optional)

Adafruit_TLC5947 tlc = Adafruit_TLC5947(NUM_TLC5974, clock, data, latch);

void setup() {
 Serial.begin(9600);
 
 Serial.println("TLC5974 test");
 tlc.begin();
 if (oe >= 0) {
   pinMode(oe, OUTPUT);
   digitalWrite(oe, LOW);
 }
}

void loop() {
 colorWipe(4095, 0, 0, 100); // "Red" (depending on your LED wiring)
 delay(200);
 colorWipe(0, 4095, 0, 100); // "Green" (depending on your LED wiring)
 delay(200);
 colorWipe(0, 0, 4095, 100); // "Blue" (depending on your LED wiring)
 delay(200);
 rainbowCycle(10);
}


// Fill the dots one after the other with a color
void colorWipe(uint16_t r, uint16_t g, uint16_t b, uint8_t wait) {
 for(uint16_t i=0; i<8*NUM_TLC5974; i++) {
     tlc.setLED(i, r, g, b);
     tlc.write();
     delay(wait);
 }
}

// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
 uint32_t i, j;

 for(j=0; j<4096; j++) { // 1 cycle of all colors on wheel
   for(i=0; i< 8*NUM_TLC5974; i++) {
     Wheel(i, ((i * 4096 / (8*NUM_TLC5974)) + j) & 4095);
   }
   tlc.write();
   delay(wait);
 }
}

// Input a value 0 to 4095 to get a color value.
// The colours are a transition r - g - b - back to r.
void Wheel(uint8_t ledn, uint16_t WheelPos) {
 if(WheelPos < 1365) {
   tlc.setLED(ledn, 3*WheelPos, 4095 - 3*WheelPos, 0);
 } else if(WheelPos < 2731) {
   WheelPos -= 1365;
   tlc.setLED(ledn, 4095 - 3*WheelPos, 0, 3*WheelPos);
 } else {
   WheelPos -= 2731;
   tlc.setLED(ledn, 0, 3*WheelPos, 4095 - 3*WheelPos);
 }
}

Go Up