So I made a post a few days ago about some trouble I am having with controlling relays with a 74HC595 shifting register chip, I cant for the life of me figure out where I am going wrong.
I have tried
RC snubbers on Relay contacts and the coils + and -
Pull up Resistors on DS pin, STCP pin and SHCP pins
This guy had the exact same configuration as me except I only have 8 relays where he has 16 (I think)
I copied that schematic (on the site provided) exactly and still did not fix in my problem |O
I Have a relay shield with opto iso's , IF is use two separate power supply the interference does not happen.
This is forcing me to now go with an option of running two power supplies in project.
This is the relay design now
I want to change it to something like this
(Please ignore the led and tranistor codes inside the opto iso i just made a look alike since the site I was using did not have an actually icon for one )
I dont know what Resistor values are required here tho, could you guys please recommend what resistors I should use or any changes to this configuration ?
If "really optoisolated": then the ground of the relay power supply does not need to be connected to Arduino ground.
Good catch Terry. I didn't notice the ground symbols were the same. They should look different for isolation as you pointed out. Why use an opto isolator if you're going the share the GND ?
I will use separate Power supplies with separate grounds. so the relays will have their own power supply
@raschemmel, I had the whole circuit hooked up with just n2222 transistors controlling the output Everything worked Perfect until I started putting 230VAC through the relays, then all these relays started to bounce around.
raschemmel:
VF = 1.2 V @ 20mA
IF = 20mA
Vcc = 5V
RCL = (Vcc-VF)/IF
= (5V-1.2V)/0.020 A
= 190 ohms (round down to 180 or up to 200 ohms)
Thanks for the calculation ! so I put this (180ohm res) between the 74HC595 and the Anode of the optoisolator, but what about the diode between the emitter and base of the n2222 ?
The characteristics of the coil:
12V
220Ohm
55mA
@Runaway Pancake !
Not using his sketch !
But about my program !
I only upload the data to the chip ONCE ! In the start up and NOT in the loop.
eg
void setup()
{
pinMode(DS_pin_RELAY, OUTPUT);
pinMode(STCP_pin_RELAY, OUTPUT);
pinMode(SHCP_pin_RELAY, OUTPUT);
pinMode(ena, OUTPUT);
digitalWrite(ena,LOW);//Sets OE pin of ship to LOW
data sheet it says active LOW
for(int i = 0;i<8;i++)
{
regon_RELAY[i] = HIGH;
regoff_RELAY[i] = LOW;
}
writeregon_RELAY(); // This turns on all outputs to HIGH
}
I do this because I want the data in the register to stay the same no matter what happens on the relays.
I put 4k7 Ohm resistor on all data pins (dose not help)
RC circuit has shown on the other guys website (in my first post)
100nf to ground--- DS pin from Arduino ---100Ohm to DS pin on chip