30 relias with arduino.. need help...


I need to switch on and off multiple relais. although the arduino has only 13 outputs.

i tried alot of things, like: charlieplexing and the max 7219, but this doesn’t make any sense to me. i tried both options width leds but no luck i just can’t get it to work. and then there would be a problem if i switched on more than one relais at a time, or is that a wrong thought?

i searched google for hours. i looked at forums and instructables.

i just tried everything, but can’t seem to get any further, can somebody help me?

but more import if it can be done, could somebody explain it to me so i learn to understand this?

If you made four of these, you could control 32 or more relays with only three I/O lines. Check the Arduino tutorials for the ShiftOut command and the 74HC595.

Ok i’ll try this, i just ordered 4 of the 74HC595…

as soon as i tried, i let you know if i could get it to work.


Just be aware that you need the uln2003 as well. Or some other transistors that can handle the current needed by the relays.

You can not drive the relays directly with just the 595 shiftregisters.

oh… that’s to bad… i already payed the shipping fee, that was 3 times more expensive then the 4 74HC595.

so i’ll try width the leds example from the arduino site first.

thanx for the notice!

and if i get my idea to work i’ll buy the other thingy’s

Also, you’d need 5 of the uln2003 if you decide to buy them.

For some mysterious reasons, they only have 7 outputs instead of 8.

If you want to save trouble, order 4 uln2803’s instead, like in the schematic. They have 8 terminals each.

I am also trying to do a similar thing with arduino, but with 40- 5v relays.


What I was wondering was… Because they are low voltage relays, can I bypass the uln2803’s?

Also, can with the setup as seen in the ShiftOut tutorial (below) be used to control an infinate amount of relays? i.e- can you just keep chaining the 74HC595’s?

So i have all the stuf i need, and tried the examples from the arduino site.

everything seemed to be working but i added an another 595 and i just couldn’t get it to work. 4 of my classmates checked if all the wires were ok, and they were, so here is a first test, with only one 595

if the video doesn’t work http://www.youtube.com/watch?v=1GBHqKom5us

but i also wonderd how many 595’s can i add up? or do i need 3 new pins. you see i still don’t really get how this works.

sorry you got a noob in the house i guess…

I would also like to know how this works, I will try this tomorrow when I have parts; please post your findings needle, I shall do the same.

For your video, did you use the uln2803’s? or just the 74HC595? I cant see.

Here’s a quote from another forum.
“Each chip will control 8 relays. Only three outputs required for ANY number of chips.”

this first try was without the uln2803 chip, i’ll try again sunday evening…have to do my home work first…

It’s not the voltage that makes the ULN2003 (transistors) required, it’s the current. Arduino pins can supply max 40 mA of current and there is also a max curent that the Arduino board in itself can supply.

So even if you use 5V relays you most likely need transistors and a seperate power supply. This is especially true when we are talking abaout 30 - 40 relays.

in my first try i just used leds… the example from the arduino site doesn’t use a uln2803 for just the led example… but i’ll be sure to uses the uln2803 when i start using the relais

Thanks for clearing that up MikMo, With a 24v input to the uln2803 does it mean each pin from the 2803 also outputs 24v?

Can I interchange the 24v input for a 12v or 5v?

The ULN2803 is a current sink driver. The 24V connection is there to connect the protection diodes in case you’re using inductive loads, like relays. To connect the relays, you would connect one side of the relay coil to each output terminal, connect the other side of each relay coil to 24V, and connect the ground of your power supply to the ground on the ULN2803. I think 5V may work but you’ll get better response with 12V, the ULN2803 is based on BJT transistors and will have a voltage drop.


Needle, just to let you know that the tutorial does work. I’m still unsure how it works exactly but will keep you posted. :slight_smile:

Sorry about the image quality, my phone camera is pretty bad.

For some reason, the first led on the second group stays slightly lit at all times, does this happen to yours?

edit in the discrepancy with the capacitor values I used a 0.1micro f and it seems to work fine. I havent tested with 1 micro f.


Here is another forum post going on the same subject.

Here’s a rig with 2 595’s and piggy back pcbs so you can add as many as you like.


You can get the relay board kits from anykit.com they are quite cheap.

“You can get the relay board kits from anykit.com they are quite cheap.”

Are you sure it’s “anykit.com”? When I go there, it’s a domain squatter.

My apologies, its plural - www.anykits.com


They are good with delivery to, the products come packaged in a box thats wrapped in cloth and stitched up I hadn’t seen anything like it before, very unique.

If you need to speak with someone there, “Raj” is the owner.

That’s India…the post office there requires that all packages be wrapped in white cloth and sewn closed. When you have a package ready to send, you walk out on the street and find a package tailor, and they will grab the box and sew up a custom cloth covering fast.