How to properly wire a solenoid

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Jim2386
 
Posts: 285
Joined: Fri Nov 14, 2014 11:58 pm

How to properly wire a solenoid

Post by Jim2386 »

I've been digging through the adafruit solenoid page and there's a link to a wiring diagram for a solenoid:

https://www.adafruit.com/product/413

http://www.arduino.cc/playground/upload ... driver.pdf

But it appears the PDF link is dead. Does adafruit have any other location that shows how to properly wire them up to a feather or any other microcontroller?

Thanks
Jim

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: How to properly wire a solenoid

Post by adafruit_support_mike »

This tutorial has a schematic that shows how to connect a solenoid:

https://learn.adafruit.com/secret-knock ... ock/wiring

The basic idea is that you want to put a diode in parallel with the solenoid's coil, oriented so it allows current to flow from the switch to the VCC rail.

Magnetic fields are proportional to the amount of current flowing through a wire. If you try to increase the current, the magnetic field expands, stealing energy from the current as it does. When you try to reduce the current, the magnetic field contracts, dumping energy back into the current. In mechanical terms it behaves the same way as momentum, which keeps things from changing speed instantly.

When you open the switch that controls current through a relay's coil, there's a lot of energy in the magnetic field. As the field collapses, it dumps energy into the current to try and keep it moving forward, but with an open switch, there's nowhere for it to go.

Ohm's Law still applies under those conditions, so if you have 100mA trying to push its way through about a billion Ohms (the air gap in an open switch), you get an enormous voltage. In practice, the voltage rises until it shorts the transistor controlling current through the solenoid, or arcs through the air between the contacts of a physical switch. Both are bad, so we want to avoid them.

The diode lets the voltage at the switch end of the coil rise to about 0.6V above VCC, then the diode becomes conductive enough to let the burst of current flow back to the VCC rail. It's a safe, low-voltage way to bleed energy away from the coil's magnetic field.

User avatar
Jim2386
 
Posts: 285
Joined: Fri Nov 14, 2014 11:58 pm

Re: How to properly wire a solenoid

Post by Jim2386 »

Thanks!

Concept makes sense, but do I need an external diode for flyback? Looking at the schematic for the actual darlington, it appears they have a flyback diode build into the chip/part itself. Is the external diode redundant?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: How to properly wire a solenoid

Post by adafruit_support_mike »

The L293D has a built-in flyback protection diode, but adding an external one never hurts.

Some half-bridges have things called 'internal protection diodes' that can't handle the flyback current from a motor or solenoid. Those are just protection from static electricity.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”