Offset and scaling in single supply design - Page 1
Forum section: electronics / projects

author: DigitalDesigner
author_rank: Contributor
timestamp: June 09, 2025, 09:00:12 pm
content: Hi,not great at analog and op-amp design... and I am trying to measure a voltage that varies continuously from 10V to 24V from the ADC in a micro that only runs at 3V3.Is there a way to map the input voltage range of 10V to 24V output to an output voltage of 0V–3.2V using only a single supply op-amp that runs only from the 3V3 rail?In other words then the input voltage is 10V the output is 0V and when the input voltage is 24V the output is 3.2V.Thank you

author: TimFox
author_rank: Super Contributor
timestamp: June 09, 2025, 09:10:22 pm
content: A very simple voltage divider would shift [+10 to +24 V] to [+1.33 to +3.20 V]: would that be good enough for your application?

author: Zero999
author_rank: Super Contributor
timestamp: June 09, 2025, 09:33:21 pm
content: An op-amp can be used. The x-axis of the simulation is the input voltage V1, which is swept from 10V to 24V and y-axis is the output.I used the website linked below to help me design it.https://earmark.net/gesr/opamp/gain_offset.htm

author: DigitalDesigner
author_rank: Contributor
timestamp: June 09, 2025, 10:07:16 pm
content: Thank you both!@Zero999 that schematic is exactly what I was looking for. Thank you. What simulation tool did you use?@TimFox a voltage divider would not work because of the ADC resolution.Thank you

author: TimFox
author_rank: Super Contributor
timestamp: June 09, 2025, 10:18:28 pm
content: Yes, with the simple solution (no applied offset) you would lose about 40% of the digital output range of the ADC. For some applications, that might be OK for a cheap solution.

author: Zero999
author_rank: Super Contributor
timestamp: June 10, 2025, 08:43:57 am
content: Quote from: DigitalDesigner on June 09, 2025, 10:07:16 pmI used LTSpice to simulate the circuit. It's freely available.If you're concerned about accuracy, then use a proper voltage reference, such as the TL431, rather than the supply voltage for the reference.https://www.ti.com/lit/ds/symlink/tl431.pdfJust use 2.495V or whatever for Vref in the calculator. It's the ratio of the resistors which matter, rather than the values. I multiplied them all by 1000, because the low values it generates would use a lot of power.https://earmark.net/gesr/opamp/case8.htm

author: mtwieg
author_rank: Frequent Contributor
timestamp: June 10, 2025, 11:30:18 am
content: To add to what Zero999 posted above, it's recommended that you use the reference voltage for the ADC to create the offset voltage. For example in that circuit if the 3.3V 'ref' net is the reference for the ADC, then all is good. But if the ADC actually uses another reference voltage, then any drift between the two references will show up as measurement error. It's even possible for you to end up with worse accuracy/precision than a simple voltage divider with no offset.If you tell us specifically what MCU you are using we can give more specific guidance.

author: DigitalDesigner
author_rank: Contributor
timestamp: June 10, 2025, 05:17:56 pm
content: Thank you both for the additional very useful information!