Author Topic: Voltmeter project, biasing op amp input  (Read 724 times)

0 Members and 39 Guests are viewing this topic.

Offline ShimonuTopic starter

  • Regular Contributor
  • *
  • Posts: 127
  • Country: se
Voltmeter project, biasing op amp input
« on: December 14, 2025, 11:40:53 pm »
I thought it would be fun to try and make my own voltmeter as a project but I'm having a bit of trouble that I'm not understanding.

I have a 5 V reference for my ADC and I divide it to 2.5 V to bias the input to the op amp(buffer/gain). Without the op-amp connected(socketed THT) I get my expected 2.5 V biased level but when I plug in the op-amp the input jumps to something like 3.3 V. This would indicate a 0.8 V input offset but surely that can't be the case. My schematic says OP07 but I've used an OP27 and an OPA37 which sould both have very low input offset voltage.

The reason I wanted to make this project is to learn more about analog electronics as I'm more familiar with digital stuff. I've been repairing some multimeters and started to feel a bit comfortable with these things but I feel at a loss here.

What have I messed up?
 

Offline EggertEnjoyer123

  • Frequent Contributor
  • **
  • Posts: 507
  • Country: us
Re: Voltmeter project, biasing op amp input
« Reply #1 on: December 15, 2025, 12:21:50 am »
I thought it would be fun to try and make my own voltmeter as a project but I'm having a bit of trouble that I'm not understanding.

I have a 5 V reference for my ADC and I divide it to 2.5 V to bias the input to the op amp(buffer/gain). Without the op-amp connected(socketed THT) I get my expected 2.5 V biased level but when I plug in the op-amp the input jumps to something like 3.3 V. This would indicate a 0.8 V input offset but surely that can't be the case. My schematic says OP07 but I've used an OP27 and an OPA37 which sould both have very low input offset voltage.

The reason I wanted to make this project is to learn more about analog electronics as I'm more familiar with digital stuff. I've been repairing some multimeters and started to feel a bit comfortable with these things but I feel at a loss here.

What have I messed up?

Hook a scope up to the output of the op amp and check if it is oscillating.

Your circuit can also be improved, since if RV3 is set to a high ratio and a negative voltage is applied to the input, the op amp will try to set the output to -5V which would destroy your ADC. You should add a resistor and clamping diodes between the op amp and the ADC. Also, for voltage dividers it's generally a good idea to use two resistors on either side of the pot to limit the minimum and maximum ratios. For example, you can have 89k, then a 2k resistor, then 9k for 10:1.
 
The following users thanked this post: Shimonu

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 16227
  • Country: de
Re: Voltmeter project, biasing op amp input
« Reply #2 on: December 15, 2025, 09:29:10 am »
With a DC voltmeter there is no need to biasing the input. The input also provides the DC path.
One may want to add some offset or use a virtual ground, so that the input signal can be positive and negative. So the 2.5 V would be used for the low side terminal of the input and not directly linked to the high side.
One could use the offset at the high side, when there is an input divider.

The point with the -5 V supply possibly damaging the ADC is a very valid point. Limiting the voltage that can go to the ADC and still no loosing much of the range is a somewhat tricky point of the design. Here the OP07 / OP27 are not that good as the range for the ouput and inputs are not so accurate defined. It may get easier with a Rail to Rail amplifier, like most zero drift amplifiers.

For good precision one would normally use not just a single FET for gain switching, but a SPDT analog switch chip (e.g. DG419, 74HC4053). This way one can avoid the on resistance entering in the gain. Turning on the N-fet as shown can be tricky when the amplifier has a positive output.
 

Offline ShimonuTopic starter

  • Regular Contributor
  • *
  • Posts: 127
  • Country: se
Re: Voltmeter project, biasing op amp input
« Reply #3 on: December 15, 2025, 09:59:52 am »
Hmm oscillation is an interesting thought. I have a possible grounding issue though. When I connect the grounding clip of the probe to the ground on my board the power supply acts up, the display flickers and the output disappears. Could it be that the common of the power supply is floating, causing some issue? But I also have a shared ground with my laptop(connected with a USB-C power supply) since I connect the programmer. I won't be upset if I need to get an isolated oscilloscope   >:D

I have tried to add protection in the input section to ensure the op-amp won't see a negative voltage or high positive voltage, both with clamping diodes and logic to open a relay. But I'll still have a look and you're right about the potentiometer, I believe I did design it that way first but changed my mind to reduce parts, figuring it will only be set once anyway.

EDIT: just saw Kleinstein's input. I do have dividers on the input, I just didn't show that part. I'm not sure I understand what you're saying about the biasing and offset. Since the ADC can't handle negative voltage this was the idea I found for measuring negative voltage. Is my biasing method valid with input divider? In my mind biasing and offset is interchangable or is there a difference?
So from what I understand the issue with OP07 and similar is that they're not rail to rail so I can't be sure where they will limit their output. That's a fair point, I had some of those from a repair and figure I would reuse them but I'll see if I can go to a rail-to-rail in a future iteration. I'll also look at the analog switch, thanks!

I was quite generous with the PCB space but that became a bit costly so I wonder if I should change the design to separate modules instead. I'm guessing the best way to cut it would be to have the input section and ADC as one module and the power supply and digital section as one or more modules. Because I'm sure I will want to make an updated version to fix all the mistakes I find(and have already found).
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 16227
  • Country: de
Re: Voltmeter project, biasing op amp input
« Reply #4 on: December 15, 2025, 10:34:35 am »
Biasing is more used with AC coupled amplifiers and may be about the DC voltage or the current. With an offset it is about the voltage.
Adding the voltage shift to the positive input with the divider can be tricky, as it would add some kind of input current. So an open input may read different from a shorted input.

It definitely makes sense to also show the input divider and protection. Especially in the circuit as shown the input divider would really interact with the offset.
It would really help to know the target ranges and performance.

The MCP33131 is a rather fast SAR ADC. One would ideally want some anti aliasing filter with it to reduce the noise and sensitivity high interference.

With the cheap PCBs from China the area is often less of an issue - more a per piece prize. So a modular design would make even less sense.  With some care and someone checking the plan before sensing it out one should have a reasonable chance to get it working OK or only need minor mods.

The circuit should not get upset with the ground connected to the DVM ground. The supply part could still be an issue. Especially USB can have quite some EMI issues. Often one would like the input ground (low side) to be isolated from the USB ground.
 

Offline PGPG

  • Frequent Contributor
  • **
  • Posts: 907
  • Country: pl
Re: Voltmeter project, biasing op amp input
« Reply #5 on: December 15, 2025, 12:13:10 pm »
it would be fun to try and make my own voltmeter as a project

First ICs I have ever had in my hands were 741 OpAmps (I got 2 of them) and I used them to replace transistors (germanium) in my transistor voltmeter to improve its stability (when transistors in differential pair got different output voltages they also got little different temperatures what makes their B-E voltages difference drift with obvious effect for measuring accuracy).
I had there only 4.5V battery and 741 supplied by 4.5V has very limited output range. I don't remember details (50+ years have passed) so assume 741 input and output range is 1.5 to 3V. My solution. Voltage divider making 1.7V and one OpAmp as follower of it making my virtual GND. Second OpAmp in typical inverting configuration (its + input connected to virtual GND). Measured input (+) connected also to virtual GND and measured input (-) through (range selecting) resistor to OpAmp (-). For full scale (at each range) I got 1V output (relative to my virtual GND so from 1.7V to 2.7V - within the OpAmp output scope) used to drive deflection indicator (its other end connected to virtual GND).

The key point - one end of measured voltage connected to virtual GND. It was possible thanks to having my voltmeter being supplied by battery.
Consider if using battery supply will not make your design much straight forward. You can probably use AIN- to measure relative to virtual GND as in my solution.
« Last Edit: December 15, 2025, 12:39:42 pm by PGPG »
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3614
  • Country: gb
Re: Voltmeter project, biasing op amp input
« Reply #6 on: December 15, 2025, 12:21:50 pm »
I have a 5 V reference for my ADC and I divide it to 2.5 V to bias the input to the op amp(buffer/gain). Without the op-amp connected(socketed THT) I get my expected 2.5 V biased level but when I plug in the op-amp the input jumps to something like 3.3 V.

By "input" do you mean the input to the ADC (i.e. pin 6 of the op-amp) or the input of the op-amp (pin 3)?  If you mean the ADC input then this should be obvious, you are feeding 2.5v into a non-inverting amplifier, unless RV3/Q2 is set for unity gain then you will always get more then 2.5v out.  If you mean the input of the op-amp (pin 3) jumps to 3.3v then this sounds like a wiring error or perhaps the op-amp is oscillating.
 

Offline Terry Bites

  • Super Contributor
  • ***
  • Posts: 2954
  • Country: gb
  • Recovering Electrical Engineer
Re: Voltmeter project, biasing op amp input
« Reply #7 on: December 15, 2025, 12:44:09 pm »

U1a has drift characteristics worse drift than the LM4040-5. A precision reference needs a precision buffer. You probably don’t need this buffer because the current to the bias resistors and the ADC ref in are very low. An antialiasing filter is needed to keep the input bandwidth to less than 0.5x the sampling frequency.  A simple RC circuit will often be sufficient. You can protect the ADC input with a diode clamp. A pair of small signal Schottky diodes make an effective clamp. BAT54 or similar.

The voltage gain pot is not a good control configuration particularly if the pot is any distance from the opamp. The opamp’s inverting input will be very vulnerable to noise and may well oscillate if there is enough stray capacitance at this node. The gain range is far too wide, I think. I'm guessing that Q2 is to force unity gain but it won’t be able to turn on or off effectively in this circuit. The internal body diode (as seen in the mosfet symbol) will conduct and cause a highly asymmetric output swing. If you want to short out the feedback here you’d need to use a a dual supply analog switch or a relay. Also, the amplifier frequency response will vary widely as the pot is adjusted. Use a fixed feedback resistor and vary the gain with a pot to ground. Q2 in this configuration is normally on for variable gain and turned off to obtain unity gain. As shown, the bandwidth is fixed by Rf and Cf. A switched gain set up is preferable. See attched low cost PGA idea that is immune from switch on resistances.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 16227
  • Country: de
Re: Voltmeter project, biasing op amp input
« Reply #8 on: December 15, 2025, 02:02:00 pm »
Driving the MCP33131 ADC reference is not so easy: the ADC needs a sizable capacitor at the reference input. The DS suggests 10 µF tantalum with optionally some extra MLCC. The input current can be relatively high with some 400 µA for 1 MHz sampling rate. So it needs some kind of driver circuit. A normal OP-amp as buffer would not like the capacitance. So reference chips are OK with this, but not all.
 

Offline ShimonuTopic starter

  • Regular Contributor
  • *
  • Posts: 127
  • Country: se
Re: Voltmeter project, biasing op amp input
« Reply #9 on: December 15, 2025, 06:24:49 pm »
Thanks everyone, I'll post my input section too. It has a fusible input resistor which I'm not sure is needed, I stole that from another schematic but that was a multimeter and I realized that may have been for the current measurement.
I'm glad someone suggested schottky diodes for clamping, I wasn't off thinking about using those then.

I'd really like to sort out my grounding issue though because I won't be able to troubleshoot with my oscilloscope otherwise. I'm not sure if I mentioned it but I'm powering the board with an HP E3630A power supply providing +- 7V and it's this power supply that acts up when I connect the grounding clip from the oscilloscope probe to the board. I just tried having only the power supply connected to the board and trying to attach the probe ground and the output appears to drop/fail and the display on the power supply flickers/turns off/shows garbage. I don't know if this an issue with my setup or the power supply has an issue. I have tested it against an electronic load and it works fine there so there's no load issue as far as I can tell. It's not current limiting. This is why I'm wondering if there could be something about the common terminal on the power supply that I perhaps might not be understanding.

I feel like I'm getting some mixed messages about the voltage reference to the ADC so I'm probably not understanding something. How should I be driving the reference input? Would it be enough to just wire the reference directly with a 10uF tantalum cap and that would essentially be a bulk capacitor for high speed measurements but for sparse measurements the buffer works as the load is still relatively small? Or should I use some other device/solution to buffer the reference voltage?

Maybe with the input section schematic you could also provide more input on if my solution for the input offset works or what the options are. I know there are also voltage references that provide Vref and Vref/2 but maybe that's for biasing and not offset if I understood the difference correctly. I did also realize that shorting the input wouldn't work since that could short the 2.5 to ground, haha it just clicked for me why the relay would buzz.

And yes, it was pin 3 that I was refering to about the 3.3 V.

This is a good wakeup, I was a bit too excited about this project and didn't look too carefully at the datsheets or think it through. I was really expecting it to be relatively easy.

I don't order my PCBs from China so I don't get them super cheap. I might still look at a modular solution since I'll probably want to iterate on some sections. I'm interested in starting with some low voltage AC supply and get familiar with transformers and that type of supply.

Thanks for all the feedback! :-+
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 16227
  • Country: de
Re: Voltmeter project, biasing op amp input
« Reply #10 on: December 15, 2025, 07:20:52 pm »
The divider / protection part has quite some issues:
The divider is quite high impedance and the leakage from schottky diodes for clamping there would likely be a significant issue for the accuracy. The FETs as switch for the divider choice would conduct with negative voltage due to the parasitic internal diode.

The idea with the relay is a bit unclear - if engaged there would be little resistance in the path to provide current limiting for the protection. The clamping diode t GND would limit the negative input to only some -200 mV.

The 2 OP-amps as window comparators would be too much load to the high impedance input. As shown they would act between 0 and 5 V and thus trip on negative voltage. Another point is that the LM358 and similar is not Rail to Rail and thus not working at the upper limit. I would prefer a true comparatorer over the LM358. One would likely still need an extra FET buffer to avoid loading the input.

The extra level shifters with MOSFETs look odd - one should get away with a simpler solution, e.g. with suitable and gates.

For the problem of allowing a +- input with a 0-5 V ADC, I would consider the input amplifier with a +-5 V range and than a divider at the output of the amplifier. So the input and amplifier would be for +-5 V and than a 1:1 divider (e.g. 2 x 1 K) towards a buffered 5 V reference. This way 5 V would stay at 5 V and -5 V would be mapped to 0 V. A downside would be a bit higher impedance to the ADC and thus a limited bandwidth. There is also a bit load current to the amplifier, but likely still acceptable.

For the reference the LM4040 seems to be reasonable OK with a capacitance at the output. The DS gives 1 µF as an example in the output impedance curves and they don't look too bad, especially with 1 mA reference current. So one should get away without and extra buffer. I would suggest to plan with an additional RC damping element. So something like 5-10 µF to ground as buffer capacitor and another 10 µF with a series resistor of some 5-10 ohms to ground as extra damping element. The reference drive current (e.g. 1 mA) should come from a stable voltage (like 6 V derived from the 5 V) unless the 7 V supply would be very stable.

The LM4040 is rather noisy and can have a quite high TC.  One may want the option for a higher grade reference (e.g. max6070 or ref. 3450).
 
The following users thanked this post: Shimonu

Offline ShimonuTopic starter

  • Regular Contributor
  • *
  • Posts: 127
  • Country: se
Re: Voltmeter project, biasing op amp input
« Reply #11 on: December 15, 2025, 10:00:16 pm »
The divider / protection part has quite some issues:
The divider is quite high impedance and the leakage from schottky diodes for clamping there would likely be a significant issue for the accuracy. The FETs as switch for the divider choice would conduct with negative voltage due to the parasitic internal diode.

Okay, I think this is something that confuses me. This is what I though the 2.5 V offset would be for. Negative voltages would be "cancelled" out(still resulting in positive input) up to -2.5 V but the idea was then that the MCU would get an overload signal and switch range.

The idea with the relay is a bit unclear - if engaged there would be little resistance in the path to provide current limiting for the protection. The clamping diode t GND would limit the negative input to only some -200 mV.
My idea was that this would be the 0 - 2V range and the voltage could pass directly to the input buffer without being divided.

The 2 OP-amps as window comparators would be too much load to the high impedance input. As shown they would act between 0 and 5 V and thus trip on negative voltage. Another point is that the LM358 and similar is not Rail to Rail and thus not working at the upper limit. I would prefer a true comparatorer over the LM358. One would likely still need an extra FET buffer to avoid loading the input.

Yeah, I think this is something I don't really have intuition and experience for with high impedance and load. This shows my digital background thinking of ideal voltages.
I just had a look at the LM358 datasheet, I must have confused it with another op amp, I thought it could drive much closer to the rails, or I may have been looking at the low side where it can get closer to the rail and assumed the same for the upper rail.

The extra level shifters with MOSFETs look odd - one should get away with a simpler solution, e.g. with suitable and gates.
Suitable in what way? The MCU does have some 5 V tolerant pins but I chose to avoid handling different voltages on the MCU side. Working with 5 V for the AND gates meant I could use a dual gate package and handle the output from the window comparators.
I'd like to know what alternative solutions there are though but it was how I solved the mix of logic voltages.

For the problem of allowing a +- input with a 0-5 V ADC, I would consider the input amplifier with a +-5 V range and than a divider at the output of the amplifier. So the input and amplifier would be for +-5 V and than a 1:1 divider (e.g. 2 x 1 K) towards a buffered 5 V reference. This way 5 V would stay at 5 V and -5 V would be mapped to 0 V. A downside would be a bit higher impedance to the ADC and thus a limited bandwidth. There is also a bit load current to the amplifier, but likely still acceptable.
I made a quick sketch in KiCAD, did I understand you correctly? I assume lower bandwidth means slower to react to change in the input voltage which would be absolutely fine.
I assume there would still be a input ranging and protection section.

For the reference the LM4040 seems to be reasonable OK with a capacitance at the output. The DS gives 1 µF as an example in the output impedance curves and they don't look too bad, especially with 1 mA reference current. So one should get away without and extra buffer. I would suggest to plan with an additional RC damping element. So something like 5-10 µF to ground as buffer capacitor and another 10 µF with a series resistor of some 5-10 ohms to ground as extra damping element. The reference drive current (e.g. 1 mA) should come from a stable voltage (like 6 V derived from the 5 V) unless the 7 V supply would be very stable.

The LM4040 is rather noisy and can have a quite high TC.  One may want the option for a higher grade reference (e.g. max6070 or ref. 3450).
From my measurements the LM4040 was pretty good, I believe I measure it to around 5.00010 V or so. I didn't check with an oscilloscope, it's probably a bit noisy and i saw some changes in the uV level but for my purposes this is more than enough. I'm not trying to push any limits, it's more about learning the design process and getting something that works. Once I have a hang of it I might be more interested in seeing how good I can get it. I've tried to use parts that I already have at home or are relatively cheap since failure of the first design felt like a possibility.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 16227
  • Country: de
Re: Voltmeter project, biasing op amp input
« Reply #12 on: December 16, 2025, 09:32:01 am »
The 2.5 V offset would not help with the FET switching. The MOSFETs for the divider switching would still see voltage in both directions and can not really block in one direction.  The extra 2.5 V offset would not help here. The same issue also applies to the gain.  So I would really replace them with CMOS switch chips (74HCT4053 may be good enough).

With CMOS switches instead of the MOSFETs for analog switching one may no longer need level shifting from 3.3 V ( µC) to 5 V.  The relay driver would also get away without an extra level shift.  There are switch chips (e.g. LVC, LV1T,..) with 5 V tolerant inputs if needed. Comparators often have open collector(or drain) outputs anyway and  could use 3.3 V pullups.

The divider circuit looks OK. One would still want a capacitor (e.g. 10 nF range C0G or film type) to ground at the ADC input. This to help with the transient input current and also as anti aliasing filter. The slow down is for the reponse to changing voltage (e.g. range change). It would still not be slow for a DVM, but slow relative to the ADC speed (500 kSPS spec). E.g. 10 nF*500 ohm = 5 µs. So this would still give some 30 kHz bandwidth an one would still want a sampling rate of some 100 kSPS to not get much aliasing.
Driving the ADC with so much resistance is still not ideal and the sampling rate could effect the effective gain.

The LM4040 reference is OK for a 1st test, but it could well be the weak point of the rest works OK. It could help to have an upgrade option on the PCB (parallel footprint and only populate one).
 

Online iMo

  • Super Contributor
  • ***
  • Posts: 6316
  • Country: sm
Re: Voltmeter project, biasing op amp input
« Reply #13 on: December 16, 2025, 10:20:19 am »
Your ADC has got AN- and AN+ inputs.
Connect the Vref (2.5V) to vref input of the ADC, and also connect Vref to the AN-. Do not connect AN- to GND.
AN- will be the "virtual ground" for the voltmeter's input voltage.
Your ADC range will be from -2.5V to +2.5V then.
You may add an 1:10 resistive divider between voltmeter's input and AN+ (lower leg to AN-) such you will get -25V to +25V range, for example.

The above assumes the power source of the ADC will be floating against AN- (as the AN- is now the "voltmeter's virtual ground").

If you need a high input impedance - place an opamp in front of the divider, its power source has to be floating as well, and also you may bootstrap its Vcc/Vee when you need large input voltages (or for the sake of simplicity do use an opamp for large Vcc/Vee, like the LTC2057HV, for example, which may work fine for +/-25V input when powered by +/-30V).
« Last Edit: December 16, 2025, 07:00:34 pm by iMo »
Readers discretion is advised..
 

Offline ShimonuTopic starter

  • Regular Contributor
  • *
  • Posts: 127
  • Country: se
Re: Voltmeter project, biasing op amp input
« Reply #14 on: December 17, 2025, 08:58:45 pm »
I'm working on updating the design, a few followup questions.

I wasn't clear on the range selection for the lowest range where I was thinking to connect the input directly through the relay. Was this a valid solution or could this be handled through the switch somehow? Why I chose the relay was because I potentially want to be able to handle up to 100 V or so and this was the only way I could see to handle such a high voltage without damage.

Regarding the divider resistors, I felt like I made a mistake at first by choosing 10M, 1M and 100k because this isn't actually dividing by orders of 10. But values that would give division by 10 seem to be very difficult to find or there are some expensive resistor arrays, like Caddock. What I did now was to combine some values to achieve orders of 10 and I haven't been able to try yet how well that works.
You could also use the 10M, 1M and 100k for instance and try to handle the ratio in software.
Have I missed any options?

It gets a bit confusing with different design solutions, although I appreciate your input iMo, it's educational, I'll go with the feedback from Kleinstein for now as it works on my current way of thinking. For instance it looks like I would need +-30 V which I don't have a solution for at the moment.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 16227
  • Country: de
Re: Voltmeter project, biasing op amp input
« Reply #15 on: December 17, 2025, 10:39:39 pm »
The relay is perfectly fine to bypass the divider. The only point missing a series resistor to still have current limiting for protection in case the low range is set and a high voltage is applied.

Using resistors like 10 M and 1M is no issue - the software side can adjust for the actual divider ratio. In my DIV DMM I have a gain setting of around x7 and an input divider of about 1:21 and no issue with this. So there is also no need for the trimmer to set the gain - just 2 fixed resistors (or a ready made divider for higher stability) are OK. With a µC to handle the result a digital calibration factor is the way to go.

The MCP33131 has only a pseudo differential input. So Vin- is supposed to be relatively close to GND and only positive input voltages are handled correct. So the simple idea with 2.5 V at Vin- does not work with this ADC. One really has to add half the voltage in one way or the other. The easy way with input low at 2.5 V would only work with a gain of 1.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf