Sign up ×
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It's 100% free.

I have designed the following circuit to interface a 12-20V signal to a microcontroller running on 3.3 volts. The signal is either 20V or open circuit.

I want the circuit to be as resilient as possible. It should be able to handle EMI and ESD.


  • R1 is to limit the current and bias the transistor.
  • C1 is to implement a low pass filter.
  • R2 is used to pull down the transistor base and discharge the capacitor C1, the 20V input is either 20V or open circuit.
  • D1 is used to protect the transistor from negative voltage at the base.
  • R3 is to pull up microcontroller pin.

Any comments and improvements upon this circuit are welcomed.

Side question: Whats the maximum positive voltage this transistor can tolerate. The datasheet states peak base current to be 100mA. If base is maintained at 0.7 volts, then input can be as much as 1000 volts (10k ohm * 100mA). But if input is 1000 Volts the potential divider makes voltage the base at 500 volts. And the maximum Vcb according to datasheet is 60volts.

share|improve this question
The base to emitter diode will load the resistive divider, limiting it's output voltage to about 0.7V. So in the high input voltage case you can neglect R2 for calculating input voltage. Current through R2 will be approx. 0.7/10k = 70uA, so input voltage will in practice only depend on 100mA × 10k. But be careful with total power dissipation. – jippie Aug 10 '14 at 17:23
The diode is reverse biased, It is meant to conduct in case of negative voltage. I need R2 to discharge the capacitor anyway. – hackerbro7 Aug 10 '14 at 17:27
I am typing about the internal base to emitter diode. Are you familiar with how a BJT works? – jippie Aug 10 '14 at 17:28
@jippie my bad I thought you were talking about D1. – hackerbro7 Aug 10 '14 at 17:37
I'm very interested in car battery/alternator signal interfacing too, have you considered using optocouplers? They are basically the same as what you have here, a BJT-style interface. I am intending to use a simple voltage divider with zener diode over-voltage clamping (after the divider!) and high enough resistor values so that the zener diode will survive prolonged "ON" conditions if it happens. I will also have a low ESR filter capacitor on each input to deal with voltage spikes... – KyranF Aug 10 '14 at 22:07

3 Answers 3

up vote 6 down vote accepted

Looks good to me. The inverse diode D1 is a good idea. If you have a minimum of 12V available you may wish to reduce R2 somewhat. This circuit has a threshold of maybe 2V, you could easily halve R2 or double R1.

In the case of momentary extreme over-voltage, the base-emitter voltage (forward biased) will not rise above a volt or so, even with 100mA. It looks like another diode in inverse parallel to D1. One of the advantages of a BJT in this application. The limitation is more likely to be the voltage rating of R1.

If you want to consider sustained overvoltage, you may have to consider the power rating of R1. If some idiot connects it to the mains (we can usually assume that about 240VAC is the most voltage idiots will have access too- idiots with access to higher voltages are sort of a self-eliminating problem) then R1 would dissipate almost 6W, so it would have to be a physically large part. You could solve that issue by increasing the value of R1 so that a smaller part could be used.

share|improve this answer
Only source of overvoltage is EMI. So I think standard resistors would work alright. I did not follow the first paragraph of your comment. I do have a minimum of 12V available (it comes from a car battery) but I don't get what reducing R2 would do. Care to elaborate? – hackerbro7 Aug 10 '14 at 17:32
It switches at about 2V, which is a bit low (6V should be plenty low enough for a car battery), so maybe you want to shift the threshold up to 4V or so. It adds a bit of noise immunity. Often you'll see a series Zener in industrial circuits for this reason, but I think just changing a resistor 2:1 is okay in this case. – Spehro Pefhany Aug 10 '14 at 18:57
@SpehroPefhany LOL on the self-eliminating idiots. The only additional comment is the response time. With the relatively large cap and resistor values the OP may want to be sure that the circuit reacts quickly enough for the application. He does specifically mention lowpass filtering so he's probably already considered it, but can't hurt to double-check. – John D Aug 10 '14 at 19:34

I designed a very similar circuit myself once when I needed some "rugged" inputs. However, I used R1 = R2 = 100k (rather than 10k). It really doesn't take much input current to saturate Q1 with R3 = 10K. Reduce C1 by the same factor if you want to keep the same corner frequency.

If you want some hysteresis to improve the switching characteristics, you might consider putting a 100Ω resistor between Q1's emitter and ground, and then tying the bottom end of R2 to that junction.

share|improve this answer
+1 for method of adding hysteresis. It's amazing what the merest whisper of positive feedback can do to quieten down slow and/or noisy inputs. – Russell McMahon Aug 14 '14 at 13:45

Circuit looks OK for not too demanding use.
At extreme extremes it may stutter.

Frequency response to input signal and acceptable rise and fall times were not specified and if important need to be known.

Vbe of Q1 will clamp base at ~= 1V max.
Ibe can be limited by using say two diodes from R1-R2 junction to ground and a small resistor (say 100 Ohm) from this point to Q1-base so that the diodes clamp massive Vin transients to about 1.5 - 2 V and transistor clamps base to say 0.7V.
Example: If a transient drives input to 1000V, I_R1 = 100 mA.
If two diodes clamp bottom end of R1 top say 2V, base current is then
(2V-Vbe)/100R = 13 mA.
Values can be adjusted to suit.

Resistors have voltage ratings which are independent of dissipation.
At very high voltages the voltage rating of R1 becomes important.
Dissipation in R1 is ~=V^2/R so 1 Watt at 100V with R1 = 10K.
At 1000V R1 dissipation is V^2/R = 1,000,000/10,000 = 100 Watt.
You'd not want to have that present for long or have to provide a resistor that can handle that steady state.
This is NOT required for ESD. If you ever did get a situation where very high voltage might occasionally be present for more than milliseconds you could use a switched input that turned off under very high voltage conditions.

IF response times need not be high R1 can be increased in value to suit higher voltage conditions.

share|improve this answer

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.