Take the 2-minute tour ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free, no registration required.

I'd like to have a 12V signal as an input to a microcontroller, but it can only handle 5V on the input pins. This circuit will be used in a truck, so the "12V" signal can vary by quite a lot.

My question is this: Is it possible to drive a N-MOSFET with a higher voltage than what will be switched? The picture below shows what I'd like to do.

Circuit diagram

In this circuit, the 5V will be regulated, and stable.

I don't want to use a resistive voltage divider, as the input could be very variable, and this could either damage the MCU, or provide an unreliable signal. I'm open to alternate suggestions as to how this could be done.

share|improve this question
Probably not the best approach, most MOSFETS have maximum \$V_{GS}\$ of \$\pm 20 \, \mathrm{V}\$. –  venny Aug 27 '14 at 20:04
To add to the question: I don't care too much about speed. It will be mainly used for switches, not communications. –  CaiB Aug 27 '14 at 20:53

3 Answers 3

up vote 6 down vote accepted

Your circuit will work, but will have some problems in a automobile environment. The "12V" in a car can be 50 V or more for short periods. Your circuit puts this voltage minus about 5 V accross the gate and source terminals of the FET. It won't like that. Most FETs have a max G-S rating of 15-20 V. Your circuit also lacks a pulldown, so the output voltage is undefined when the 12 V line goes low.

Here is a better way to do this:

This circuit will invert, but since its output is going into a microcontroller that shouldn't matter. Generally microcontroller inputs can be arranged to be either polarity by the firmware.

The transistor will turn on when the "12V" line gets to around 6 V. However, with the 91 kΩ resistor in series with the "12V" line, high voltages on that line won't bother anything. A spike will just cause a little more base current, which won't matter since the transistor is already saturated with 12 V on the line anyway.

share|improve this answer
Is there any specific reason that you used a 2N4401 transistor? Would a 2N2222 work (I have about 100 of them laying around)? –  CaiB Aug 27 '14 at 20:57
@CaiB They both operate very similarly. They're both general purpose switching transistors. One main difference current capability but that doesn't matter in this usage model. –  horta Aug 27 '14 at 21:00
Is there really some real life situation where you can't arrange the micro input as you want? I can't think of any hw limitation, nor a sw one. –  Vladimir Cravero Aug 27 '14 at 21:14
@CaiB: The '4401 and '4403 are my jellybean NPN and PNP transistors I use unless there is a reason not to. In this case there isn't, but just about any small signal NPN will work in this role. '2222 and '3904 are also common small signal NPN, but the 4401 has better current capability and robustness, so fits in more applications. In this application it doesn't matter. You can safely substitute a 2222 or 3904 or many other small signal NPN transistors. We're not asking a lot from the transistor here. –  Olin Lathrop Aug 27 '14 at 21:42
Thank you for your help. I've marked your answer as accepted, as I used this design. What software did you use to draw that? –  CaiB Aug 28 '14 at 22:09

You can, but it would be necessary to protect the MOSFET gate from overvoltages, etc. Also, the source-follower (common-drain) configuration is probably not the best for this application.

A BJT-based circuit would probably be both cheaper and more rugged overall.

share|improve this answer
You would definitely need a resistor in series with the gate, and a TVS diode/Zener from gate to source to handle spikes and load dump conditions on the 12V input. The source-follower should be OK since 12V is plenty to get enough Vgs to turn the FET on. –  John D Aug 27 '14 at 20:08
+1 The circuit Dave linked to is about bulletproof and inexpensive. Note that it's inverted (high on the 12V in is low on the 5V out). –  Spehro Pefhany Aug 27 '14 at 20:30

I would either go with what Dave stated or depending on the situation go with a source-follower in a flipped configuration. The way you'd switch it would actually be reverse common-gate.

In this way, you have more protection from high input voltages without requiring extra components.


simulate this circuit – Schematic created using CircuitLab

When the 12V is high, the signal to the MCU would be roughly 5V-Vt or 4.3V. When the 12V drops low, any charge on any parasitic capacitances at the output pin would drain through the bleed-off resistor. The trade-off here is speed vs on-current. The lower the resistance, the faster it will shut off. The higher the resistance, the less current will be burned.

This has its drawbacks as outlined, but it is simple.

share|improve this answer
That's a terrible suggestion. Vt for the IRF530 is on the order of 2.0 - 4.0 volts, not 0.7 volts as you suggest. –  Dave Tweed Aug 27 '14 at 20:28
@DaveTweed I would hope he's not using a power mosfet to drive a signal pin on an MCU. –  horta Aug 27 '14 at 20:29
The point is you're telling him to use a power MOSFET. –  Olin Lathrop Aug 27 '14 at 20:31
My comment relates to your schematic, not his. If that isn't what you meant to use, edit the diagram. –  Dave Tweed Aug 27 '14 at 20:32
@DaveTweed Ah, sorry about the schematic. I just sketched it up not realizing the default parts slapped to it. Thanks for the correction. –  horta Aug 27 '14 at 20:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.