I am trying to design a circuit for level-shifting a PWM signal coming from a sensor and reading it with a 5V micro controller in an automotive environment. I will run my design by an EE at the end but I am trying to give it a good go myself. Here are the specs:

  • PWM signal has a frequency of 18kHz and operational peak to peak voltage of min 5.5V and max 15.5V. There are are conducted transients on the input line as well as possibility of ESD but I am using a TVS diode to clamp to a safe voltage (if possible to around 45V but I can clamp lower at a cost penalty). During transients/ESD, signal integrity is not important.

  • Since I am measuring the positive duty cycle (minimum 6.4us) I would like to keep the rising/falling edges of the signal sharp. Current rise time of the signal is 50ns and it can probably be degraded up to 200ns before accuracy becomes a concern

  • Maximum allowable current drawn from the PWM source is 1 mA (preferably less).
  • Cost should be kept as low as possible while satisfying the above constraints.

I can think of a few alternatives:

  1. PWM > series resistor > N-channel MOSFET in common-source configuration.
  2. PWM > series resistor > NPN BJT in common-emmitter configuration.
  3. PWM > series resistor > schottky diodes clamping to 5V and GND (cheap, but the current draw at 15.5V with 2.2K series resistor is 4mA which is too much. Any more than 2.2K and the signal is degraded too much)

What one of these alternatives (or others) do you guys recommend?


I would be inclined to use an NPN transistor. The gate capacitance of a MOSFET, combined with the limited current you can draw, is going to present some serious problems WRT edge timing.


simulate this circuit – Schematic created using CircuitLab

27k base resistor limits current to about 200 to 600 µA. Schottky diode between base and emitter clamps any negative-going input transients. Second one from base to collector, just like with Schottky logic, serves to keep the transistor from fully saturating, keeping the switching action fast.

  • \$\begingroup\$ Thanks for the circuit. However, wouldn't the 27k resistor cause significant edge degradation coupled with parasitic capacitances? When I probe the PWM signal after a 2.2k resistor, the signal is already a little distorted (rise time increased from 50ns to 200ns). Am I missing something? \$\endgroup\$
    – lyxicon
    Jan 18 '15 at 3:22
  • \$\begingroup\$ How much fidelity do you need? Yes, 10 pF of stray capacitance in conjunction with 27k gives you a time constant of 270 ns. But a simple RC delay won't distort your duty cycle measurements very much at all. What is your ultimate accuracy goal? What are the resolution and delay characteristics of the hardware on the microcontroller? \$\endgroup\$
    – Dave Tweed
    Jan 18 '15 at 12:48

Given your constraints, I'd probably choose the MOSFET. My reasoning is that if you want to minimise current consumption from the signal source then a MOSFET is a good solution.

You would need to ensure that all of the voltage ratings on whatever MOSFET you choose exceed your 45V lower limit - say, at least 60V if possible. Vgs in particular is important; if you can't find a part with a high enough Vgs then you'll need to select a voltage divider ratio that ensures the maximum applied Vgs is less than the maximum for the part, but the minimum applied Vgs is enough to switch the part on.


An Op Amp (either built in the microcontroller or discrete) would do the job. A voltage divider may be required.

  • 2
    \$\begingroup\$ Why would you use an opamp rather than, say, a high-speed comparator? Can you show what configuration would address all of the issues raised in the question? \$\endgroup\$
    – Dave Tweed
    Jan 17 '15 at 12:35
  • \$\begingroup\$ He said "rise time of the signal is 50ns and it can probably be degraded up to 200ns before accuracy becomes a concern", so I don't think he really needs "high-speed comparator". \$\endgroup\$ Jan 18 '15 at 7:53
  • \$\begingroup\$ He said "Maximum allowable current drawn from the PWM source is 1 mA (preferably less)". An Op Amp normally at the same cost takes lower input current, from my experience. \$\endgroup\$ Jan 18 '15 at 7:59
  • \$\begingroup\$ He said "Cost should be kept as low as possible while satisfying the above constraints." A built in Op Amp could be cheaper than proposed discrete transistor. \$\endgroup\$ Jan 18 '15 at 8:05
  • \$\begingroup\$ Analog signal conditioning could easier be implemented with an Op Amp as for me. And, if he really needs a hysteresis, he could add some positive feedback. Did I miss something? \$\endgroup\$ Jan 18 '15 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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