Electromagnet charging project

Hello!

I am trying to charge an electromagnet via Arduino (a code is running through to continuously switch the magnet on/off via one of the pins) with a 12v battery, however the Arduino overheats. What should be done so that the Arduino itself would be receiving a separate (or diminished) power supply from the electromagnet without losing the link to the pin?

You can't switch 12V with an Arduino so there are obviously some other components involved that you haven't mentioned. A diagram of what you actually have and how it's all connected would be useful.

The Arduino could always be run with a 5V DC-DC (buck) converter. 12V input, 5V output connected to the Arduino 5V pin.

Steve

Thanks for the reply! This is my current scheme, however instead of a 9v battery there is a 12v accumulator. Where and how would a buck converter have to be placed?

MagnetsFritzingSketch_bb.pdf (842 KB)

Those Fritzy things are hard to read but I think your electromagnet is only connected to ground and a digital pin. Normally you'd switch something like that with a transistor/MOSFET. If it's really just connected to one pin then you're only driving it with 5V and probably far too much current so you may already have damaged the Uno.

It is really important how much current the electromagnet takes. If it really is low enough to run safely from a digital pin (20mA or so) then dump the 12V battery and just use a 5V powerbank or similar connected to the 5V pin (instead of to Vin). That will bypass the internal regulator which is what gets hot.

Steve

Hello Steve,

Unfortunately the magnet does require a larger power supply than 5v so up until now I have probably just overheated the Arduino board.

I have made another scheme that includes an external power supply and a MOSFET.

Could this be an acceptable solution?

Best

That's more like it except the Arduino now has no power at all. You should be o.k. connecting 12V to the Arduino Vin now that you don't expect it to directly power the magnet.

If you've chosen a good logic-level MOSFET it should be o.k. but "logic level" is important. You can't use just any old MOSFET or you'll find that is getting really hot. Also you should ideally have a couple of resistors and a flyback diode. See the first section of https://www.gammon.com.au/motors Although it isn't a motor, an electromagnet has the same inductive kickback problems so the diode is needed to be safe.

Steve

Thanks. I have rearranged the wiring again taking in account the resistor and diode but am not sure if it's correct. Where would the vin pin have to go?