2
\$\begingroup\$

I have a 5V power supply and an input voltage that’s between 0V-5V. I need to create a circuit where, after feeding the input voltage X (X is between 0V-5V), the output voltage is 5-X (5 MINUS X) V. Would this be possible to achieve without any ICs?

Edit: The output is supposed to be used as the inverting input of an Op-Amp. Some give is okay (~300mV).

\$\endgroup\$
8
  • 1
    \$\begingroup\$ You can use the LM358 as a differential amplifier. But the rail-to-rail feature of the LM358 will let you down. \$\endgroup\$
    – Tyassin
    Commented yesterday
  • \$\begingroup\$ You want the output to be 5 times X, or 5 minus X? I read your question as 5 minus X, but the two answers have me questioning... \$\endgroup\$ Commented 23 hours ago
  • 2
    \$\begingroup\$ Its 5 MINUS X, I don’t know how some got that confused.. I wrote “-“. \$\endgroup\$
    – Victor Ban
    Commented 23 hours ago
  • \$\begingroup\$ Not sure about the final application nor the limitations of your input voltage X. A simple resistor with one end connected to +5V and the other to X, would produce a differential voltage across the resistor...More details may be needed but measuring across this resistor will yield the difference albeit not directly referred to GND \$\endgroup\$
    – Big6
    Commented 23 hours ago
  • \$\begingroup\$ Do you have a minus supply voltage available? \$\endgroup\$ Commented 23 hours ago

6 Answers 6

6
\$\begingroup\$

If you're OK with the output only swinging to within 150mV of each rail, you can try this IC-less circuit.

It's a current mirror where the input current flows through R4 and Q1 and is duplicated in R5 and Q2 which provides an output inverted with respect to input.

If the signal were connected directly to R4 the current through Q1 would crap out when its base reached 0.6V, so instead R1-R2-R3 attenuate the signal and center it around 2.5V such that the negative peak never turns off Q1. R5 being higher than R4 adds gain to compensate for the attenuation.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ This is simple enough and works great fot my use case. Could you tell me how did you choose those resistor values? Some seem pretty odd. Thanks! \$\endgroup\$
    – Victor Ban
    Commented 13 hours ago
5
\$\begingroup\$

Unfortunately I only have a LM358 which is not Rail-To-Rail.

Then you can add an NPN transistor to achieve nearly a rail-to-rail output;

enter image description here

Note that the + and - inputs of the op-amp are reversed to make up for the fact that the NPN transistor inverts the signal. The output ranges from 4.8 V to about 0.2 V. You may need to add a small capacitor across the feedback resistor to avoid oscillations. Also, add a 100 nF capacitor across the 5 V supply close to the IC.

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

Would this be possible to achieve without any ICs?

Yes. But it would be much more complicated.

With a IC: It requires an op-amp with rail-to-rail output and 4 resistors.

enter image description here

Without an IC: You could recreate the op-amp functionality with discrete transistors, which would add at least 5 transistors, a capacitor, and a few more resistors. For example, this one.

With minimal components and no ICs, you could use a relay and 2 capacitors. It's ugly, but workable.

enter image description here

\$\endgroup\$
5
  • \$\begingroup\$ Unfortunately I only have a LM358 which is not Rail-To-Rail. Could you tell me more about the transistors circuit? \$\endgroup\$
    – Victor Ban
    Commented yesterday
  • \$\begingroup\$ I added a link to a page that describes how to make an op-amp with discrete components. \$\endgroup\$ Commented yesterday
  • 1
    \$\begingroup\$ Thank you very much, I’ll definitely look into it! \$\endgroup\$
    – Victor Ban
    Commented 23 hours ago
  • 2
    \$\begingroup\$ the relay circuit is unlikely to work well, the NO contacts may not actually close. \$\endgroup\$ Commented 18 hours ago
  • \$\begingroup\$ @Jasen Слава Укра?н? As I said: it's ugly. \$\endgroup\$ Commented 7 hours ago
2
\$\begingroup\$

Don’t expect much accuracy and you must give up about 0.5V on both sides (Vcc and Gnd) from 0-5V range.

Make R6 variable from 220 ohm trimmer to set some bias current when a 0V is on input.

Blue is V2 , a green is Q1 collector.

enter image description here

Note: The Q2 compensates the Q1 BE offset (0.7V) and increases the input impedance.

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

If your 5 V supply and 0 V to 5 V signal don't need to share a common ground you can connect them in series opposing (in series with positive to positive) and take the output from across a load resistance. The signal then subtracts from the supply voltage, inverting the signal.

This is about as simple as it gets, but again, it relies on the signal voltage being floating. You'll also have to take into account the signal source impedance as it will affect the output voltage. The load resistor should be at least two orders of magnitude higher (x100) than the signal source impedance. So if the source impedance was 100 Ω the load should be at least 10 kΩ.

enter image description here

In the schematic E1 is just there to give a ground referenced version of V2 so it's easier to chart, you would leave it out in hardware.

\$\endgroup\$
1
\$\begingroup\$

You can try use this circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

It is very important that Rc is big enough so that Q1 is in saturation.The output impedance(under no load) of this circuit is Rc||Re and since typically Rc>>Re it will be a little bit smaller than Re.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.