Maker Pro
Maker Pro

Controlling 12V from 5V

B

Buddy Smith

Jan 1, 1970
0
Hi,

Newbie question......

I have a device I'm trying to turn on/off that requires 12V. I want
to control it with a micro that runs at 5V.

My question is can this be done with a power MOSFET, or do I need a
relay?

Assume that the current running through the controlled device is not
much, but it will be on mostly 24/7. It will be turned off several
times a day for say 5 seconds or so.

ttyl,

--buddy
 
B

Byron A Jeff

Jan 1, 1970
0
Newbie question......

Fire away.
I have a device I'm trying to turn on/off that requires 12V. I want
to control it with a micro that runs at 5V.
Typical.

My question is can this be done with a power MOSFET, or do I need a
relay?

How about a simple NPN transistor? power MOSFETs generally require a gate
voltage that exceeds the drain, which will be at 12V.

You can use an NPN power transistor as long as the current requirements of
your device doesn't exceed the current the micro I/O pin can supply. The
hfe for a 2N3055 ranges from 20 to 70 for example. So an I/O pin that can
supply 20ma to the base and control a load between 400ma and 1.4A.

You could use a darlington arrangement if you need to drive a larger load.

Finally if you used a relay, you would still need a transistor relay driver
to drive the relay.
Assume that the current running through the controlled device is not
much, but it will be on mostly 24/7.

How much?
It will be turned off several
times a day for say 5 seconds or so.

Now a relay could be useful here because you could run the circuit through
the normally closed contacts. No power would be consumed the majority of
the time. Activating the relay would turn the device off.

BAJ
 
J

John Fields

Jan 1, 1970
0
Hi,

Newbie question......

I have a device I'm trying to turn on/off that requires 12V. I want
to control it with a micro that runs at 5V.

My question is can this be done with a power MOSFET, or do I need a
relay?

---
If you can switch the low side of your load you can use a logic-level
MOSFET, like this:

+12
|
[RL]
|
D
ON>-------G NCH
S
|
GND


If you have to switch the high side, you could use a P-channel mosfet
driven by an NPN bipolar, like this:


+12>----------+----------+
| |
[R2] |
| S
+--------G PCH
| D
C |
ON>---[R1---B NPN [RL]
E |
| |
GND>----------+----------+
 
B

Buddy Smith

Jan 1, 1970
0
This was my first thought when the MOSFET didn't work as i'd hoped.

The application is a magnetic door lock. It pulls about 208-210 mA at
12V.

I have a couple of NPN and PNP MOSFETs laying around and can get
anything I need.

--buddy
 
J

John Fields

Jan 1, 1970
0
This was my first thought when the MOSFET didn't work as i'd hoped.

The application is a magnetic door lock. It pulls about 208-210 mA at
12V.

I have a couple of NPN and PNP MOSFETs laying around and can get
anything I need.
 
B

Buddy Smith

Jan 1, 1970
0
Also, don't forget the damper diode across the coil...


err Power MOSFETs I mean :)

I have TIP120s.

I'm really glad i'm not posting this with my IEEE email address...I'd
get banned for life :)

--buddy
 
B

Byron A Jeff

Jan 1, 1970
0
Absolutely. Collapsing magnetic fields cause really bad spikes if undamped.
err Power MOSFETs I mean :)

N-channel and P-channel. But you needed to pay attention to the fact that
John said "logic level" MOSFETs. With ordinary MOSFETS you have to get
the gate voltage well above (or below) the drain.
I have TIP120s.

Those will work. They are not MOSFETs however. A quick look at the datasheet
indicates that they have high gain (hfe of 1000 typical). So at 10 ma of
base current they can drive 5A easily. So the 200 mA of your solenoid should
be absolutely no problem.

BAJ
 
B

Buddy Smith

Jan 1, 1970
0
Absolutely. Collapsing magnetic fields cause really bad spikes if undamped.

Hm. The maglock I have is packaged with a small circuit board. I haven't
pulled it out (it's glued down) but it includes a +24V connector, a +12V
connector, and GND. There is a large resistor and a normal size disk
capacitor on the board. I figured out that the resistance of the coil
is ~ the resistance of the large resistor, so that's just a voltage
divider.

So, what's the best way to power this on and off with my TIP120? Or is
there something I should pick up that will work better? Honestly I used
these because I had them laying around and was anxious for a prototype.
Fear not, good sirs, this is not a production unit :)

N-channel and P-channel. But you needed to pay attention to the fact that
John said "logic level" MOSFETs. With ordinary MOSFETS you have to get
the gate voltage well above (or below) the drain.
Those will work. They are not MOSFETs however. A quick look at the datasheet
indicates that they have high gain (hfe of 1000 typical). So at 10 ma of
base current they can drive 5A easily. So the 200 mA of your solenoid should
be absolutely no problem.

Actually it's not a solenoid. Just a big electromagnet.

Do I need to add a diode somewhere to make this a little safer/etc?

Thanks for the advice.

--buddy
 
E

ehsjr

Jan 1, 1970
0
Byron said:
Absolutely. Collapsing magnetic fields cause really bad spikes if undamped.




N-channel and P-channel. But you needed to pay attention to the fact that
John said "logic level" MOSFETs. With ordinary MOSFETS you have to get
the gate voltage well above (or below) the drain.




Those will work. They are not MOSFETs however. A quick look at the datasheet
indicates that they have high gain (hfe of 1000 typical). So at 10 ma of
base current they can drive 5A easily.

Err - the absolute maximum continuous current is 5A, so
"easily" doesn't apply. To get the absolute maximum
continuous current of 5A (or pulse current of 8A), you
need to drive the thing with 20 mA of base current.

So the 200 mA of your solenoid should
 
E

ehsjr

Jan 1, 1970
0
Buddy said:
err Power MOSFETs I mean :)

I have TIP120s.

I'm really glad i'm not posting this with my IEEE email address...I'd
get banned for life :)

--buddy

The diagram below assumes that your door lock is
wired such that the +12V is switched. Also, it
is designed so that you don't have to break
the existing doorlock wiring - just tap into it at
one point.


+-----DoorLock-------Gnd
|
+-------|<--------+--Gnd
| D1 1N4002 |
| /
| \ R2
| / 10K
| \
e \ R1 |
Q1 |----/\/\/\-----+
TIP120 c / 470 |
| |
| |
+12------------+ |
|
+5 from micro--------------------+

If your micro can source > 25 mA, change R1 to 220 ohms.

Ed
 
B

Ban

Jan 1, 1970
0
ehsjr said:
The diagram below assumes that your door lock is
wired such that the +12V is switched. Also, it
is designed so that you don't have to break
the existing doorlock wiring - just tap into it at
one point.


+-----DoorLock-------Gnd
|
+-------|<--------+--Gnd
| D1 1N4002 |
| /
| \ R2
| / 10K
| \
e \ R1 |
Q1 |----/\/\/\-----+
TIP120 c / 470 |
| |
| |
+12------------+ |
|
+5 from micro--------------------+

If your micro can source > 25 mA, change R1 to 220 ohms.

Ed

But the TIP120 is an NPN transistor, which will need almost +14V on the base
to switch on +12V. Maybe you can use a TIP125, but with the emitter at
+12V_in, or you switch with the TIP120 in the gnd-leg of that solenoid,
which would be easier.
 
E

ehsjr

Jan 1, 1970
0
ehsjr said:
The diagram below assumes that your door lock is
wired such that the +12V is switched. Also, it
is designed so that you don't have to break
the existing doorlock wiring - just tap into it at
one point.


+-----DoorLock-------Gnd
|
+-------|<--------+--Gnd
| D1 1N4002 |
| /
| \ R2
| / 10K
| \
e \ R1 |
Q1 |----/\/\/\-----+
TIP120 c / 470 |
| |
| |
+12------------+ |
|
+5 from micro--------------------+

If your micro can source > 25 mA, change R1 to 220 ohms.

Ed

Errrp! I managed to screw that up, royally.
A large part (inverter & converter) is missing from
the first diagram, and the second diagram isn't there
at all. Hopefully, I'll get it right this time:


The diagram below assumes that your door lock is
wired such that the +12V is switched. Also, it
is designed so that you don't have to break
the existing doorlock wiring - just tap into it at
one point.


+-----DoorLock-------Gnd
|
+-------|<--------+--Gnd
| D1 1N4002 |
| /
| \ R2
| / 10K
| \
e \ R1 |
Q1 |-----/\/\/-----+
TIP120 c / 470 |
| |
| Q2 2N3906 |
+12------------+-----e c-----+
| \___/
| R3 | R4 Q3 2N3904
+--/\/\/-+---/\/\/--c e------+-Gnd
10K 470 \___/ |
R5 | R6 |
+5 from micro----------/\/\/----------+--/\/\/--+
3.3K 33K



The diagram below assumes that your door lock is
wired such that the Gnd is switched.


+-----DoorLock-------+12
|
+------->|--------+--+12
| D1 1N4002 |
| /
| \ R2
| / 10K
| \
c \ R1 |
Q1 |----/\/\/\-----+
TIP120 e / 470 |
| |
| |
Gnd------------+ |
|
+5 from micro--------------------+

If your micro can source > 25 mA, change R1 to 220 ohms.

Ed
 
E

ehsjr

Jan 1, 1970
0
Ban said:
But the TIP120 is an NPN transistor, which will need almost +14V on the base
to switch on +12V. Maybe you can use a TIP125, but with the emitter at
+12V_in, or you switch with the TIP120 in the gnd-leg of that solenoid,
which would be easier.

Hi Ban,

The TIP120 will turn on *way* lower than that. The emitter
is not at +12 - there's about 60 ohms between it and ground,
through the door lock. So you need only about two diode
drops to get it to start conducting.

But see the correction I was posting even as you were
posting your question. I totally mangled the original
diagram. I cut-and-pasted myself into oblivion when
I drew it, and ended up leaving out most of it.
I hate it when that happens! :,;

Ed


Ed
 
B

Bob Monsen

Jan 1, 1970
0
Buddy said:
Hm. The maglock I have is packaged with a small circuit board. I haven't
pulled it out (it's glued down) but it includes a +24V connector, a +12V
connector, and GND. There is a large resistor and a normal size disk
capacitor on the board. I figured out that the resistance of the coil
is ~ the resistance of the large resistor, so that's just a voltage
divider.

So, what's the best way to power this on and off with my TIP120? Or is
there something I should pick up that will work better? Honestly I used
these because I had them laying around and was anxious for a prototype.
Fear not, good sirs, this is not a production unit :)





Actually it's not a solenoid. Just a big electromagnet.

Do I need to add a diode somewhere to make this a little safer/etc?

Thanks for the advice.

--buddy

You say the board has both 12 and 24 volt power supplies. If you are
only using the 12V power supply, then you can just switch on and off the
ground with your TIP120. Connect the ground of the card to the collector
of the TIP. Connect the emitter of the TIP to the real ground. Now,
connect the base to your microcontroller using a 1k resistor.

(This is what Fields meant when he said 'low side switching'.)

When you make the port high, it'll turn on the TIP120, which should
completely saturate, thus not dissipating too much power (it won't get hot.)

When you make the port low, it'll turn off the TIP120, which will allow
your load to float up to 12V, which isn't a problem.

If you are supplying both 12 and 24 volts, though, it's possible that
there may be current flow between these two rails, so I'd only do this
if you are using one or the other. Or, you could use a diode into the
12V rail, which would prevent reverse current flow.

If the board has a coil on it, connect a 1N4001 from the point where the
collector attaches to the ground on the board, to the 12V rail. Then,
the current generated by the inductor will just circulate through the
diode until it dissipates, rather than generating a huge voltage spike
which could kill the TIP120. The TIP120 can only withstand about 60V
between collector and emitter.

--
Regards,
Bob Monsen

If a little knowledge is dangerous, where is the man who has
so much as to be out of danger?
Thomas Henry Huxley, 1877
 
Top