Hiya, so i'm building an electromagnet lock that uses a MFRC522 and the accesscontrol sketch in the example library. I can get the relay (tongling JQC-3FF-S-Z) to click as many times as i want until i put 12v power through switch it'll only click a few times before not working. This is also causing the RC522 to not read the cards. But when i hard reset the arduino it works but then the same problem arises. Any ideas as to what's going on? I've tried switch the power supplies that power the electromagnet and the arduino but still no luck.
A schematic of the project showing all components and power supplys would help us to help you. My fist impression is that the solenoid is sending garbage onto the power supply causing the processor to malfunction.
Anyone have any ideas?
TMFOH:
Anyone have any ideas?
Yes, I do. Your Fritzie shows no power to the Arduino. How is it powered?
Is your lock requiring power the entire time it is locked? Or is it powered only during the locking time? How is it unlocked? How much current is required to lock?
Perhaps the problem is in your software?
Paul
You also do not have a back EMF diode across your electro magnet, that would cause the problems you are seeing.
Oh okay, so i guess that sending power back through the arduino so i'd put it in between the board and the data in of the relay? Also, how would i determine which diode to get?
so i guess that sending power back through the arduino so i'd put it in between the board and the data in of the relay?
No, the interference is conducted through electromagnetic waves, the relay isolates any direct connection.
You put the diode across the electro magnet in a reverse biased way, that is so it is not normally conducting. Any rectifier diode like the 1N4001 will do.
Hi TMFOH,
Could you tell me, are you running the whole system off the 12v power pack?
When it is working are you running it off the USB port to power it?
Reason for asking is i womder if you are overloading your 12v with the electromagnet?
How much current does it draw?
May be on the wrong track here dut if this sounds like it then try disconnecting the electromagnet and running your circuit without it.
Reason i say this is i see you marked your power pack as 12v 0.42A or 420mA which would not be unreasonable for an electromagnet to draw that or more.
Daz
IMHO, you should not power a relay coil with the same power as the Arduino without some isolation.
Do you have any caps on the UNO input lines to help when the power to the coil is applied ?
have your corrected your Fritzrig to show how you put power on the UNO ?
Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Not a fritzy image.
Use a pencil and paper and include;
Power Supply.
Label pins and terminals.
Label components.
Also can you post a picture of your project?
Thanks.. Tom..
the DataSheet shows that the 5v coil has a resistance of 70 ohms and draws about 0.35 watts.
As I understand the output of all the pins is 200mA max.
a bit about relays.
relays, as we use them in the Arduino world, have three power sources.
the contacts are isolated from the coil so they get some power that is not connected to the Arduino.
it could be 220 VAC, and in terms of the DC power supply, as long as it is not connected, we do not care.
the second power is for the COIL. this rated as whatever is printed on the relay. 5volts DC and 12volts DC are the most common, 5volt being the one we use most often. and the one your drawing shows.
the coil is nothing more than a wire that is wrapped. hence the name coil.
in the 5 volt iteration, that manufacture lists 70 ohms as the resistance through the coil and they list 0.35 watts as the power for the coil.
you have to have a power supply that can supply that power.
the THIRD power needed is the power needed to drive the circuit that drives the relay. this is either a transistor or a MOSFET. often a transistor. as you should know the transistor base is connected to ground. so, when you apply power, the base uses lots and lots of power.
to properly drive the transistor, you need to do some calculations. to keep this short, you have to provide a resistor so that the base gets enough power to operate properly.
in many of the coils we buy, the coil is driven with this third power source by means of a opto-isolator.
this is really just an LED in a housing. your power it like any common LED with about 10-20mA and you use your LED calculator to tell you what resistor would work.
in your picture, you show only one power source for both the coil and the driver circuit.
and you do not show a resistor on the signal to the driver circuit.
we often ask that you provide links to your parts and when we don't we make assumptions.
if your relay board has an on-board opto, then it will also have the flyback diode on it.
All that said, you still have not posted your power supply that feeds the Arduino for this project.
further, since you said that your problems start when you add the 12v power, it seems clear that your problems are power source related.