help with relays

hi all i am new to aduino but after looking around this seems the most easy way to do what i want

i am not too bothered on which ardunio board i need or witch relay board (preferred solid sate relaya) i need

basically i want a bank of 12 relays to be configured in a way so i have a button per relay (basically if i push a button for one relay i i push a button for another relay the first one disengages but i would like a 13th button so if i hold that down i can enable multiple relays at once)

then i would like another bank of 20 relays and i would like these to that the relay is only on for the length of time the button is held but can time out after 5 seconds

and lastly i would like to have an other relay in place where i need to enter a 4 digit pin and it turns on till i press another button like a lock button (so basically i enter the pin press a button to enable the relay but then i can press another button to disable it)

if you require any more details pleas ask

if possible i would like to have this wireless if it is possible with this much

Welcome to the forum.

Can you tell us what you actually want to achieve and what you are driving? We may be able to come up with a simpler way of doing the task.


Suggest you use serial input and outputs as seen here.:

Switch inputs

Relay control (use tpic6b595 which is similar but has more drive.)


Correct me if i am wrong, I assume you need to deal with 33 Relays and close to 35 buttons, so total around 68 pins.

I guess you need to follow what @Larry suggeste, using couple of GPIO expanders.

some background. if you can light an LED, you can switch a relay.

get an UNO, get your switches and some reistors and LED’s

IF you want to get, or have ordered relays, great. most have LED’s on-board
and you will need to have a second pwoer supply just for the relays.

There is a sketch called button. load that and start to play with turning an LED on and off
or turing a relay on an off.

Once you get that working, most of your questions will answer themselves.

but, having 2 or 3 MEGA’s will make things easier.

do you have any Arduino yet ?

my favorite is the NANO with the screw connectors.

it allows you to use simpler wire

if you have not purchased relays, what do you need for power for the fireworks ? is it AC or DC, is a a simple wire with a match or is it some form of fireworks igniter ?

I would offer that you can get a 12V power supply for the relays and use that for the Arduino as well.

merlinuk11: let me brake it down to what i think is the eseyest way one controler for the arm/disarm one controler for the 12 selecter relays and one controler for the other 20 relays

can you draw a sketch of how the selector relays and the 20 relays would work ? I cannot see this in my mind.

This has been done before on this forum. Enter "Fireworks" in the search box on top of this page. Leo..

I think it always comes back to the same general matrix

you control one of the relays on the left. when powered, the entire row has potential.
then, when you energize any relay on the bottom, you complete one and only one circuit, and only and only one of your electronic matches is ignited

this shows 5 rows and 11 columns and would use only 16 pins.

theoretically, one button could be pressed fo fire one e-match, then pressed again for the next and so-on.
also one could press and hold and the software could count, change the circuit, count… change…

if you have row 1 energized and energize column 1 and 2 and 3, then 3 of your e-matches would be energized.

you CANNOT have two rows and two columns without firing all 4 intersections.