# Noisy non-inverting op amp with gain selection

I need to measure input voltage by 16bit ADC with 2.5 V reference. There are two different input voltage levels: 0 - 100 mV and 0 - 30 V. I designed the circuit below which should work in the following way:

• Range 0 - 100 mV: Optocoupler OK1 is off and OK2 is on, so that input voltage flows via resistor R1 to op amp which works as non-inverting amplifier with gain 25.
• Range 0 - 30 V: Optocoupler OK1 is on, so that resistors R1 and R2 form a voltage divider. The optocoupler OK2 is off, so that op amp has only 24k resistor in the feedback and works as voltage follower.

My problem: When I select the range 0 - 30 V, the output is very noisy. When I sample it by 16bit ADC, the noise is several hundreds of ADC divisions. Also I noticed the bigger is the input voltage, the bigger is the output noise. When I replace R3 by 0R, the noise is gone, but the circuit is not able to measure the second voltage range :(

EDIT: I switch the circuits by optocouplers, but I could not find them in the schematic editor, so I drew MOSFETs instead.

Thank you for suggestions. Klasyc

simulate this circuit – Schematic created using CircuitLab

• Make R3=R1*R2/(R1+R2)=3.6 kOhm and adapt R5 accordingly. Does this minimize the noise?
– JLo
Commented Jun 13, 2017 at 13:29
• I already tried to decrease the value of R3. If I remember correctly, I tried R3 = 2k7 and R5 = 100R. It really helps, but the noise is still lower when R3 = 0R. Btw. how can I calculate the minimal value of R5? Commented Jun 13, 2017 at 15:00
• What happens if you remove R5 completely while R3=24k? Minimal value of R5 is limited by a) the current sourcing capability of the opamp and b) by the voltage over it being in the same order as noise and other disturbances, particularly opamp offset voltage. The nearer the voltage comes to the disturbances the more error-prone your design will be.
– JLo
Commented Jun 13, 2017 at 15:53
• Weird, If you look at the output with a 'scope what does the noise look like? (pick-up interference, oscillations, "real" white noise.) Commented Jun 13, 2017 at 16:06

Finally it turned out that the op amp was oscillating. The solution was to add 10 nF capacitor in parallel with R3. Anyway, thanks everybody for your suggestions.

When I select the range 0 - 30 V, the output is very noisy.

Yes, it's possibly because the IRF530 has 250 pF drain-source capacitance and this pushes the overall gain back to being high at higher frequencies. The frequency where the gain starts rising is: -

F = $\dfrac{1}{2\pi RC}$ where R is 1 kohm (R5) and C = 250 pF.

I calculate this as being 637 kHz.

You need to consider using a different approach to avoid this unforeseen noise.

Alternatively, it could be that noise on the gates is being amplified, particularly M1 because this should be on in low-gain mode. Also, given that your supply rails are +/- 3.3 volts, I suspect that you may be controlling the MOSFET gates with 3.3 volts and, for an IRF530 this is just enough to partially activate it and any noise on the gate will be easily amplified. Read the data sheet for the IRF530.

If on the other hand you didn't bother to change the default settings for the schematic editor you used to draw your circuit and the default is an IRF530 then consider yourself chastised for wasting my time!

• I switch the circuit by optocouplers, but I didn't find them in the circuit editor - therefore I replaced them by mosfets because they have mosfets on their output. I am sorry to confuse you, I already updated my question. Also I tried to remove R5 to confirm your answer (the optocoupler also has significant capacitance), but the noise is still there :( Commented Jun 13, 2017 at 13:00
• Try shorting out OK1 maybe. Commented Jun 13, 2017 at 13:28
• Shorting R5 allows even HIGHER gain at high frequencies. Commented Jun 13, 2017 at 14:57
• @analogsystemsrf the OP said he removed it and I presumed that he meant he didn't replace it with a short. Commented Jun 13, 2017 at 18:06