0
\$\begingroup\$

I have a 12v magnetic lock, which is just an electromagnet. I want to turn it on with my Arduino.

I've been able to turn on/off a 5v motor with the Arduino. So I'm guessing the wiring is similar. The problem is I need 12v. I looked for a 5v to 12v DC convertor at Fry's and DigiKey, and couldn't find any. I can only find ones that go from 12v to 5v.

I found a this youtube video doing exactly what I want, but it's short on details. He only has a single electronic on his breadboard that he calls a "DC convertor". No transistor, no diode. How does that work?

Also, is the current from the Arduino enough to power a magnetic lock, or should I have an external power source?

I'm very new to electronics. Any help is appreciated.

\$\endgroup\$
  • \$\begingroup\$ A relay might be a good place to start. \$\endgroup\$ – uint128_t Jan 19 '16 at 1:01
  • \$\begingroup\$ So your entire question is about how to power the electromagnet, not how to control it? \$\endgroup\$ – immibis Jan 19 '16 at 8:19
2
\$\begingroup\$

You need a relay circuit, here is a simple relay circuit example.

enter image description here (source)

You should find a relay with 5VDC coil, and replace the +12VDC power supply with 5VDC, use the same power supply that powers your arduino. And then use 12VDC power supply instead of 240VAC. Put you magnetic lock where the 240VAC bulb is.

\$\endgroup\$
  • \$\begingroup\$ To get the 12VDC power supply, do I just get a spare 12V power supply that plugs into a wall (say, that used to go to a printer), and strip the wires? Do I put the ground wire where the diagram says "Neutral"? \$\endgroup\$ – abtree Jan 19 '16 at 1:11
  • \$\begingroup\$ Yes, you connect the wire marked «240VAC» at the diagram to «+» on the spare 12VDC power supply, and «Neutral» to «-» on spare power supply. Just remember to replace the «240VAC bulb» with magnetic lock, else there will be a short circuit. \$\endgroup\$ – BufferOverflow Jan 19 '16 at 1:20
  • \$\begingroup\$ What's the purpose of the resistor and transistor next to the on/off? Why not connect the on/off directly to the coil? \$\endgroup\$ – abtree Jan 19 '16 at 11:39
  • \$\begingroup\$ The transistor is the only part of this circuit that's needed, because it controls a 12V device with non-trivial current (which could be the magnetic lock) from a 3-5V digital signal that the microcontroller can provide. \$\endgroup\$ – Ben Voigt Jan 24 '16 at 0:47
0
\$\begingroup\$

one way is to use a couple of transistors

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
0
\$\begingroup\$

You could use a relay or a transistor. I'm assuming the current draw is pretty low, so almost any transistor or relay would work.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ To use a relay you should first see te resistance of the inductor to not damage the arduino output pin.I recommend to use only a transistor or a mosfet as a control device. \$\endgroup\$ – Stefan Merfu Jan 24 '16 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.