Using diodes to protect from reverse polarity

I have an electromagnet that is powered externally of my Arduino but that power is controlled by the Arduino through a relay.

Problem - the electromagnet will continue hold a strong residual magnetism after the power has been removed from it. This prevents the magnet from dropping it's load when the Arduino switches the power off.

Solution - turns out that a very SMALL amount of voltage applied in reverse polarity will instantaneously clear the magnetism. So, a quick pulse of low voltage from my Arduino would do the job!

Implementation Question - Can I safely wire an additional Arduino circuit to the magnet, in reverse polarity, by using diodes to prevent the magnet's external power supply from traveling up that "reverse circuit" and shorting out my Arduino when the magnet is turned "on" ?

Things I have read about reversing polarity -
I understand that there is something called an "H Bridge" that allows you to reverse polarity on a motor, to run it in reverse. However, I don't need to "run" anything for any length of time. I just need a single, split second of power and a very small voltage at that. In a test (isolated from the Arduino) I have made the magnet release with a 3 volt spike but I suspect I can use even less than that. Also - the H Bridge seems complicated and perhaps expensive.

I have also seen people mention they have used two relays to reverse polarity but I'd like to avoid that because that increase my project size and it will no longer fit into my project box. :frowning:

Hello there!

During the operation of the electromagnet there is current going through the coil. When the power is removed via the relay, is there a path for the leftover current to go through or will it just stay in the coil?

Hi.
The magnetism can't actually be "drained off" and in fact can remain almost permanently ... until a current is allowed to pass through the magnet in the opposite direction.
It is apparently a physics phenomenon that I think I have seen called "Remanence".

To directly answer your question though, the circuit does not have such a "path". However in my initial attempts to deal with this residual magnetism (before I researched the problem) I did try connecting such a "path" but it had no effect.

I drew up a picture in microsoft paint of what I think your circuit looks like (I'm not sure if it's right or not). Is the black stuff correct for the most part?

If you put a diode in the configuration shown by the red symbol, that would allow current to flow through the magnet after the relay is turned off. After some time, the current should be dissipated by the magnet over time and should reduce the magnetic force.

Implementation Question - Can I safely wire an additional Arduino circuit to the magnet, in reverse polarity, by using diodes to prevent the magnet's external power supply from traveling up that "reverse circuit" and shorting out my Arduino when the magnet is turned "on" ?

Through another relay, yes. The Arduino can't directly-power anything other than an LED.

An H-bridge will work but it has to be able to handle the current.

Diodes will NOT work. The back-EMF from an inductor can be thousands of volts and it can fry the diode if you put the diode in series. It is standard practice to add a reversed diode in parallel with the driver (or across the relay contacts). The kick-back voltage from the inductor is reversed, so the diode conducts and the voltage is knocked-down to the diode's forward voltage (~0.7V). The current through the coil remains the same for an instant after power is removed and that current flows-trough the diode and it decays as the magnetic field decays. That's why you get a high-voltage spark when you disconnect a coil... It's trying to push current through an infinite resistance.

[u]Here[/u] is a motor driver with a protection diode.

But, with the parallel diode you can't reverse the voltage because the reverse voltage will be "shorted out" the same way the back-EMF was shorted-out.

During the operation of the electromagnet there is current going through the coil. When the power is removed via the relay, is there a path for the leftover current to go through or will it just stay in the coil?

No, the current flow stops but the iron becomes permanently magnetized (to some extent). A coil does "try" to keep current flowing as the magnetic field collapses.

"Capacitors resist changes in voltage."
"Diodes resist changes in current."

That's an over-simplification and a series capacitor passes AC (changing voltage) and it blocks DC (constant voltage) as it "tries" to keep constant voltage across the capacitor.

OK, since nobody (so far) has actually addressed the OP's actual question, how about this StrawMan:


Caveats:

  • VMag is the Voltage Source for driving the ElectroMagnet
  • VRelease is the Voltage Source for getting the ElectroMagnet to release.
  • The VMag supply, and the VRelease supply must be isolated!
  • I'm assuming the OP knows how to drive a Relay from an Arduino, since that seems to already be happening.
  • I'm pretty sure there is some sort of protection circuitry that needs inclusion [like to protect those relay contacts from arching, and such], but I'm not "up" on that, so hopefully one of my more informed colleges will chime in :wink:
  • Also, since the OP supplied no details regarding the current/voltage requirements on that ElectroMagnet, other than what pertains to overcoming the residual magnetism, I gave no component details. So, that will need to be ironed out.
  • DO NOT connect anything on the non-Arduino side of those relays, to ANYTHING on the Arduino side. These two sections need to be isolated.
  • Make sure to NEVER energize both relays at once!! In fact, probably a good idea to put some delay between switching -- for instance. Open the Mag relay, delay a few hundred milliseconds, then energize the Release relay.

Also, "Dn" & "Dm" stand for the "Digital Outputs" on the Arduino. For instance "D3" or" D12", etc.

Yes Thanks !
DVDdoug seems to have grasp my project exactly. Sorry for the initial, poor description.

While my Graphics Foo is not very good, I have drawn a VERY simplified version of the existing circuit and have attempted to attach it to this post.
I will also attach a simple diagram of what I had hoped to do ... but you have advised against.

Before I read your reply, I did did a breadboard version of my idea (completely separate from the Arduino) using two diodes as shown and a 3volt power supply (two 1.5 volt batteries) for the V release. I did notice that only .7v came through the diodes but that was enough to instantly release the magnetized plate. BTW - I am powering the magnet with 5volts stepped up to 12v through a small (ebay special) amplification circuit.

Still ... better safe than sorry I suppose. Your suggestion would seem to provide that.
I may be able to squeeze another relay into my project box but I will have to "unmount" my existing componants :frowning: and move things around a bit.

Thanks everyone. :slight_smile:

How many amps and volts is this electro magnet? If it is under 30 then it is very easy to get an H-bridge motor driver to do that.

I do like Doug's schematic but if condition 3 (isolated supplies) is met then NONE of the diodes are required. You are losing up to 2.4V which is a significant fraction of a 12V supply. And the diodes get hot.

With dual-pole relays you don't need isolated supplies or diodes. With DPDT relays you can protect yourself from software errors switching both relays on at the same time. You could even make it work with a single supply, like an H-bridge.

Gary_Arduino:
Yes Thanks !
DVDdoug seems to have grasp my project exactly. Sorry for the initial, poor description.

While my Graphics Foo is not very good, I have drawn a VERY simplified version of the existing circuit and have attempted to attach it to this post.

The second circuit seems to make no sense. If the supplies are isolated the diodes can do nothing,
if the supplies are not isolated then one of the diodes is a direct power supply short to ground.

Isn't this a case of overthinking a simple problem?

You can use two current-limiting resistors to set a small reverse current through the electromagnet,
and a double-pole relay to switch the forward current. In forward mode the relay also carries
current through both resistors, but this is a small fraction of the forward current so no problem.

On switch off the small reverse current is re-established by the resistors, cancelling the remanent field.

The resistors are cross-connected w.r.t. relay contacts of course so to reverse the current. Two are needed
to prevent the relay from shorting the power supply.

Saves needing a whole H-bridge, and if the values turn out suitably the resistors would also act as
snubbers and speed-up the magnet switch off compared to a diode.

[ Its best to choose a thread title reflecting the nature of the problem, not of a proposed solution. ]

DVDdoug:
Diodes will NOT work. The back-EMF from an inductor can be thousands of volts and it can fry the diode if you put the diode in series.

Well, actually, a series diode will neither have an effect, nor be "fried" since it will only ever be passing current in the forward direction whether that is while the electromagnet is powered or when it is turned off.

Gary_Arduino:
I understand that there is something called an "H Bridge" that allows you to reverse polarity on a motor, to run it in reverse. However, I don't need to "run" anything for any length of time. I just need a single, split second of power and a very small voltage at that. In a test (isolated from the Arduino) I have made the magnet release with a 3 volt spike but I suspect I can use even less than that. Also - the H Bridge seems complicated and perhaps expensive.

The H-bridge is the way - essentially the only way - to reverse the current in the electromagnet (using a single power supply). A resistor or an alternate voltage source can be used to provide a lesser voltage/ current in the "reversed" direction.

To clarify my circuit:

The diode might be optional if the resistor values needed for the reverse current happen to be
good enough to snub arcing in the relay contacts.

And of course the relay drive circuit needs a snubber diode, goes without saying...

So you are proposing using the forward voltage drop of the diode as a regulator to deliver about 1 V to the electromagnet in reverse?

Use two diodes in series if a higher voltage is required.

It seems like a good scheme for heating up the diode. I doubt that it will do much for killing the electromagnet quickly.

No, he actually did say:

Gary_Arduino:
I did notice that only .7v came through the diodes but that was enough to instantly release the magnetised plate.

How 'bout this?
relays-bridge.png
The small reverse current does not demagnetize the plate, but repels it (same polarity magnetic fields), wonder if a charged up cap would be enough instead of opposite current?

SPDT relays are more common in the Arduino world.
Both NC conatcts to ground, both NO contacts to supply, solenoid between the two CO contacts.
Maybe easier to understand when drawn as an H-bridge.

Four diodes can be a bridge rectifier.
2*AC to solenoid, + to supply, - to ground.
Leo..

Wawa's idea seems do-able. Although it still has me trying to squeeze yet another relay into my project box. When I initially designed this project I didn't know about Remenance. If designing a circuit to deal with it seems like such an after thought ... that's because it is. :confused:

Wawa:
Four diodes can be a bridge rectifier.
2*AC to solenoid, + to supply, - to ground.
Leo..

When you say "2*AC" what does this refer to? Not AC as in AC vs. DC ?

BTW - here is a picture of the type of Relay I have been using.

Gary_Arduino:
When you say "2*AC" what does this refer to? Not AC as in AC vs. DC ?

Referring to the terminals of a bridge rectifier.
Leo..

Could have a resistor in the 12volt line to the "reverse curent relay", for a lower reverse current.
Leo..

Wawa:
Could have a resistor in the 12volt line to the "reverse current relay", for a lower reverse current.

Could have? Must have to fulfil the objective.

But MarkT's circuit with a DPST (or DPDT) relay should actually work just fine, except that it continues to drive the reverse current.