12V PWM to 5V PWM converter

Thread Starter

sujith.g

Joined Jul 7, 2015
48
12-5PWM.png Hi All,

I am currently working on an automotive application. I need to convert a 12V PWM signal sent from the ECU to a 3.3V PWM signal. In other words I need to level shift the PWM signal as my controller operates in 3.3V. Can I just use a NPN transistor where I feed 12V PWM signal to base and use a 3.3V collector voltage so that I get a 3.3V PWM output. Please correct me if I am wrong. Please see my attached circuit.
 
Last edited:

PeterCoxSmith

Joined Feb 23, 2015
148
Your circuit will invert the signal.
You could use a non-inverting buffer like MC74VHC1GT50. The input will need a voltage divider to limit the swing to safe level.
 

Thread Starter

sujith.g

Joined Jul 7, 2015
48
Your circuit will invert the signal.
You could use a non-inverting buffer like MC74VHC1GT50. The input will need a voltage divider to limit the swing to safe level.
Hi Peter,
Thanks for the reply. What if I could correct the re-inverted output in software logic. I am only concerned if we can feed a 12V PWM input to the base of a npn transistor. The chosen transistor is BC817. Actually we have a space constrain on our board so a transistor would take the least space. However reliability is our priority.
 

Alec_t

Joined Sep 17, 2013
14,328
Your circuit will be fine, if you do the PWM inversion in software, but I would increase the value of R1 to somewhere in the 1k to 10k range.
 

PeterCoxSmith

Joined Feb 23, 2015
148
Hi Peter,
Thanks for the reply. What if I could correct the re-inverted output in software logic. I am only concerned if we can feed a 12V PWM input to the base of a npn transistor. The chosen transistor is BC817. Actually we have a space constrain on our board so a transistor would take the least space. However reliability is our priority.
Depends what the 12V PWM can drive. Can it supply the base current? Also depends what the 3.3V PWM is used for, whether you can invert it in your application. The buffer is a tiny chip no bigger than a transistor; so no problem with size. Buffer Timing may be better than the transistor which has passive turn on/off characteristics.
 

Thread Starter

sujith.g

Joined Jul 7, 2015
48
What is wrong with the obvious?
View attachment 94631
Hi Mike,
Thanks for your reply. This was my first thought. But since it would be an automotive application, there is a possibility that the 12V PWM signal coming from the ECU of the vehicle may fluctuate. In that case the output after the resistor divider may in turn fluctuate beyond 3.3V which may damage the 3.3V microcontroller IC that is receiving the signal. The microcontroller receiving the PWM operates on 3.3V.
 
Last edited:

Thread Starter

sujith.g

Joined Jul 7, 2015
48
Your circuit will be fine, if you do the PWM inversion in software, but I would increase the value of R1 to somewhere in the 1k to 10k range.
Hi Alec,

Thank you for the reply. So I might as well proceed according to your suggestion. :)
 

ian field

Joined Oct 27, 2012
6,536
Hi Peter,
Thanks for the reply. What if I could correct the re-inverted output in software logic. I am only concerned if we can feed a 12V PWM input to the base of a npn transistor. The chosen transistor is BC817. Actually we have a space constrain on our board so a transistor would take the least space. However reliability is our priority.
You could also add a second transistor stage to invert it back again.
 
Top