I have a 28V digital signal. 28V being logic 1 and 0V being logic 0.

Can I feed the 28V into an opamp (Vcc @5V) to level shift it ? Or will I have to create a voltage divider to bring the 28V < Vcc ?

  • 1
    \$\begingroup\$ Why do you need an opamp at all? How fast are these "digital" signals switching? \$\endgroup\$ – Dave Tweed Feb 14 '13 at 20:12
  • \$\begingroup\$ 2.5Mhz.The reason for the opamp is so i can get a clean signal out. With a voltage divider, any skew that might be there, will also translate to the output, but with an opamp with a threshold on V-, I can set what voltage it will switch at, and give me (hopefully) a much sharper output. \$\endgroup\$ – efox29 Feb 14 '13 at 23:30
  • \$\begingroup\$ A comparator would be a better choice than an opamp. You'll still need a voltage divider to bring the level down to its input range. But I'm not sure what you mean by "skew" -- are you referring to sub-optimal rise/fall times? \$\endgroup\$ – Dave Tweed Feb 14 '13 at 23:46
  • \$\begingroup\$ I'd be using the opamp was a comparator . There appears to be some capacitance on the line, which is giving me some slight sub-optimal rise/fall times. Is skew not the right word ? Is it slew ? \$\endgroup\$ – efox29 Feb 14 '13 at 23:49
  • \$\begingroup\$ Yes, slew rate is a better word for that. Skew generally refers to the timing relationships among multiple signals. In any case, a purpose-built comparator chip will perform better than an opamp running open-loop as a comparator. They're available in the same packages (e.g. quad) at essentially the same cost. \$\endgroup\$ – Dave Tweed Feb 14 '13 at 23:54

Direct feed isn't going to work well for you.

You'll find that the common-mode input range of an opamp is quite often less than the supply voltage rails (less than VCC, greater than VEE) . Some parts (those with rail-to-rail inputs) can accept signals at the same potential as the supply lines.

Usually there are p-n junctions between the opamp inputs and the rails (sometimes deliberate, often parasitic) which can forward-bias and fry if a stiff signal higher than the postiive supply or lower the than negative supply is applied.

Current-limiting the source will cause the voltage at the input to clamp a diode drop above or below the rail (depending on polarity) but there's no guarantee the rest of the opamp will behave nicely in this condition.

  • 1
    \$\begingroup\$ It is worth mentioning that exceeding the common mode voltage may lead to phase-reversal phenomenon. \$\endgroup\$ – Szymon Bęczkowski Feb 14 '13 at 19:01
  • 1
    \$\begingroup\$ Learned something new! Awesome. \$\endgroup\$ – efox29 Feb 14 '13 at 23:46

You need a voltage divider. Putting signals larger than the span of the power pins on the op amp inputs can cause permanent damage to the op amp.


Although in this case it's probably much simpler just to use a voltage divider, I'd like to point out that this can be done.
With an inverting opamp, you can do this. Since the output drives the opposite way to the input, you can make use of this to compensate (work against) the input voltage and make sure the inverting input does not see a higher voltage than it's supply. Using the correct ratio of Rin and Rf, you can adjust the gain as necessary. If it's a DC input, you need to compensate for this at the non-inverting input though.

This maybe better explained with an example circuit (note that a rail to rail output opamp stable at all gains is required). This takes a 28V pk-pk waveform (i.e. -14V to +14V) and outputs a 0-5V waveform (so we have an input voltage that exceeds both rails):

+-28V to 0-5V


+-28V to 0-5V simulation

How do we calculate R3 and R2?
This bit's easy, we just need a gain of 5/14 = 0.178. If we have a 10kΩ Rin (R3), we can use:
10kΩ * (5 / 28) = 1.78kΩ

What about R1 and R5?

We know that when the input is at +14V, the output should be at 0V. Using this info and knowing that no current flows into the non-inverting input, we can treat R3 and R2 as a voltage divider. Since the opamp will try and make the inputs equal, we need the non-inverting input to be the same as the voltage at the non-inverting input at this point.

So let's work out the voltage at the non-inverting input:

14V * (1.78k / (10k + 1.78k)) = 2.115V

So wee just need to apply 2.115V to the non-inverting input to compensate and shift the output voltage. Using the +5V supply and a voltage divider:

2.115V / 5V = 0.423 - this is the ratio we need.

So R5 / (R5 + R1) = 4.23k / (4.23k + 5.77k) = 0.423 and:

5V * (4.23k / (4.23k + 5.77k)) = 2.115V

How to calculate for various configurations, and much more is discussed in Opamps for Everyone, a good free book from TI.

  • \$\begingroup\$ Well input and output waveforms needs to be in phase, so the inverting config won't work. I don't have access to schematic here, but rather than feedback and gain (because I dont care, I want it to go to the supply rails of +5V and Gnd, why not just use a voltage divider on the V+ to bring my 28V signal to a manageable voltage, like 4.5V, and use a voltage divider on the V- to set a threshold like 2V. When the V+ > 2, Vo = +5 When V+ < 2, Vo=0V. With nice clean transistions. \$\endgroup\$ – efox29 Feb 14 '13 at 23:46
  • \$\begingroup\$ @efox29 - okay, I see. You could either stick another inverting buffer in front or compensate in firmware. At the start of my answer I said it's easier to use the voltage divider in this case - I was mainly just showing an alternative way a higher voltage than the supply rails can be dealt with. A dedicated comparator would be better for a high speed digital signal. \$\endgroup\$ – Oli Glaser Feb 14 '13 at 23:49
  • \$\begingroup\$ I understand and I appreciate the alternative solution. That's what I love about this site. The reason for not simply the voltage divider was because my rise/fall times are not quite what they should be. They will still work, but I'd rather have a sharper level transition. \$\endgroup\$ – efox29 Feb 14 '13 at 23:53

I have asked the same question here previously.
Later, I learned that the datasheet already gives this information.

Open the datasheet of your opamp. Find the table in which "the absolute maximum ratings" are listed.

Example #1:
enter image description here

Example #2: enter image description here

Example #3: enter image description here

  • 1
    \$\begingroup\$ The chip is guaranteed to NOT BE DAMAGED at Absolute Maximum Ratings. That DOES NOT MEAN it is guaranteed to WORK. It just means that when you go from something between working conditions and absolute maximum conditions, the chip will still work. \$\endgroup\$ – Scott Seidman Apr 25 '14 at 15:22

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.