A shield with 70 outputs for LEDs, etc

Well, I felt that the Arduino has a few too few outputs, so I started looking into the M5451 35 output constant current chip as an output expander. The cool thing about this as opposed to the LED matrix drivers is that it is not strobed, so in theory you should be able to drive anything off it, not just LEDs.

Here's my blog about breadboarding it: effluvia of a scattered mind: Arduino and M5451 -- Control 35 LEDs, motors, etc!

And it turned out that I could cram TWO of them onto an Arduino shield. So I stuck'em on with IDE cable connectors extending out the sides so that you can stack something else on top and still get at the cables.

Then I added the option to have independent power so you could drive the outputs with higher or lower voltage than the base Arduino and also added the option to use a PWM bin to control the brightness.

So basically, with 3 pins (clock, and 2 data) you can turn on/off 70 outputs, and use a fourth (PWM) to control the current.

One issue I had was to figure out how to let the person choose which arduino pins to use. I settled on making some SMT pads, and the idea was to put a solder blob across the pads to connect a pin. But the SMT pads are so small, its actually pretty difficult to make the connection. Does anyone have any ideas about how to do this better?

Unfortunately, I can't figure out how to put pictures in the forum, so you'll have follow this link to my blog:

Doing "img URL /img" (with brackets around the "img" word) on some of the pics in the blog isn't working for me...

This is exactly what I needed a couple weeks ago! I was pulling hair trying to work multiple MAX7219s with no success. i wish I had known of this solutino earlier cause ti would be my first choice.

Unfortuantelt I already bought 100 RGB common CATHODE LEDs, which don't work with your solution :cry:

If I can't get the Max7219s working soon, I might have to bite the bullet and pick up some common anode leds to work wth your solution

So you basically have a chip with 35 constant-current outputs, and you can "dim" all the outputs at once with a PWM pin from the Arduino?

Also, you created some code that creates a PWM-like signal on an output port, so you can even dim all the outputs independently?

That's seems like a very good idea!

Also, on your blog you wrote that you don't need to worry about inline resistors for a series of LEDs (because of the constant current output), and I read that you added external power. Does this mean that you can use say 12V, and power a series string of 6 red LEDs (1,9V6) on one output and a series string of 3 blue LEDs (3,3V3) on another? If I want 20mA and up to 12V from each pin, that'd mean about 8W going through the chip!

Excuse my ignorance; my knowledge of electronics is very limited (but I'm eager to learn)! :-[

Darudude -- actually I accidently bought some common cathode RGB LEDs too. So I used a PNP transistor -- this one: 2N2907 - Wikipedia -- to drive common cathode RGB leds. If you look at the breadboard in the first picture in my blog here effluvia of a scattered mind: Arduino and M5451 -- Control 35 LEDs, motors, etc! then just to the right of the M5451 you'll see 2 transistors (I didn't bother to drive the red), a resistor and the common cathode RGB LED.

But of course, it requires an extra transistor per color. So I finally just decided to buy some common anode ones... they are about $35 for 100 on ebay.

Thomas S -- I'm no great stuff at hardware myself frankly -- check my blog in a few days for a posting about hacking hardware for non-electrical engineers... I think it will help you alot.

Yes, all outputs are dimmable at once using a PWM pin. Yes, I wrote PWM-like code so the outputs are independently dimmable -- since the Arduino is driving the voltage up and down explicitly a person can perceive blinking at the dimmest setting (on only 1/256 of the time). However, the rest of the time it looks quite good!

Yes, you can power a bunch of LEDs in series, which is why I added a separate power input. Thomas, 8W (.0201235) is the TOTAL power dissipation in your example. But most of that is being dissipated in the LEDS. The chip itself is only dissipating what the LEDs do not. Since the LEDs are consuming (1.9v6) and 3.33 volts, the voltage across the chip would be 12-(1.96) and 12-(3.33). Multiply these by 20mA and say 16 chains of red and 19 blue you get the power dissipation of .99 watts. BTW, the M5451 can dissipate 1 watt (without a heatsink), so we just made it! Of course, you could always put a resistor on each blue chain to dissipate a bit more power since the blue chain is 2.1v under the 12v source. For this chip, the rule of thumb is if all 35 outputs are on 100% of the time at 15mA, dissipate <1volt per pin.

But in summary serial LEDs work great!

As an aside, just fooling around on the breadboard with 12V input (what I have) and only 1 LED its doesn't work so well since the voltage across the chip is ~10V -- I've gotten in the habit of resting my fingers on the M5451 as I run my tests, you can REALLY feel it get hot when there's a problem :-).

If either of you do decide to fool around with this keep me informed -- I'll give you schematics etc (needs cleanup before publicly posted). Or you can buy a board from me at cost -- I had 10 prototypes made which is more than I need. That will cost about $10 (without chips) because it was low volume -- and I don't know, probably a bit over twice that with everything soldered on.

I plan to post a simple, no frills youtube video tomorrow or the next day showing the LEDs blinking, LEDs in series, and it controlling a stepper motor, so check back in this thread.

haha a transistor was my guess but for some stupid reason I was working with NPN and couldn't get it to work (was trying to emulate the behaviour with the Arduino).

slapped my head when you said PNP, replace the transistor and circuit and voila it works.

You are right however, common anode is prob the way to go, prob try to recoup the cost by selling the cathode ones on ebay

By the way, where are you situtated? and did you do the protos on BatchPCB?

i must confess i was atheist before i read this post, but now i knw there is a god... and u must be jesus... thank u, u just saved my numerous projects from extinction....

I'm in the US, Northeast. I did the protos using OurPCB. www.ourpcb.com. There is an instructable www.instructables.com on how to take a PCB in Eagle and generate files for them. I got 10 boards for $50 setup + $1.40 per board (so $64), and then unfortunately $30 shipping. But still ~$100 was a pretty good price. Great customer support. It was much better than all the other places, except maybe expressPCB which have that 3 for $51 deal if your board is their exact size. But that is actually more per board. Also ourpcb does soldermask and silkscreen.

I didn't use batchPCB because I didn't want to wait and I wanted to try a "real" fabricator, as a test for future orders. I think that this board is pretty generally useful and so if people on the web buy up my prototypes then I'll get 100 made.

jezuz -- Wow, no one even replied to my post for 2 days and now I'm a savior! What part of my Message(TM) appealed to your heathen ears and saved your projects? Did you run out of output pins?

BTW, www.futureelectronics.com has a good supply of M5451s. Search for MM5451YN. Its ~$3.50 for the DIP-40 part. Make sure you don't accidently buy the surface mount!

I have no relationship with either ourpcb or futureelectronics except as a customer.

I like it. I use 595 shift registers to drive LED's. The way you're demonstrating has a certain advantage - 1 chip with ~34 outputs and no need for resistors. Thanks for sharing! :o

Here is a video of the Arduino driving a lot of LEDs through the board and a stepper motor through a L298N driver chip. Please forgive my terrible video production! I recorded this very quickly and in one take.

hehe, i am working on a robotic arm controlled by a glove with a accelerometer + lillypad setup, and my project involves controlling a bunch of (like 6 or so) high torque 24 v motors, along with a few led's, segmented displays, etc... the point is il be needing lots of outputs, and from what i understand, thats exactly what u created... unless i misunderstood?

Yes that's basically what I have made. My first project with this board is going to be a lot of glowing blinking LEDs inset into a hardwood sculpture and my second is going to be a robotic snake-arm. Both need lots of outputs... So it looks like you're sort of doing both of my projects at the same time.

Just like I showed in the video, this shield can be used as the motor controller. Like in the video, your motors will need to be "driven" by another chip; one that can take a lot more current. It is very common to have a 2 chip solution to run motors; for example the L297/L298 pair. This shield takes the place of the L297, except that it can act as a LOT of them.

If you (or anyone reading this) wants a shield (I had 10 prototypes made -- they are not perfect but as you can see, they work!), the eagle files, code, etc. send me a private message. Its all going to be open source/open hardware, but the files (eagle schematic especially) are NOT pretty right now. If there's enough interest I'll clean them up and set up a site.

What are the motors you are using & where did you get them? I have a bunch of steppers I got out of old printers, but I am looking for a good deal on some small high-torque servo motors.

thx, il look further into it...

the motors are from an old RHINO robotic arm system, and there are actually two kinds, currently i am trying to figure out how to use the smaller ones, so i havent looked at the stats for the larger ones yet...

atm, here is wat i knw about the smaller ones:



24 VDC

96:1 ratio (it has a gearbox attached)


i dont knw how useful that is, but thats all i knw...

I've been getting about 1 query every week or so about the Arduino and M5451 chip, so I put all the hardware design files and software libraries (I made an Arduino library to drive 2 M5451 chip simultaneously) up on google code. And there's also some info in the wiki about how to hook up the M5451 (wiki page is under construction).


Very interesting. Looks like you're about to get another query :wink:
Thanks for the post.

Here are some photos of a triple stack that I'm building up. 2 CCShield boards and 1 Duemolovo:

This one shows it powered up & controlling a bunch of LEDs

Would this be able to handle a number of high powered LEDs? I'm building an aquarium light with 36 Cree X-RE 3w LEDs, and I was planning on using BuckPucks controlled by the Arduino, but this looks like a much simpler solution.

EDiT: I guess not, after reading your description of the power limitations of the chip. Too bad :frowning:

This circuit board allows each LED to be individually controlled. For an aquarium light, I would imagine that you just want all 36 LEDs to turn on or off together. If that is true, it seems like the simplest solution would be to put a bunch of LEDs in series, connected to one BuckPuck device (or just a few BuckPucks if you hit voltage limits). Or if you want to DIY use the LM334 as described here effluvia of a scattered mind: constant current LED driver thoughts (LM334). But you'd use a higher wattage transistor (instead of the 2N2907).

If you really do want individual control for high intensity LEDs, the situation gets interesting. The M5451 can dissipate 1Watt, 13v maximum drop, and sink an absolute maximum of 40mA per IO line. So it would take a bit of trickery to make it work for a high intensity LED -- The current is the key factor -- maybe solvable by running one LED off of 2 IOs, or via an external transistor as described for the LM334 above. The 1Watt dissipation limit just means that you'd have to be careful to have the input voltage be just a little greater than the voltage drop over the LED, so very little power is dissipated WITHIN the M5451. This is what you need to do anyway if you are trying for efficiency.

Very neat shield, for the connecting issues you mentioned on your site, would it be possible for you to use a DIP switch or two. This would be a neat option.

Are you going to be selling this item? I have not got the capabilities to make the board so I may be interested in buying one.


Yes I had 10 made which is more than I need. I am selling them at cost & if I sell them all then I'll just do another run! Anyone who wants details can email me at g.andrew.stone at gmail dot com.

With respect to using a DIP switch, the problem is the sheer number of combinations. I need to allow the user to map any of 14 Arduino digital pins to 4 CCShield input pins. A straightforward mapping where each Arduino pin has 4 DIP switches (one to enable each individual CCShield pin) results in 7 DIP switch chips!

Or you could have 5 12 position DIP switches ;D

I see what you mean...
I hadn't quite grasped the connection thing before...

RE buying one... I presume you are in the US, would you be able to ship to the UK/how much would it be?