1
\$\begingroup\$

I can convert a 12 V PWM signal into 5V signal, by using voltage divider on 12 volt signal , then directing it to base of NPN common emitter transistor with collector connected to 5V

schematic

simulate this circuit – Schematic created using CircuitLab

How can i do same using Op amp ?

\$\endgroup\$

closed as unclear what you're asking by Olin Lathrop, Voltage Spike, uint128_t, Wesley Lee, Dmitry Grigoryev Apr 24 '17 at 11:51

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ It is possible to do it but beware of slew rate. If the pwm is too fast, the signal will no longer be square like. \$\endgroup\$ – M.Ferru Apr 21 '17 at 11:24
  • 2
    \$\begingroup\$ The main issue with this circuit is that it inverts the signal. So a 10% PWM signal at 12V becomes a 90% signal at 5V. \$\endgroup\$ – Finbarr Apr 21 '17 at 11:30
  • 1
    \$\begingroup\$ This site has a integrated schematic editor. Use it. ASCII art need not apply. \$\endgroup\$ – Olin Lathrop Apr 21 '17 at 11:32
  • \$\begingroup\$ Depending upon what you're doing with the signal, an op-amp is probably NOT what you want to be using. There are dynamic considerations, and more limitations on the output current than good approaches. \$\endgroup\$ – Scott Seidman Apr 21 '17 at 12:45
  • \$\begingroup\$ Yes it's possible. You make a voltage divider on your MCU pin, and put the opamp in a box where you keep stuff for your future projects. \$\endgroup\$ – Dmitry Grigoryev Apr 24 '17 at 11:51
0
\$\begingroup\$

It depends upon your PWM frequency and the shortest mark/space pulses resulting from the nearest PWM positions to 0 % and 100 %.

This would carry out the general function:

schematic

simulate this circuit – Schematic created using CircuitLab

The op-amp's '-' input is held at 2.5 V (half of 5 V).

The op-amp's '+' input switches between 0 V and around 4 V (about a third of 12 V, more precisely 3.8 V).

You will have to choose a suitable op-amp for your PWM frequency. If your PWM frequency is too high or the mark/space pulses too short, R1 and R2 should be lowered to ensure a fast rise/fall time at the op-amp pins while charging/discharging the stray capacitance there.

\$\endgroup\$
  • \$\begingroup\$ is it non inverting op-amp configuration ? \$\endgroup\$ – user6363 Apr 21 '17 at 11:42
  • \$\begingroup\$ what will be the gain formula for this ? .. Also if it is noninverting amplifier then o/p should connect to the feedback resistor like in this link electronics-tutorials.ws/opamp/opamp_3.html but you are connecting Rf=R3 to 5V ? \$\endgroup\$ – user6363 Apr 21 '17 at 12:00
  • \$\begingroup\$ @user6363, it's open-loop, there is no feedback. Can you post fully-formed questions or conclusions rather than just bits of thinking, please :-) \$\endgroup\$ – TonyM Apr 21 '17 at 12:02
  • \$\begingroup\$ Thanks for reply.. I want to know how output will be 5V when i/p applied will be 12V ..? as per this link nptel.ac.in/courses/Webcourse-contents/IIT-ROORKEE/… .. it seems your circuit is .. open loop differential amplifier .. and its o/p is vo = Ad (vin1 – vin2 ) .. where Ad will be open loop gain .. so for your circuit it will be vo = Ad(3.8 - 2.5) .. so what is value of Ad for this op amp .. that o/p will be 5V ? \$\endgroup\$ – user6363 Apr 21 '17 at 12:21
  • \$\begingroup\$ @user6363, it's being used as a comparator. Try searching google for 'op-amp as a comparator' or read www.analog.com/media/en/technical-documentation/application-notes/AN-849.pdf \$\endgroup\$ – TonyM Apr 21 '17 at 12:23
2
\$\begingroup\$

This is a simple circuit to get the job done. You can use a simple voltage divider followed by a buffer.

schematic

simulate this circuit – Schematic created using CircuitLab

Choose the op-amp, R1 and R2 to suit your application's requirements. I have chosen R1 = 1K, R2 = 1.5K. When the input is 12V, the output is 4.8V. You may find more suitable values to get 5V on the output.

If you use 5V to power the op-amp you may not get 4.8V on the output because op-amp output voltage is never the same as the op-amp supply voltage. Using 12V supply for the op-amp can give you better results.

\$\endgroup\$
2
\$\begingroup\$

Many circuit using opamp can fit your need. There is some point you have to consider :

  • The original circuit on your post change the polarity of the PWM (70% duty become 30% duty cycle PWM)
  • Opamp have slew rate, this mean, at high frequency, the PWM's waveform may change. Choose your part wisely ;)
\$\endgroup\$
0
\$\begingroup\$

How can i do same using Op amp ?

One inverting amp will do. Or two inverting amps if you want to maintain the same polarity.

But there are much simpler ways for you to do that.

\$\endgroup\$
0
\$\begingroup\$

If all you are doing is feeding the attenuated signal to an Arduino digital port then just use a resistor potential divider: -

enter image description here

Let's say you make R2 = 1 kohm, then R1 has to be 7/5 * 1 kohm = 1.4 kohm

You might choose to make R1 = 1.5 kohm (in case the 12 volt rises a little bit). Check your logic high levels on the Arduino to see how high R1 could be before it fails to register a logic one when 12 volts is at the input.

For instance, a lot of IOs are TTL compatible meaning that 2 volts is the minimum logic 1 so, make a potential divider from 12 volts to 3 volts. This would make R1 = 1.8 kohm.

Using fairly low resistance values means rise and fall times will be largely unaffected at the output (unlike an op-amp or a comparator which will likely worsen the rise times and add a delay). Stay simple if you can.

\$\endgroup\$
  • \$\begingroup\$ You really should explain why this won't work well if it is NOT being used to simply drive an Arduino digital port. \$\endgroup\$ – Scott Seidman Apr 21 '17 at 12:49
  • \$\begingroup\$ @ScottSeidman the op shows it connecting to such a port and my words in my answer were reinforcing this. It will work well in the situation and many situations but to generalise situations where it won't work well is perhaps going too far. \$\endgroup\$ – Andy aka Apr 21 '17 at 12:57
  • \$\begingroup\$ Concern isn't for this poster, but for other beginners who try to use your fine solution in a situation where it isn't so fine. It's an error I see all the time, and probably worth a sentence to help novices avoid it. \$\endgroup\$ – Scott Seidman Apr 21 '17 at 13:10

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