Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Electromagnet control circuit

  1. Dec 19, 2014 #1
    Recently, I was trying to control the strength of an electromagnet with PWM over a MOSFET or IGBT with an Arduino/microcontroller. It worked but I burnt multiple MOSFETs/IGBTs while testing it, after certain time... so something must have gone wrong...

    I'd like to build a simple circuit, to control an electromagnet in strength in polarity from a microcontroller. But since I'm not very experienced in (serious) electrical engineering, I have troubles chooosing the right parts... Some questions I have right now:

    1) Is it okay to choose a MOSFET or IGBT to control the current to the magnet? PWM will turn on/off the magnet with quite high frequency... actually I would rather like to be able to change the current without switching at all, but I heared that it will heat up the MOSFET/IGBT much faster when it's not turned off/on fully... Actually heat was probably also the problem in my test setup. Although I used a heat sink, it got quite hot (I've tested those two chips: FGL40N120AND, IRFP260, I've got from an old uninterruptible power supply) - they have quite high ratings, but stopped working at a certain point. I've also placed a snubber diode antiparallel to the coil... so probably it was just the heat. - Also, the magnet still produced some acoustic noise, although the PWM frequency was quite high... it was also recognizable when holding metal parts close to the magnet... some resonance probably. With pure DC this wouldn't be the case I guess...

    2) Is it a good idea to use a H-bridge (e.g. L298?) to change the polarity of the magnet? And is it wise to use 4 (logic level) MOSFETs to it? - E.g. STP16N65M5 ..it's going to be expensive... Or is there simpler way to do it?

    3) Actually I do not only need one magnet in the end, but multiple of them. So, I was thinking about using a PWM driver board (e.g. that one with a PCA9685). So I was thinking out using an H-Bridge, protection diode for every magnet, and connecting it to the PWM driver IC...

    4) Do you have experience with winding your own coils? What material is best for the core, soft iron rods, and copper wire... I'd like to make ~16 of those magnets, and work in a secure area at around 12V, but still generated reasonable strong magnets that can easily move an iron balls of 10mm in diameter...

    That was about my test circuit so far:


    In the smaller version, I've used a transformer, and got about 100 V DC for the magnet.


    In the larger version, I've powered it directly from the mains, without a transformer in between, and got 317 V DC to switch (which might be stupid!):


    In my test setup, I've used different kind of coils. One from an old relay, and a huge one from a microwave oven transformer (core + only secondary winding). As soon as I connected the bigger one (with ~100 Ohm resistance and pobably >1000 turns) directly to IGBT at 317 V (rectified directly from the mains), it worked for a couple of minutes, but then burnt the IGBT... this was the most extreme scenario. The magnet was very powerful, it even distored the display on my oscilloscope... and somehow almost destroyed my bench power supply (burnt a capacitor in there).

    Any hints would be much appreciated! At the moment it's all trial'n'error here ;)
    Last edited: Dec 19, 2014
  2. jcsd
  3. Dec 19, 2014 #2
    Hello 1rel -

    While not thrilled about a beginner dealing with main level voltages - it looks like you are doing it anyway. There are a number of subtle things (best practices) that should probably be employed.....but otherwise the circuit makes sense - except, is the (-) side of the 15V reverenced to the Power stage - is J4 connected to Q1-source...and then, you realize when the Q2 is (off) the Q1 is ON?

    If your project is only to move 10mm Balls - use the 12V case and you will eliminate many of the problems I think you are seeing. If a 12V battery can start a car - it can certainly move 10mm balls.....

    Various notes:

    MOSFETs and IGBTs - should always be used as a switch. Note assuming you are using a continuous current mode - the current in the inductor is not being switched on and off with the PWM - the supply of energy is. The current in the inductor ( electro-mag) is rippling ( ramping up when the MOSFET is on , and ramping down through the Free Wheeling Diode (FWD)when off). ( A Snubber would be to dissipate unwanted energy - the FWD is part of the continuous current path for the inductor)

    There is also ripple current in the Capacitor - sizing the DC cap is important ( too much is not a problem - if possible measure the ripple voltage on it). (1st choice for the ringing you hear) - Note the DC cap has to "filter" the ripple current for both the AC rectifier - and the PWM current to the Inductor.

    The capacitor should be as close ( physically) to the MOSFET, and the MOSFET should be as close to the FWD - i.e. the physical LOOP of C1, Q1 and D1 should be small - this reduces the stray inductance and voltage spikes across the MOSFET when turning off ( my 2nd guess about the deaths- esp at the higher voltages) - all similar issue to the FWD across the inductor.

    For the Gate probably best to use a small MOSFET or darlington pair - 1st guess for the deaths. You want to turn the MOSFET on as fast as possible, so you want very high current gain - yes the MOSFET is a V controlled, but it has a gate capacitance, that you need to feed current to. So not switching them on and off fast enough ( not the frequency - but the individual ONs and OFFs) - will cause the losses to skyrocket - and overheat.

    You mention nothing about control - when you take this to 100% - do you stop switching - and just have the MOSFET ON? (also what then happens to the DC ripple current)

    The act of switching the MOSFET on and off- can also generate ringing in the Gate Circuit, which is Voltage sensitive - so an oscillation here can easily kill the device. Check the DS for each MOSFET for notes on the voltages and gate circuits.

    Changing the polarity of the electromagnet ONLY has an impact if you are using a magnetic armature ( moving part) not Steel Balls - or I guess if you get some type of hysteresis that is not desirable. But the H bridge is the right way to go if polarity switching is needed- but this may then make control more complicated.

    You seem to be thinking that the higher voltage will make a stronger magnet - if you can change the electromagnet - think of more current ( like your 12V Suggestion) -- as long as your supply can support the current this is a much better sandbox to play in.
  4. Dec 20, 2014 #3
    At first sight, the circuit looks ok. Maybe you are just overloading MOSFETs with high current in a cont. mode. First things first. Check how much current draws that electromagnet and what is current rating of mosfet you're using.
  5. Dec 24, 2014 #4
    Thanks a lot for the detailed answer, Windadct! I didn't have the time to test the setup out in a new configuration yet, but I will soon. Sorry for the late reply!

    Oh yes, the MOSFET in the schematic (Q1) is the wrong way around! And your also right about the main level voltages, I've burned/blown a couple of parts and generated some sparks while testing around. I'm not used to use higher voltages than about 15V, but it was a good experience. Wearing savety goggles now ;)

    Yea, going down to 12 V would eliminate a couple of problems... like cost, weight, potential dangers (maybe also problems with the powersupply and overheaing) ... I still need to find a way to make powerful electromagnets with 12V only. I've got some new parts, big iron screws, 2 old TV tubes (has lots of isolated (magnetic) copper wire in there), a small washing maschine
    (maybe I can use those coils from its motor)... We'll see. - With only 12V, I still need a lot of current and a great number of turns in the coils to make strong magnets...

    That sounds reasonable. The FWD is then an essential part of the circuit...

    Currently I learning to use LTspice more often. An inductive load behaves completely different from a resistive one, I just don't have a good understanding of it yet. Even when I use the MOSFET/IGBT as a pure switch, I think, the inductor will keep magnetized when the switch is off for a short time, and "uncharge the magnetic energy" by a current flowing out again (flyback). And when Q1 is switching on a gain, it will counteract that discharge process... I need to try it out in LTspice soon.

    That could be indeed the case... I saw that effect already on the scope. The larger the cap, the less 50Hz ripple I have after the rectifier... There was probably to much current flowing, so that too much charge was "sucked out" of the cap?

    At the end I've chosen one of the biggest caps I had at hand, a 330 uF/450 V electrolytic one.. maybe I can add more then one of those, since I already have 3 others pof those...

    Hmm... need to consider that. Especially, because at the end I've connected the coil over a long (thick) cable (like 3 m) to the MOSFET/powersupply. And had the FWD right at the beginning of the cable. Just because I didn't want the magnet on the same table as all the rest of the equipment... Might have been a problem. - Stray inductance comes because the cable itself is also "part of the coil" right... need to minimize that then. And the voltage spikes come from the "flyback current"? I know that I cannot use the MOSFET in both directions, so this could destroy it... I was thinking that the FWD will solve the problem...

    Oh, I think that is the answer!! Thank you :) I wasn't thinking much about the transistor there (2N3904). But I can imagine that at a high frequency, it wasn't able to switch cleanly... the rising/falling edge of the ramping up/down signal keeps the MOSFET busy in "continous mode"... that could be the problem. So I need to replace that transistor, and also find the right PWM frequency... maybe also monitor the temperature on the heatsink.

    Also, wanting to try out logic level MOSFETs soon, but don't have any here right now... (any right model for choosing the right model for the 12V case?).

    My test program was constantly switching. One loop from 0% duty cycle up to 100%, and then down again, in about 5s intervals.

    [QUOTE ]
    The act of switching the MOSFET on and off- can also generate ringing in the Gate Circuit, which is Voltage sensitive - so an oscillation here can easily kill the device. Check the DS for each MOSFET for notes on the voltages and gate circuits.

    It was difficult to see on the scope, cause the signal wasn't clean anymore, as soon as the conductor was in the loop... But I need to test it out in a lower voltage setup and a new MOSFET soon.

    I'd like to test out different types of "magnetic modules". To be able to switch polarity would be interesting, when working with static neodym magnets.

    For motors, I've already used H bridges... so I would be able to construct such a circuit. - But recently I was thinking out using a TRIAC to change polarity (with AC)... but I have no idea if this would be possible, since I've never worked with them yet...

    12V would be more comfortable yes. To make/find a power supply that can deliver enough current will be the other problem then. A big transformer should help I think, or a modern switching power supply, I could find in an old PC powersupply... We'll see :)
    Last edited: Dec 24, 2014
  6. Dec 24, 2014 #5
    Thanks for the hint. The switching problem/continous mode thing might have been the problem indeed.

    The ratings of the MOSFETs were fairly high: IRFP260N: 200 V / 50 A. And the IGBT I've found was even higher: FGL40N120AND: 1200 V / ~64 A.. That should be enough / I thought...

    Strangly enough, all the MOSFETs died after a certain time, although they weren't overheating much (in the lower voltage/current case). - The IGBT was only diying in most extreme scenario after a certain time... (317 V/around 3 A IIRC).

    The diode was a RHRP15120, which is very roboust too... they withstood all the tests up until now ;)
    Last edited: Dec 24, 2014
  7. Dec 24, 2014 #6
    An additional suggestion:

    PWM control is a voltage control mode. Thus the voltage across your magnet tends to want to be VCC x PWM (neglecting the IGBT and Diode drops).

    If you have 160VDC, and a low resistance coil, i.e. 5 ohms, you can get very high currents with moderate PWM values.

    If you use a current-mode control IC, such as a UC3844, you can inject a voltage that translates to a given coil current. This is a much safer means of control as the current is limited even though the switching device is still used in a switching mode.
  8. Jan 1, 2015 #7
    Happy new year everybody!

    Ok, I've got the thing working, with logic level MOSFETs (FQP30N06) at a lower voltage (<25 V DC). Made 3 coils of about 2.5 Ohm each in resistance, driven at up to 1.5 A... Moving a samll metal ball is possible. @Windadct, you were right, the problem before was probably the low switching speed... still need to test it with PWM, right now I'm only turing it on/off "by hand".

    For the current reversal, I'm now playing with H bridges. Constructing them myself out of 4 MOSFETs makes not much sense (like I had to find out), since I need to boost up the gate voltage for the "upper" MOSFETs to work properly, or use N /P channel + bipolar junction transistors to drive the P channel ones from 5 V... it would get complicated and expensive. - But, I've tested L298 IC (which has 2 full H bridges inside) and just found another one (L6203), with 1 MOSFET based bridge inside doing most of the work in one chip. It seems to work with both, exceptionally well with the L298, since it's really easy to hook it up, almost no periphery needed.

    I'd prefer the L6203 over the L298, although it's more expensive, has only one single bridge inside and needs more parts to configure it properly, because it's more robust, switches faster, and can handle more power... I'm just not sure if I'm doing it right. The datasheet suggests quite a few of parts around the chip (capacitors to filter, sense, booststrap...). Still toying around with it right now... (if sombody has experience with it, I'd be thankful for any hints... I'd like to use as few parts as possible per magnet... I don't really know which caps/diodes are just a suggestion, and which are a must...).

    Attached Files:

    Last edited: Jan 1, 2015
  9. Jan 1, 2015 #8
    Thanks for the hint! Yea, probably I was just going to far in terms of power usage, although the MOSFET/IGBT I've tested before had very high max. values, it was probably too much.
    Need to check out this current control IC. The L6203/L298 also has a current sense pin... need to find out how to use it properly. When polarity of the motor/magnet changes rapidly, this could mean a lot of stress of the chip too, due to the back EMF.. Need to find out how to drive these things safely over longer time span.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Electromagnet control circuit
  1. Load Control Circuit (Replies: 6)

  2. Fan controller circuit (Replies: 3)