TLC5940 + high power led

i have 20 high power leds, each one powered by following constant current circuit:


now i want to dim these leds by using two TLC5940 (connected to an arduino). i already connected the leds to the TLCs, but the dimming doesn't work

i can set the TLC outputs to 0 and the leds are off, i can set the outputs to 4095 and the leds are on, but there is nothing in between.

if i set the outputs to 1, it's the same brightness as with 4095

does someone know if i have to modify the tlc_config.h of the arduino TLC library to get this thing working? or do i have to make other changes?

here the default library settings:

/* ------------------------ START EDITING HERE ----------------------------- */

/** Number of TLCs daisy-chained.  To daisy-chain, attach the SOUT (TLC pin 17)
    of the first TLC to the SIN (TLC pin 26) of the next.  The rest of the pins
    are attached normally.
    \note Each TLC needs it's own IREF resistor */
#define NUM_TLCS    1

/** Determines how data should be transfered to the TLCs.  Bit-banging can use
    any two i/o pins, but the hardware SPI is faster.
    - Bit-Bang = TLC_BITBANG
    - Hardware SPI = TLC_SPI (default) */
#define DATA_TRANSFER_MODE    TLC_SPI

/* This include is down here because the files it includes needs the data
   transfer mode */
#include "pinouts/chip_includes.h"

/* Set DATA_TRANSFER_MODE to TLC_BITBANG and change the pins below if you need
   to use different pins for sin and sclk.  The defaults are defined in
   pinouts/ATmega_xx8.h for most Arduino's. */

#if DATA_TRANSFER_MODE == TLC_BITBANG
/** SIN (TLC pin 26) */
#define SIN_PIN        DEFAULT_BB_SIN_PIN
#define SIN_PORT       DEFAULT_BB_SIN_PORT
#define SIN_DDR        DEFAULT_BB_SIN_DDR
/** SCLK (TLC pin 25) */
#define SCLK_PIN       DEFAULT_BB_SCLK_PIN
#define SCLK_PORT      DEFAULT_BB_SCLK_PORT
#define SCLK_DDR       DEFAULT_BB_SCLK_DDR
#endif


/** If more than 16 TLCs are daisy-chained, the channel type has to be uint16_t.
    Default is uint8_t, which supports up to 16 TLCs. */
#define TLC_CHANNEL_TYPE    uint8_t

/** Determines how long each PWM period should be, in clocks.
    \f$\displaystyle f_{PWM} = \frac{f_{osc}}{2 * TLC\_PWM\_PERIOD} Hz \f$
    \f$\displaystyle TLC\_PWM\_PERIOD = \frac{f_{osc}}{2 * f_{PWM}} \f$
    This is related to TLC_GSCLK_PERIOD:
    \f$\displaystyle TLC\_PWM\_PERIOD =
       \frac{(TLC\_GSCLK\_PERIOD + 1) * 4096}{2} \f$
    \note The default of 8192 means the PWM frequency is 976.5625Hz */
#define TLC_PWM_PERIOD    8192

/** Determines how long each period GSCLK is.
    This is related to TLC_PWM_PERIOD:
    \f$\displaystyle TLC\_GSCLK\_PERIOD =
       \frac{2 * TLC\_PWM\_PERIOD}{4096} - 1 \f$
    \note Default is 3 */
#define TLC_GSCLK_PERIOD    3

/** Enables/disables VPRG (TLC pin 27) functionality.  If you need to set dot
    correction data, this needs to be enabled.
    - 0 VPRG is not connected.  <em>TLC pin 27 must be grounded!</em> (default)
    - 1 VPRG is connected
    \note VPRG to GND inputs grayscale data, VPRG to Vcc inputs dot-correction
          data */
#define VPRG_ENABLED    0

/** Enables/disables XERR (TLC pin 16) functionality to check for shorted/broken
    LEDs
    - 0 XERR is not connected (default)
    - 1 XERR is connected
    \note XERR is active low */
#define XERR_ENABLED    0

/*  You can change the VPRG and XERR pins freely.  The defaults are defined in
    the chip-specific pinouts:  see pinouts/ATmega_xx8.h for most Arduino's. */

#if     VPRG_ENABLED
/** VPRG (TLC pin 27) */
#define VPRG_PIN        DEFAULT_VPRG_PIN
#define VPRG_PORT       DEFAULT_VPRG_PORT
#define VPRG_DDR        DEFAULT_VPRG_DDR
#endif

#if     XERR_ENABLED
/** XERR (TLC pin 16) */
#define XERR_PIN        DEFAULT_XERR_PIN
#define XERR_PORT       DEFAULT_XERR_PORT
#define XERR_DDR        DEFAULT_XERR_DDR
#define XERR_PINS       DEFAULT_XERR_PINS
#endif

/* ------------------------- STOP EDITING HERE ----------------------------- */

So how have you wired up your current driver to the TLC?

You need pull up resistors on the TLC outputs and then the PWM input needs to be wired to them.

at the moment it's like this:

TLC Output ---> constant current circuit PWM Input (in the png of the circuit from above the PIN is named COMP)

you mean it should look like this:

TLC Output ---> pull up resistor ---> constant current circuit PWM input

right?

what resistor should i use? how can i calculate which one i need ... or should i just try some out?

by the way if i connect like this:

arduino PWM pin ---> constant current PWM input

then i can dim with analogwrite, works pretty good ... but why not with the TLC?

i just tried a resistor (1k, 10k, 100k) between TLC and constant current driver but it didn't change anything ;(

No it should be:-
TLC Output ---> constant current circuit PWM input
pull up resistor ---> +5V

The value matters little as the current will be set with the current setting resistor on the TLC.

ok thanks, i tried it out.

dimming works a little now, but the led is flickering as hell (except when i set to 4095)

got rid of the flickering, changed some resistor values at the TLC inputs