0

I've designed a circuit to turn on/off a 12V electromagnet but when I turn off power to the magnet it still has a magnetic force. The magnetic force when OFF is not as strong as when it is ON but it still has more magnetic force than desired. The electromagnet has no magnetic force before the circuit is powered up and current is applied to the magnet. Is there a modification I can make to my circuit that will eliminate the magnetic force when the magnet is switched off.

The 100nF capacitor is to absorb flyback current caused by the coil into the switch which is actually a digital I/O pin of an Atmel 328p

schematic

simulate this circuit – Schematic created using CircuitLab

Jeff Wahaus
  • 419
  • 4
  • 13
  • Try to disconnecting the electromagnet after it has been turned off. If there is still too much magnetic attraction, the metal part of the electromagnet is being magnetized. Please modify your question with the result of this test and we can provide further assistance. – Dwayne Reid Aug 08 '18 at 23:58
  • The electromagnet has no magnetic force when disconnected. – Jeff Wahaus Aug 09 '18 at 00:07
  • @Dwane:Switching off the transistor shuts off current. How will disconnection change anything? (Looking at the comment above though the transistor may be short-circuit.) – Transistor Aug 09 '18 at 00:07
  • @Jeff: You need a snubber diode across the solenoid rather than the capacitor across the transistor. – Transistor Aug 09 '18 at 00:10
  • The capacitor is actually working well as a snubber. Without it the micro-controller will reset when the magnet is switched off. – Jeff Wahaus Aug 09 '18 at 00:18
  • I suspect what is happening is that the coil is basically behaving like a battery when the transistor is switched off. The current has nowhere to go. – Jeff Wahaus Aug 09 '18 at 00:19
  • @Jeff: If current had nowhere to go then the current would be zero and the electromagetism would disappear. – Transistor Aug 09 '18 at 06:28
  • I added the diode and replaced the toasted transistor. The circuit is working well but there is still some residual magnetism in the electromagnet. In fact, even if I disconnect the wires of the electromagnet it still has enough force to lift a steel ruler several minutes (perhaps even hours?) after the power is disconnected. Once I manually remove the magnet from the ruler the magnetic force goes away and the electromagnet will then no longer have any magnetic force. (i.e. if i place the electromagnet near the ruler again it will not attract it) – Jeff Wahaus Aug 09 '18 at 13:20

1 Answers1

4

You actually have a Darlington transistor with internal resistors rather than the BJT that you show.

I will assume that your solenoid draws quite a bit of current. You need much more than a 100nF capacitor across the transistor to absorb the energy. You have probably damaged the transistor (or possibly the capacitor).

When the Darlington turns off, the inductance will try to maintain the same current flowing, and the voltage at the Darlington collector will rise to make that happen. If the solenoid current is substantial, hundreds of mA or more, the capacitor will have little effect and the voltage will rise, probably to over 100V, causing the transistor (or possibly the capacitor) to break down. With enough energy that will kill the transistor. If the capacitor breaks down it has failed and probably short.

You can leave the capacitor on there, it does control the EMI and is not high enough value to cause problems for the transistor, but you must add a flyback diode across the coil (or something similar).


If you want the solenoid to drop out faster, you can add a resistor in series with the diode. The voltage across the coil will rise to a maximum of I*R +Vf where I is the operating current of the solenoid and Vf is the diode forward voltage. So if the solenoid draws 500mA and you want to allow the collector voltage to rise to 30V you can allow the (coil + diode) voltage to rise to 17V so R should be less than 34\$\Omega\$.

Spehro Pefhany
  • 376,485
  • 21
  • 320
  • 842
  • I added a diode parallel to the capacitor and it had no effect on the magnetic force of the electromagnet when switched off. I suppose this does give better surge protection to the circuit but does not address the fundamental issue. – Jeff Wahaus Aug 09 '18 at 01:13
  • The diode parallel to the capacitor does exactly nothing. The diode goes across the coil, as I said above. – Spehro Pefhany Aug 09 '18 at 01:47
  • I've done some measurements and discovered that when "OFF" there are 46mA flowing through the electromagnet. In this state there is only 8mV present on the base of the transistor. Is the 8mV really significant? Perhaps I should ground the base with a 10K resistor? – Jeff Wahaus Aug 09 '18 at 01:47
  • There are already resistors inside the [TIP120](https://www.mouser.com/ds/2/149/TIP120-890130.pdf)- 8K and 120 ohms. If there is 46mA flowing through the coil either the transistor or the capacitor are toast. – Spehro Pefhany Aug 09 '18 at 01:49
  • 1
    Yes, the transistor is fried. It measures 222 ohms from collector to emitter which accounts for the current flowing when it's switched off. A good TIP120 measures 3.2M ohm. It's odd that the fried transistor still switches current it just can't turn off completely. – Jeff Wahaus Aug 09 '18 at 12:22
  • @JeffWahaus Thanks for the feedback. It happens, damaged, not completely melted. Don't let the new one get too hot and for sure always have that diode across the solenoid. – Spehro Pefhany Aug 09 '18 at 12:43
  • Spehro Pefhany was right about the transistor getting "toasted" but the original problem still persists (although to a much lesser extent). It seems like to get the magnet to completely let go of a steel ruler I'll need to give it a pulse of reverse current. It's been disconnected from power for 30 minutes now and it still has a grip on the ruler. Once I separate the ruler and magnet all magnet force leaves the magnet. – Jeff Wahaus Aug 09 '18 at 13:27
  • @JeffWahaus You are seeing remanent magnetization in some ferromagnetic material (maybe the ruler, maybe the core, maybe both). – Spehro Pefhany Aug 09 '18 at 13:30
  • The electromagnet and the steel object attached to it are only magnetized while they're together. If I pull them apart and then immediately put them back together there is no longer any residual magnetism. From what I've read about ferromagnetic material it should stay magnetized. – Jeff Wahaus Aug 09 '18 at 16:01
  • Can anyone think of a simple way to have the circuit give a small pulse of reverse current when the transistor is switched off? I can think of complex way's to do this. – Jeff Wahaus Aug 09 '18 at 16:06
  • @JeffWahaus H-bridge (needs 4 transistors plus drivers) or a DPDT relay plus your present circuit. – Spehro Pefhany Aug 09 '18 at 18:13