Is this simple NPN as a switch a proper design? Do I just replace that cloud area on the low side of the lock with the NPN as shown?
I have a 12v magnetic lock for a gate that I'd like to switch via Moteino. There is currently a simple 12v transformer that is driving the lock.
Sorry for the hand-drawn...
Should the 12v ground and the 3.3v ground be tied together?
[edit - the vcc is actually likely the 3.3v rather than 5v]
(https://i.imgur.com/b7Pz3iX.jpg?2)
Using this design would be much cheaper than dedicating a SwitchMote to the 12v transformer.
One of my gate locks runs at 300mA while the other uses 450mA so using https://learn.adafruit.com/transistors-101/faq I calculated the resistor values to be 0.9 k-ohm and 0.6 k-ohms respectively.
Since the Lock is undoubtedly a solenoid and is, therefore, an inductive load, I'd recommend a clamp diode across the Lock. Cathode to 12V, Anode to the collector of the transistor. This will clamp the inductive voltage spike produced by the solenoid when the transistor turns off. Current rating of the diode needs to be slightly greater than the current drawn by the solenoid (1Amp 1N4001 would be common).
Tom
Thanks Tom.
(https://i.imgur.com/4QB5FkO.jpg?1)
Hopefully it doesn't fry!
(https://i.imgur.com/vZ0zMV3.jpg?1)
Quote from: TomWS on November 27, 2018, 08:44:36 AM
Since the Lock is undoubtedly a solenoid and is, therefore, an inductive load, I'd recommend a clamp diode across the Lock.
I was curious about this. Apparently this diode can also be called a Flyback Diode. The page on Wikipedia https://en.wikipedia.org/wiki/Flyback_diode (https://en.wikipedia.org/wiki/Flyback_diode) explained it well enough for me to understand. I also found this diagram to be helpful.
(https://upload.wikimedia.org/wikipedia/commons/7/76/FlybackExample.GIF)
The 2222 is a bit small for this. Its really a small signal general purpose NPN.
For a 500mA collector current, beta might be as low as 10, meaning you have poke 50mA into its base to get it to turn on properly. Which the moteino cannot supply. There are better choices.
There are lots of NFETS that would turn on to a lower on resistance, and not need to waste base current. Choose anything rated for 1 or more amps of drain current, and logic level gate drive. They will switch this load reliably.
And yes, that catch diode across the solenoid is a really good idea. If you expect the transistor to turn off again. More important for a bipolar than a DMOS.
Quote from: galah on December 11, 2018, 03:19:38 AM
The 2222 is a bit small for this. Its really a small signal general purpose NPN.
For a 500mA collector current, beta might be as low as 10, meaning you have poke 50mA into its base to get it to turn on properly. Which the moteino cannot supply. There are better choices.
There are lots of NFETS that would turn on to a lower on resistance, and not need to waste base current. Choose anything rated for 1 or more amps of drain current, and logic level gate drive. They will switch this load reliably.
And yes, that catch diode across the solenoid is a really good idea. If you expect the transistor to turn off again. More important for a bipolar than a DMOS.
I might go with a relay solution that I have some parts for. Thank you for the topics to think about with this solution.
Quote from: galah on December 11, 2018, 03:19:38 AM
The 2222 is a bit small for this. Its really a small signal general purpose NPN.
For a 500mA collector current, beta might be as low as 10, meaning you have poke 50mA into its base to get it to turn on properly. Which the moteino cannot supply. There are better choices.
Good catch!