Scaling 0 to +5V input into -9V to +9V - Page 1
Forum section: electronics / projects

author: level6
author_rank: Regular Contributor
timestamp: September 16, 2024, 02:32:40 am
content: I'm trying to find a solution where I have an input range into a circuit of 0 to +5V DC and I need to scale that to a -9V to +9V range. I'm certain opamps are involved, but how can I essentially expand the output scale to include negative voltage values?

author: jbb
author_rank: Super Contributor
timestamp: September 16, 2024, 02:42:32 am
content: Well, first up you’ll need a +9-and-a-bit V supply and a -9-and-a-bit supply. It’s common for opamps to need some ‘headroom’ between the power supply and the desired output. This could be somewhere around 1V for a standard opamp, or some 0.05V for a ‘rail-to-rail output’ device.For the signal scaling itself, a circuit you could use is a difference amplifier. You’d need to configure it (ie select resistor values) for a gain of 5V change in input -> 18V change in output, ie 18/5=3.6x. You will also need a 2.5V (ie the middle of your 0V - 5V input) or 5.0V reference from somewhere.

author: Kim Christensen
author_rank: Super Contributor
timestamp: September 16, 2024, 03:48:01 am
content: Do you need linear or on/off logic?For logic level, you could simply use an MAX232 IC to scale a 0-5V logic signal to -9V to +9V levels.For linear, like the output of a 0-5V DAC, use op-amps like jbb mentioned.

author: Andy Chee
author_rank: Super Contributor
timestamp: September 16, 2024, 03:49:02 am
content: I assume this is to take a PWM output from a microcontroller, to convert it to bipolar for an audio amplifier or analog needle meter?Or is this digital logic 0-5V to convert into RS232 -9V & +9V?Please elaborate on your bigger picture project.

author: mianos
author_rank: Regular Contributor
timestamp: September 16, 2024, 04:08:21 am
content: I use this thingy to calculate it:https://earmark.net/gesr/opamp/gain_offset.htm

author: level6
author_rank: Regular Contributor
timestamp: September 16, 2024, 04:34:43 am
content: Quote from: Andy Chee on September 16, 2024, 03:49:02 amIt's to convert a linear DC voltage input, used to control an audio low pass filter.

author: level6
author_rank: Regular Contributor
timestamp: September 16, 2024, 04:42:08 am
content: Quote from: mianos on September 16, 2024, 04:08:21 amThanks! The site is a keeper.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 16, 2024, 05:42:33 am
content: Quote from: level6 on September 16, 2024, 02:32:40 amYou can also get a quick indication by working on span first, then offset.5V to 18 swing, is simple : a gain of 3.6You will likely bias the positive opamp pin from the 5V as that is likely more stable than the other rails.- the positive Opamp pin needs to be somewhere under 2.5V, such that a 2.5V level on IN, gives 0V on output. (2.5V-B)*3.6 = B(2.5*3.6)/(1+3.6) = 1.956521739V, divided from 5VSpice can be used to confirm this.

author: Zero999
author_rank: Super Contributor
timestamp: September 16, 2024, 11:15:54 am
content: The gain is 3.6, but the offset needs to be applied to the inverting pin, so when the input voltage is 0V, the output is -9V. The inverting gain is equal to the non-invering gain -1, giving 2.6V.The inverting input must be connected to a 9/2.6 = 3.4615V source, via a resistor of RF/2.6.Here's an example, using a 12V regulated power supply to give the offset voltage. R2 & 3 from a potential divider to get the reference voltage. The output resistance of the potential divider is equal to the values of the resistors in parallel, which is (1k1-1+2k7-1)-1= 781.6R, R5||R6 = 14k21, which is near enough 15k and 39k/15k = 2.6, for a non-inverting gain of 3.6.The circuit has a gain accuracy of 0.4% and offset of 33mV.I can explain my working in more detail, later if required.0 to 5V to +-9V.asc(1.42 kB - downloaded 25 times.)EDIT:Here's my working out.0 to 5V to +-9V working.asc(1.07 kB - downloaded 22 times.)

author: ArdWar
author_rank: Frequent Contributor
timestamp: September 16, 2024, 02:16:13 pm
content: Quote from: Zero999 on September 16, 2024, 11:15:54 amYou'll have significantly better luck at getting lower total error by tweaking the divider resistors instead of series gain resistor, and if you want to tweak the gain you might as well tweak R1 directly instead of doing R4+R5.Anyway, beat this! (well, you can always use moar resistorz)

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 16, 2024, 08:26:36 pm
content: Quote from: Zero999 on September 16, 2024, 11:15:54 amMore usual is to derive the opamp offset bias from thesame 5V that creates the DAC swing.That removes two power supply variations from the setup, and makes it ratio metric.

author: Zero999
author_rank: Super Contributor
timestamp: September 16, 2024, 09:31:20 pm
content: Quote from: ArdWar on September 16, 2024, 02:16:13 pmI didn't bother optimising it. I just used a couple of online calculators to work out the gain, potential divider and put a couple of parallel resistors in series to make up the output impedance.How accurate is the supply voltage? Probably not much better than 5%. In which case, just three resistors will be fine.0 to 5V to +-9V 3 resistors.asc(1.07 kB - downloaded 15 times.)If closer tolerance is required, then use the TL431.0 to 5V to +-9V TL431.asc(2.03 kB - downloaded 40 times.)Quote from: PCB.Wiz on September 16, 2024, 08:26:36 pmIt doesn't work like that though. See what happens both inputs are swept from 0V to 5V.In this case, a higher voltage is still required for the 12V supply, but it really doesn't matter what the reference voltage is. It just needs to be 3.4315V or significantly higher, so a potential divider can be used to generate it.

author: PCB.Wiz
author_rank: Super Contributor
timestamp: September 16, 2024, 10:13:42 pm
content: Quote from: Zero999 on September 16, 2024, 09:31:20 pm?A single supply must always have fewer variations and noise sources, than using two supplies.Yes, the simple gain of this system means the absolute value of the 5V, sets the absolute value of the span.However at the usually more important mid point, the bridge nature of the circuit reduces the error of the zero output point.

author: ledtester
author_rank: Super Contributor
timestamp: September 17, 2024, 02:23:32 am
content: Quote from: level6 on September 16, 2024, 04:42:08 amAnother oft cited reference:Designing Gain and Offset in Thirty Secondshttps://www.ti.com/lit/an/sloa097/sloa097.pdf

author: Zero999
author_rank: Super Contributor
timestamp: September 17, 2024, 06:10:10 pm
content: Quote from: PCB.Wiz on September 16, 2024, 10:13:42 pmOn the other hand, with separate power supplies, the noise is not correlated.I don't know where you got the DAC from. No mention of it was made by the original poster.For completeness, here's an example of the circuit configured for use for a 5V reference.