Converting current sink to current source?

Hi,
I'm trying to control 40 or so watts of LED using the mean well LDD-H driver.
http://www.meanwell.com/search/LDD-H/LDD-H-spec.pdf

It works fine but the PWM from the uno or duemilanove's resolution isn't high enough so I'm using the Texas Instruments TLC5940, Arduino Playground - HomePage to get 12 bits.

The setup here works with a simple LED, http://tlc5940arduino.googlecode.com/svn/wiki/images/breadboard-arduino-tlc5940.png

But it turns out the TLC5940's channel PWM is a current sink and the LDD-H requires a current source. Is there a way to make the TLC5940's signal a current source with an added component?

thanks.

EDIT: All that complicated transistor stuff removed, I think a 1K? pullup resistor between VCC and the TLC5940 output / Meanwell input is all you need?

Disclaimer: I'm not an EE, just a newbie that knows enough to be dangerous.

You can configure timer1 for upto 16 bit resolution, no need for the TLC5940 if you
can connect pins 9 or 10 to the Meanwell driver.

For instance with this setup you'll get 12 bit PWM at 3.9kHz:

void setup ()
{
  TCCR1A = 0 ;
  TCCR1B = 0 ;
  ICR1 = 4095 ;
  TCNT1 = 0 ;
  TCCR1A = 0xA2 ;
  TCCR1B = 0x19 ;
  pinMode (9, OUTPUT) ;
}

void loop ()
{
  ... determine pwm level in pwm_value (0 .. 4095)
  OCR1A = pwm_value ; // update pin 9's duty cycle
  ...
}

Thanks.
Using a combo of pnp transistor and a pull down resistor works.
And using timer1 works as well. It's not as smooth lighting transition as using the TLC5940.

If I need more than 2 channels, I'd probably use a 12bit I2C pwm driver from adafruit.

Won't the driver from adafruit have the same pulldown issue as the TLC5940?

CrossRoads:
Won't the driver from adafruit have the same pulldown issue as the TLC5940?

Oh, you're right. It uses the TLC5947, also a current sink. Will have to find a current source.

mistergreen:
And using timer1 works as well. It's not as smooth lighting transition as using the TLC5940.

Were you using it in 16-bit mode?

tylernt:

mistergreen:
And using timer1 works as well. It's not as smooth lighting transition as using the TLC5940.

Were you using it in 16-bit mode?

12 bit. It's good enough. The transition is only noticeable in low brightness.

The transition is only noticeable in low brightness.

That makes sense, as the DAC control is linear whereas your eye's response is nonlinear and ratiometric, more able to detect differences in intensity at lower light levels.

Think about it - 1 bit change in brightness at 1000 bits out of 4096 is a lot lower change than 1 bit change out of, say, 10 bits out of 4096.

hmmm, I'm running the timer1 program again and the transition is smooth in low light. I must had set the transition step greater than 1.