Electronic – How is this circuit for interfacing 20V signal with 3v3 microcontroller

bjtmicrocontrollerpictransistors

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.

circuit

  • 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.

Best Answer

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.