TLC5947: disable output at startup AND prevent flickering

I read a while back that to prevent flickering while updating the Adafruit TCL5947 and to permit smooth fading, the /OE and LAT pins should simply be tied together. I can confirm that this does work perfectly, but there is another issue. I would like to make sure that the output of the 5947 is disabled at power up. With the pins connected, all of the LEDs flash on full for about a second from powerup until initialized in setup().

My first attempt at a solution (attached schematic) was to hold the 5947 /OE pin high with a PNP transistor until setup() sets Arduino pin 7 to HIGH which switches the transistor off. The idea was to disconnect OE from +5v, allowing it to then follow the LAT pin to prevent flicker.

It all works as expected except for there is now a very quick, bright flash as soon as the Arduino pin 7 goes high. I have confirmed that this has to do with the LAT pin being tied to OE. With OE straight to the transistor’s emitter and LAT going straight to Arduino pin 6, the output disabling on startup works as expected, but the fade/flicker issue is back in the 5947.

Does anyone know of a different solution? It’s fine if it requires additional components. I think that what I am trying to accomplish is to hold the /OE pin high at powerup, then switch it over to being “connected” to the latch pin during setup().

#include "Adafruit_TLC5947.h"

#define NUM_TLC5947 1

#define data 4
#define clock 5
#define latch 6
#define oe 7

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

void setup() {
  // Note that the output-enable pin of the 5947 is held high at power up
  tlc.begin();
  
  // make sure all outputs are initialized to 0
  for (uint8_t i = 0; i < 24; i++) {
    tlc.setPWM(i, 0);
  }
  tlc.write();
  
  // wait just in case
  delay(100);
  
  // enable output - inverted since we're hitting the base of a PNP transistor. HIGH disconnects OE from +5v
  pinMode(oe, OUTPUT);
  digitalWrite(oe, HIGH);
  
  // another just-in-case hail-mary delay
  delay(100);
  
  // TEST: fade in from dark.
  for (uint16_t j = 0; j < 4096; j+=10) {
    for (uint8_t i = 0; i < 24; i++) {
      tlc.setPWM(i, j);
    }
    tlc.write();
    delay(1);
  }
}

I figured it out. All I had to do was to add a diode between /OE and LAT on the 5947 - works perfectly now. The diode prevents the voltage holding the output enable high from also hitting the latch, while enabling control voltage to still come from the Arduino.

1 Like

I think you can simplify this even further. Replace your PNP with a 10K pullup resistor. This will keep LAT and /OE high at power on. Then when begin() happens, pin 6 is turned into an output and driven low.

I don’t think it is a good idea to connect the Arduino pin directly to the transistor base. :face_with_raised_eyebrow:

Thanks - I actually changed that already… there’s now a 10k resistor in there.

I tried that initially, but with the pull-up resistor configuration, all of the LEDs connected to the 5947 outputs always flash for a split second at powerup. Don’t ask me why putting a transistor in there keeps that from happening, but it does. :man_shrugging: