Best way to control 8 relays with a single arduino pin
May 8, 2013
I have the stepper motors for my drawing robot connected to the Adafruit motor shield via a bank of 4 double relays.
The reason for this is PURELY to protect the arduino from voltage created by me spinning the stepper motors while setting the thing up.
I have currently got the coils for all 4 (double switch) relays connected to the 5V line on the arduino.(in parallel, if that makes any difference)
As long as the board has power, the relays are closed, and the motors can operate. By unplugging the power from the arduino (powered via usb) the relays open, and i can spin the motors to my hearts content without putting power backwards into the motorshield (or arduino).
I want to add a little more control!
ie, have the arduino automagically, power up the relays when the motors are needed, but have them "normally" disconected the rest of the time, to save me from having to unplug the usb cable every time i want it to do anything!
Can i just move the 5v coil wire directly to a pin, which i set high, or low using the sketch, or should i build in a transistor?
If i should build in a transistor, would 1 do? or should i use one for each relay?
Ideally a hard wired LED indicator would be good (ie, one not affected by code). i could just drop this on in parrallel with the coils with a suitable resistor perhaps?)
a little basic electronics guidence would be greatly appreciated.
many thanks. Ol.