Controlling 12V from 5V

Jun 29, 2005 13 Replies

Fire away.

Typical.

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.

How much?

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

--- 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>----------+----------+

--- If you care to post your load current I'll be happy to give you some advice as to which devices you can use.

-- John Fields Professional Circuit Designer

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



MOSFET flavors don\'t include NPN and PNP. :-) Also, don\'t forget the damper diode across the coil...

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. So the 200 mA of your solenoid should be absolutely no problem.

BAJ

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

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

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

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

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 | +-------| 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.
ciao Ban Bordighera, Italy

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 | +-------||--------+--+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

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

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

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required