I'm using a MCU ADC, PIC18F26K22, to sample and calculate a RMS value of a sine wave that is rectified by the full precision rectifying circuit in the schematic below. This ADC has 10 bits and I'm sampling at 50 kHz. The signal is 2 kHz and at the ADC input has 700mVp. This voltage was measured with a digital oscilloscope.

I already did the compensation for Gain and Offset errors, using DC voltages and a very good quality multi-meter, but when I'm sampling this sine wave I'm having a very poor accuracy in the results, for instance, in 700mVp Sin Wave the ADC is sampling peak values of ~620mV. I'm using the internal voltage reference of 2.048V, which guarantees a low error.

So, I'm really clueless about what could be done to solve this, I already increased the acquisition time, with the cost of reducing the sampling frequency, but still the voltage peak values do not change.

What is the cause of the incorrect peak voltage? How can I fix this problem?

• Is there a reason you're trying to do the RMS-DC in the digital domain? – ThreePhaseEel Sep 7 '16 at 22:23
• Regarding the ADC performance: A poor circuit layout, improper routing/separation of analog/digital MCCU/ADC powering, bad grounding, presence of switching loads and regulators can be raise the noise level, thus reducing the ENOB (Effective Number of Bits) of ADC. For example, a 12 bit ADC can, really works as 8 bit. Also, there is also difference between accuracy and precision. – Dirceu Rodrigues Jr Sep 7 '16 at 23:04
• Check the silly stuff first: (1) IC3-A has to swing negative as it's in inverting mode. What's the chip's negative supply rail? (2) Can you measure the negative DC voltage after the upper diode? – Transistor Sep 7 '16 at 23:08
• Start with the obvious. The ADC says you're only giving it 620 mV. Is this true? That is, what does the ADC input look like on a scope? – WhatRoughBeast Sep 8 '16 at 0:12
• R13 should go to the SINEWAVE input, not pin 4 of IC3-A. – Bruce Abbott Sep 8 '16 at 0:31