chipKIT® Development Platform

Inspired by Arduino™

16 Channel constant current sink

Created Fri, 20 Dec 2013 20:25:06 +0000 by majenko


Fri, 20 Dec 2013 20:25:06 +0000

I have knocked up a couple of surplus boards with STP16CP05 16-channel constant current sink LED driver shift registers on them. They're configured for 20mA sink at the moment, but they can be modified (change a resistor) to up to 100mA per channel - great for driving lots of really bright LEDs.


It uses the same shift register protocol as the 74HC575 shift registers, but you don't need to worry about calculating resistors and such - as it's constant current, resistors aren't needed.

You can run the board itself off anything between 3V and 7V, so perfect for an chipKIT at 3.3V or 5V. If you only want 1 LED per channel you can just drive them direct from the convenient 16 pin headers (outer row = anode = Vcc, inner row = cathode = switched constant current sink). However, the LED sinks can cope with up to 30V, so you could chain multiple LEDs together in series and run them from a higher voltage!

You can also chain multiple boards together, just like with the 74HC575 shift register - data in and data out ports are provided to simplify it for you.

Also, on the chipKIT, because it is so powerful, you can update the chips so fast (they are rated at up to 30MHz) you can easily create 8-bit PWM with multiple boards chained (I'll be releasing a library shortly to do it for you).

As I say this is just a few surplus ones, so grab one while you can. However, if people like them I will produce more of them.


Sat, 21 Dec 2013 06:18:56 +0000

It looks like a good board for constant current driving outputs, but for a PWM option a TLC5940 may be a better choice. They are a 16 channel configurable constant current that can handle up to 18V and 120mA, with a 12 bit resolution. It would only require two more pins and less processing time.


Sat, 21 Dec 2013 08:48:10 +0000

I know, but they're also double the price and the external clock and blanking is a real pig to program for.


Sat, 21 Dec 2013 15:47:01 +0000

Oh, I didn't know about the price issue, I had a few samples shipped to try them out for a project. That is good to know, as price can play a big factor on large projects.

As far as the clock and blanking, I just used 2 output compare pins to handle it and only update the the TLC through SPI as needed. The only added work is the bit packing since it works on a cumbersome 12-bit word per pin, and then coordinating the updating on a blank pulse.


Sat, 21 Dec 2013 19:21:53 +0000

They're still not "expensive", considering what you get, but the beauty of these is they work just the same as a '575 shift register, so all the n00bs on the Arduino forum can use them for basic on-off, whereas we more advanced users with proper hardware ;) can get them to do even more...

I am working on an animation library to go with it now as well. Script animations and have multiple animations running concurrently:

#include <ULK.h>
#include <Animation.h>

#define PAIR(X) (X) >> 8, (X) & 0xFF

uint8_t testAnim1[] = {
	Animation::GROUP, 200, 3, 6, 7, 8,
	Animation::SET, 200, 255,
	Animation::DELAY, PAIR(10),
	Animation::SET, 200, 0,
	Animation::DELAY, PAIR(990),

uint8_t testAnim2[] = {
	Animation::GROUP, 200, 3, 9, 10, 11,
	Animation::SET, 200, 255,
	Animation::DELAY, PAIR(10),
	Animation::SET, 200, 0,
	Animation::DELAY, PAIR(481),

uint8_t testAnim3[] = {
	Animation::GROUP, 200, 3, 0, 1, 2,
	Animation::GROUP, 201, 2, 3, 4,
	Animation::SET, 200, 255,
	Animation::SET, 201, 0,
	Animation::DELAY, PAIR(500),
	Animation::SET, 200, 0,
	Animation::SET, 201, 255,
	Animation::DELAY, PAIR(500),

void setup() {
	ULK.begin(1, 27);
	pinMode(21, OUTPUT);
	Animation *anim1 = Animation::createAnimation(testAnim1);
	Animation *anim2 = Animation::createAnimation(testAnim2);
	Animation *anim3 = Animation::createAnimation(testAnim3);

void loop() {

That's some strobes going in groups of 3 with two different rates, and some other LEDs alternating with a 1 second period. Just working on adding a FADE command now...

... And here's the results of that sketch (except my phone's camera is pants): [url][/url]


Sun, 22 Dec 2013 22:04:09 +0000

Here's the (initial versions) of my support libraries: [url][/url] This is hard-coded at the moment to use SPI2 (which is the normal DSPI0 channel) and cannot be used at the same time as DSPI as the interrupt routines conflict.

The animation library to go with it is here: [url][/url]

Any ideas for instructions to implement in the Animation programming language would be greatly received.


Wed, 26 Feb 2014 21:39:42 +0000

@majenko, this is one of the best solutions I have seen for driving LEDs or any constant current load for that matter. The best thing about these however is the price. I tried to zoom into the given pictures on eBay to see if the PCB material being used or the soldermask or vias had any signs of cheap PCB manufacturing quality issues but everything seemed great. I’m currently not building any such product but I’d definitely keep this in mind till I make a new project.