Controlling 12V circuit with Arduino and powering it from that 12V supply

I Made a project where I used RFID module to control magnetic lock (12V) via the relay.
When I power my arduino from USB and Magnetic lock from 12V power supply it works fine, But when I try to use the same power supply to power Arduino so connect positive of the supply to VIN and negative to GND the magneticlock goes crazy . Seems like it opens and closes every few miliseconds. Can someone explain to me this phenomena and how I can resolve this problem.

Have you measured the 12V to be sure it's 12V?

IMG_7557
Here is the the schematics. If Arduino is powered via USB all is ok. If I introduced the connecion via dotted lines then magnetic locks behaves erratically

Well it is the dc 12 adapter I am using. It powers Magnetic lock and it works fine when arduino is powered separately. To power the arduino via vin you need 9v-12v and there is voltage regulator on board that brings it down to 5V. So even is there was no exactly 12v still it would not explain this behaviour

What is the current output of the 12VDC(I hope it's DC!) adapter? What is the current draw of the Magnetic Lock? Do you own a multimeter, can you measure the current draw of the lock, and the voltage of the adapter when the lock is powered?

Could the OP post a image of the project?

Is that a opto-isolated relay module or is the Uno directly driving the relay coil?

Is the lock an inductive component?

Hi,
Can I suggest you connect the wires to the arduino and the wires to the lock circuit separately to the 12V power supply.
This will minimise any current noise from the lock solenoid causing resets in the Arduino.

1b1c62799420a8e8d2261192cd84db8836a9786f
Also a fuse in the positive wire would also help if any shorts occur.
Tom.. :smiley: :+1: :coffee: :australia:

diag
Here are the exact components I am using. I am driving relay coil directly from Nano.
Away from my workshop so cannot use multimeter to measure current draw.

This is one of the most common questions on the forum. A forum search would quickly have revealed the problem.

The Arduino's 5V regulator cannot supply enough current for the relay coil and the RFID reader when the regulator's input is 12V. When powered by USB, the regulator is not used and the coil and RFID are powered directly from the USB.

Replace the relay with a logic-level n-channel MOSFET such as IRLZ44.

I used dedicated jumper wires to connect to 12V power supply to VIN and GND of arduino.Can you suggest using what kind of fuse you had in mind.

This sounds like a good explanation. I will try MOSFET. Thanks:)

You also need a flyback diode across the coil of the magnetic lock to protect the rest of the circuit from damage

If I still wanted to use RELAY would it be possible to use step down converter to bring 12v down to 5V and power nano through 5V and GND pins?

Yes. But an IRLZ44 would be less expensive fix.

Bypass diode and capacitor for regulation across relay would be a simple and sound solution.
Regards Colin.

Can you explain some more. Never used bypas diodes.
For capacitor would that be between + and - of the relay? What value of the capacitor?

No, but it would if the power supply was putting out more than 12V, that's why I asked if you measured it!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.