Hi guys i have a question and i need it fast, i have a rc522 and a 5v relay connected to atmega328p with electromagnetic lock “+”connected to relay and “-“ directly to 12v supply and “+“ of the supply to the relay, the board is powered by standard usb phone charger, it works great and after some time , randomly rc522 stops scanning, it can be after 20mins or 6 hours , i know that the board didnt crash because i have a button connected to it and programmed and it works fine but only rc522 stops scanning,and i have another board with rc522 with the same code and it works fine for almost a month so its not the code. Thanks ! The scheme is attached .
Vcc, is that the 12 volt?
Where does +5 volt come from? What supply?
Connect a kick back diode across the solenoid. The lack of that diode is possibly the reason for such failures.
A button is connected to "it".... What is "it" and where is the button in the wiring?
Vcc is the plus and gnd is the minus of the 12 supply. 5v for the relay is coming from the atmega328p 5v pin as u can see in the scheme, the button is connected to a GND pin and a random digital pin (i think its 4) . I have read that about a diode for the lock but i dont understand how is that affecting it. Thanks for the reply!!
From where/what is the atmega328p powered.
The kick back diode..... It's fundamental for every inductive device. Without that diode semiconductors face the risc of being destroyed. If they aren't destroyed nasty electrical noise will be created when turning off the current through the solenoid. The symptoms You describe are typical for projects lacking that diode.
Do some Google about that! "Free wheel diode" is another name.
The atmega is powered by micro usb cable , phone charger pretty much. I am posting the full scheme. My first time using fritzing sorry if its confusing. The 9V battery is actually 12v just couldnt find it.
Hello,
Replace your relay with an LED and check if the problem persists, then you can look further.
Without properly experimenting where the problem is, you can guess that the kickback issue is there, but unless proven it can be a lot of other problems as well.
Best regards,
Johi.
@milanovic28
Fritzing are paintings, not useful for engineering. No pin designations visible, power supplies omitted.....
Skip Fritzings....
I made a mistake, my arduino was connected to an external battery(3000mah) , maybe that was the problem, last night i connected it directly to the adapter and it worked all night. Can it be that my external battery was making something come up even if it was charging the whole time? Connection goes :arduino - battery-charger
Update , originally the sensor was connected to the lan cable (about1.5m) that i had soldered male and female parts of arduino cables , on that cable it stops working ,now i have connected the rc522 to the original 10cm arduino cables, we will see what happens now.
Text versions aren't good. Make a drawing. I read cables here and cables there. Unclear to me. More precision please.
I will post a picture of jumper wires end soldered to lan cable , sensor was connected to arduino with that. Now i connected it with 10cm arduino jumper wires ,been working fine for 3hrs.
I don't think the MFRC522 likes being connected to 5 V logic. ![]()
Its connected to 3.3v not 5v. Im hoping these cables are the problem , with the original jumper wires still works.
The cables were the problem, it ran nicely with 10cm jumper wires.
SPI bus doesnt like long wires
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.


