So I'm working on a project and I want to connect multiple relays to a shift register. Everything in the shift register is working properly while testing with leds but when i connect the IN cable to the shift register OUT pins they are always HIGH even when the shift register is set to LOW.
I tried using transistors but I think i setted up them wrong because it was always flashing HIGH, LOW, etc.
Any way to fix this?
Parts being used:
Shift register: SN74HC595N
Relay:
Red cable: Positive
Black cable: Negative
Orange cable: Connected to OUT port of the shift register
I wont include code because it has much more then just the relays but I'm using the ShiftRegister74HC595.h library and the problem, I believe, is not in the shift registers since they are working fine with only leds.
The schematics of the connections between the shift register and the relay:
You can't directly drive a relay coil because it takes too much current. You need a driver circuit. Or you can buy a relay board with a built-in driver.
[u]Here is a MOSFET driver circuit[/u]. It's shown driving a 12V motor but it will work fine with a 5V relay. There are similar (but not identical) circuits using a regular bipolar NPN transistor.
Note that the "standard" 1-transistor or 1-MOSFET drivers are inverting. The relay coil is energized when the signal from the Arduino or shift register goes low. That's easily handled by inverting the logic in software.
Your module has a driver transistor on board. It should work perfectly well from a shift register. However, the relay side should never be powered from the Arduino 5V. VCC on the module should go to an independent source of 5V, not from the Arduino.
Also, as an aside, never go back and edit previous posts to update or add information that has been requested. It makes nonsense out of the replies and makes it hard for other people to follow.