Relays are making my arduino rfid reader go stupid....

So I have finially got my problems down to a repeatable symptom. I am using 2 srd-5vdc-sl-c relays. one relay is simply in line with a linear actuator motor to cut the constant power to and from the motor. The other one activates the coil on a 3rd relay (not arduino specific) which is wired up to switch polarity. (i'm doing this because I don't have a DPDT for arduinio).

Both relays are attached to the arduino. gnd, vcc, and in1/s. This works just fine. They relay coil clicks, my code works through the whole loop. all is well.

Now if I start attaching wires to them, mainly the wires leading to the 3rd relay (to activate the 12v coil), things start being weird. I can scan a rfid tag once, the relay switches, and then it seems to disable the rfid and I can not scan the tag again. Sometimes it will make it so if I try to scan a tag the entire arduino will reset.

I am basically done with this project save for this bug. I'm completely at a loss. everything hooked up wo the switching side of the relays should be disconnected from the arduino. but if I use the relays they just go stupid.

I'm at a loss

thank you

Sounds like you need flyback diodes across the relay loads, but only if they are DC and don't reverse direction, post a wiring diagram.

outsider:
Sounds like you need flyback diodes across the relay loads, but only if they are DC and don't reverse direction, post a wiring diagram.

Can you explain a little bit more about that. That might be my problem. Before when I was only pushing the motor One Direction I seem to have problems but when I switched polarity they went away. Now I'm using one of the relays to control a double throw double pole relay with the whole purpose of changing polarity. Switch another relay simply opens and closes to let the motor turn on. But obviously which each polarity

All inductive loads will generate high (usually damanging high) voltages if switched off suddenly without
an alternate path for the current. Inductors resist change in current and store magnetic energy. Trying
to reduce the current to zero suddenly means all of the stored energy is available to force the current
to continue.

So normally a DC switched inductor will have something like a free-wheel diode across it, or some other
snubbing circuit such as TVS diode or resistor or RC snubber.

If you don't do this, your coil load will rapidly damage the contacts of the relay switching it as well
as generating very powerful pulses of interference to all nearby circuitry.

keywords "switching inductive load", "snubber", "inductive kickback"

You should not be driving a relay directly from the Arduino. Most relays draw way more current than the chip is made to handle, plus the need for the flyback diode. I usually use a NPN transistor or a N-Channel Mosfet for that. There are lots of circuits schematics on the web that show how it is done.

If you are doing what I think you are doing you are pretty close to toasting your chip..

Good luck!

amdkt7:
You should not be driving a relay directly from the Arduino. Most relays draw way more current than the chip is made to handle, plus the need for the flyback diode. I usually use a NPN transistor or a N-Channel Mosfet for that. There are lots of circuits schematics on the web that show how it is done.

If you are doing what I think you are doing you are pretty close to toasting your chip..

Good luck!

These are made for arduino. One came with my starter kit with instructiins.

amdkt7:
You should not be driving a relay directly from the Arduino. Most relays draw way more current than the chip is made to handle, plus the need for the flyback diode. I usually use a NPN transistor or a N-Channel Mosfet for that. There are lots of circuits schematics on the web that show how it is done.

If you are doing what I think you are doing you are pretty close to toasting your chip..

Good luck!

That went so far over my head it hit orbet

Post a wiring diagram, what is the current rating of your motor(s)? How many external relays (not including the ones on the module)?

It sure would help if you could provide a picture of your setup, and a wiring diagram. Here is a page explaining how to drive a relay. I have no idea what kind of relays you are using. It sounds like you are using some kind of kit made for that. Maybe it already includes the relay driver and diode. If so, you are possibly having a current peak load that takes the voltage supply down to much. I would put about a 470uF cap across the supply going to the relay and that just might hold up the five volt power for when the relays kick on.

edit: forgot the link:

so. i did some testing. I think i have 2 problems.

I have 3 relays. one relay (not made for arduino) which takes power from a laptop charger and outputs it for the motor. when activated it will switch polarity. Since it runs continuously i have a relay inline with it and the motor which simply cuts power. a 3rd relay i use to activate the first simply because its a 12v relay.

i don't know how to do a diagram so ill draw something up here in a minute.

the first problem is the in line relay obviously gets polarity switched. i'm not sure why this matters, but it does. its strange. When i have the polarity one way, my rfid reader does not fail after its first use. If I switch polarity, the RFID reader will fail a 2nd read every time. this is repeatable.

my second problem is that my rfid reader will just fail randomly. for no apparent reason. even when i disconnect everything from the relays.

diagram

You need to post about what sort of components you have. On the face of it you seem to be ignoring what you were told on another thread about level shifters on the rfid reader. You seem to have no power to the rfid reader, how is this powered?

You seem to be switching the relay coils direct from Arduino pins so can you post to what sort of relays you have, link and photograph please.

What is the “power from safety sensor” , what is the voltage and dos it have a common ground with the rest of the circuit?

What you have is a long way from being a good circuit.

Do you have a link for the relays? Where is the power coming from for the relays?

Grumpy_Mike:
You need to post about what sort of components you have. On the face of it you seem to be ignoring what you were told on another thread about level shifters on the rfid reader. You seem to have no power to the rfid reader, how is this powered?

You seem to be switching the relay coils direct from Arduino pins so can you post to what sort of relays you have, link and photograph please.

What is the “power from safety sensor” , what is the voltage and dos it have a common ground with the rest of the circuit?

What you have is a long way from being a good circuit.

Power from sensors rifht now isnt hoomed up. The photo eye sensor that I have is basically a relay. So I can power it from the Arduino and just get a signal back. There shouldn't be much for amperage. I still need to pick out some sort of touch a pressure sensor for the gate in case all else fails and it hits a vehicle. I haven't chosen one yet good morning. Right now I just have it on a momentary switch. I push button. The button grounds to the Arduino.

The two arduino relays coil side are powered from the arduino but the switching side is powered from the laptop charger. The DPDT relay is powered from the laptop charger on both sides.

The RFID reader is powered from the Arduino. The two relays and the RFID reader are the only thing that's powered from the Arduino.

I'm afraid but I'm not sure what you mean about level shifters. If I saw it on another thread then I did not understand it. My background is a computer attack not actual Electronics so this is kind of a new thing for me

Ill get kinks and pictures

amdkt7:
Do you have a link for the relays? Where is the power coming from for the relays?

The two Arduino relays are powered from the Arduino I'm the coil side, the switching side is powered from a laptop charger. I also use a double pole double throw relay and it is powered both sides from the laptop charger


This is the relay that i'm using. one is on this board another is on a board that came with my keyestudio starter kit

Its also noteworthy that at the moment I do not have the relay hooked up that runs the DPDT relay. its attached to the arduino but wires to the 3rd relay and power supply are disconnected. Whenever power is polerized on the relay that is inline with the motor it stops working instantly. if both relays are disconnected it stops working at random.

Okay, I saw the post showing the relay modules. That looks good, you don't need to worry about snubber diodes, or how much of a load the the relay is pulling from the Arduino output pin. But, I don't get where you are getting the power to run the relay modules. I would not run off the Arduino 5 volts, the switching current spikes could crash the Arduino. I would suggest a separate 5 volts supply for the relay modules. Make sure that the ground on all the additional supply is tied to the ground of the Arduino.

But, I am beginning to wonder if your problem is in your code instead. Making sure that the power is good is the first step though.

amdkt7:
Okay, I saw the post showing the relay modules. That looks good, you don't need to worry about snubber diodes, or how much of a load the the relay is pulling from the Arduino output pin. But, I don't get where you are getting the power to run the relay modules. I would not run off the Arduino 5 volts, the switching current spikes could crash the Arduino. I would suggest a separate 5 volts supply for the relay modules. Make sure that the ground on all the additional supply is tied to the ground of the Arduino.

But, I am beginning to wonder if your problem is in your code instead. Making sure that the power is good is the first step though.

The instructions from manufacturer show them to be hooked up through the Arduino. Or is it that it cannot run the RFID reader and the relays at the same time?

As far as code goes, everything will work perfectly the first time. So I don't think it's a programming problem, at least not as far as errors go

OK, some new developments. With the relay that came with my kit i can run a motor. I have to be sure to run 1 polarity or it fails to read a rfid tag a 2nd time. but it will work with that one relay. Obviously this only gives me one direction for the motor as there is no way to switch poles. but it works and keeps reading tags.

now, if i put the 4pdt relay on (without anything hooked up to energize the coil, just run power through it) then it will only read a tag twice, maybe 3 times, and will fail to read the tag again.

so perhaps it has something to do with this relay? CDR104CMEWB-24D NTE Equivalent NTE R12-17D3-24 Relay 4PDT 2...