I recently designed a simple FET driver circuit for energising a solenoid. It wasn't particularly special in my opinion but I thought it might be useful to share the experience so here goes:
I had to drive a solenoid based circuit for an electronic lock from a microcontroller. As a solenoid is essentially an inductive load I would need a transistor based circuit to control the supply voltage from a 3.3 Vdc signal generated by an STM32 microcontroller. In order to actuate the solenoid a short pulse (less than a second) was required from a 12 Vdc or 24 Vdc supply.
A solenoid is an electro-magnetic actuator which creates a concentrated magnetic field. Here are a couple of links about solenoids and how they work:
https://sciencing.com/a-solenoid-work-4567178.html
https://en.wikipedia.org/wiki/Solenoid
A simple switching circuit is all that is required to energise the solenoid coil and actuate it. Electronic switching can be performed in many ways - a relay switch in itself is a form of electro-magnetic actuator. In my case I decided to use a Field Effect Transistor or FET. I've blogged about field effect transistors in the past:
https://langster1980.blogspot.com/2012/09/using-field-effect-transistors.html
The same principles apply. Recently I read an excellent blog post by James Lewis - 'The Bald Engineer' on some of the misconceptions about using field effect transistors...I recommend looking at James's website. He writes some excellent articles and makes some great video content on electronics engineering.
https://www.baldengineer.com/7-mosfet-myths-and-misconceptions-addressed.html#more-7748
As I had to drive the field effect transistor directly from a microcontroller pin at 3.3 Vdc I needed what is known as a logic level FET - That is a device that will allow current to flow between the drain and the source pins when the gate pin is supplied with logic level voltages, logic level voltages are normally classed as 1.8 Vdc, 3.3 Vdc and 5 Vdc. In the case for the microcontroller I am using - an STM32F439 a logic 1 (high) is 3.3 Vdc. Therefore I needed a FET which had a VGS on threshold that was at or below 3.3 Vdc. I chose to use the IRLZ44 as I had some of those components and I also had a spice model for them so I can simulate the circuit.
From some brief measurements of my solenoid I found that it had a series resistance of about 33 ohms and I guessed it's inductance at 3 Henrys....I didn't have my LCR meter to hand to measure it....I might dig that out later to see what the inductance actually is.
Here is the datasheet for the IRLZ44: http://www.irf.com/product-info/datasheets/data/irlz44n.pdf
I'm using the T0220 version for my circuit:
The critical parameters I was interested in are:
VDSS = 55 Vdc - The maximum voltage allowed on the drain pin with respect to the source pin.
RDS(on) = 0.022 Ω - The resistance of the drain with respect to the source pin when the transistor is on.
ID = 47 Amps - The maximum current allowed to flow from the drain to the source.
VGS On Threshold = 2.0 Vdc - The voltage at which the FET turns OFF - Thanks James, I always wrong about this too! This means in order to turn the FET on (cause conduction between the drain and source pins we need to surpass this this voltage at the gate pin. If the voltage at the gate pin drops below this voltage the transistor will stop conducting from the drain pin to the source pin. The parameter name is a little confusing but hey ho...
So what does this all mean. It means that I can turn the transistor on using an output pin from a
3.3 Vdc microcontroller and that will allow conduction through the drain pin to the source pin which will allow me to control the voltage supplied to the solenoid.
Here is the circuit:
Simple Solenoid Driver Using a Logic Level FET |
The voltage source VCC and switch S1 are not really present but a way of simulating what the output from the microcontroller will be. If S1 is closed for a short period the signal presented to the gate pin will be similar to the output pulse from the microcontroller. This pulse voltage will cause the FET to become active allowing current to flow from the drain to the source which in turn will allow voltage to flow through the solenoid causing it to actuate (create a magnetic field which pulls the pin into the coil).
If we were to simulate the operation of the circuit and observe the input and the output with an oscilloscope connected as shown above this is what would be seen:
The red trace is the the solenoid operation and the blue trace is the input from the microcontroller - modelled in this case by the switch S1 and the 3.3 Vdc voltage supply.
So our circuit simulates will and will work. The FET operates properly from a 3.3 Vdc supply and can go active within a milli-second. More than adequate for our purpose!
The only thing left I wanted to discuss was the flyback diode D1...it's needed as when an inductive load has voltage and current applied it converts the electrical energy into magnetic energy creating a concentrated magnetic field. When an inductive load is has the voltage and current removed the magnetic field collapses and any left over energy is passed back to the drive circuit as a large voltage spike. This spike is often well over 100 Volts for a short period - more than enough to damage the Field Effect Transistor. Therefore the flyback diode is applied to prevent this damaging voltage spike passing to the FET.
To illustrate the point here is a circuit with a switch added to the flyback diode. As the switch is open the diode is not connected. When the magnetic field collapses this is what is passed back to the FET:
Here is the oscilloscope trace:
If the flyback diode was not present in the circuit the FET would fail fairly quickly...
I'll add some photos of the circuit I built shortly to show it in operation. It works perfectly for my application. Take care people - Langster!
Here is a quick video of the circuit on a bread board. It was driving an electronic lock using 5 Vdc as the gate voltage: