user24416: I am trying to use the inbuilt ADC of the Arduino Due to measure voltage signals. The frequency range I'm interested in measuring is  up to about 30 kHz.But I'm observing a strong capacitor behaviour as I increase the frequency ( from 10kHz onwards this is quite visible). 
This is most visible when measuring a square wave. When I get close to 30 kHz the signal looks exactly like the text book capacitor charge/discharge wave and nothing like a square wave. Even at around 15 kHz, the square wave looks more like a sine wave/ ramp signal than a square wave.
Based on the behaviour my guess is that a capacitor in the Arduino Due ADC is causing this (as  the frequency increases, the capacitor cannot charge/discharge fast enough). But I'm not sure whether I'm correct about this.
Even if I'm correct, how can I fix this?
Any help would be much appreciated.
Thanks. 
I don't have screenshots for the behaviour for a range of frequencies, but I will attach a hand drawing of what it looks like.

Also NOTE that As the frequency increases, the amplitude of the observed wave decreases ( I couldn't show this in my drawing). Think this again links back to the capacitor charge/discharge speed behaviour.
My Vin circuit : I tested by adding a voltage follower at the right most end(not shown on the schematic), but that made no difference.


user23841: Well, if you have source output impedance about 1k and Sample-And-Hold capacitance is 14pF, then RC time constant is about 14us.
You need something with low output impedance. Non-inverting Voltage Follower would be perfect for this (see source):


user24416: Fixed : The issue was with the LM324 op-amp. It has a small slew rate (0.5 v/uS) which was causing the signal to flatten out at high frequencies. So had to change to an op-amp with a better slew rate.

24416: <p>I am trying to use the inbuilt ADC of the Arduino Due to measure voltage signals. The frequency range I'm interested in measuring is  up to about 30 kHz.But I'm observing a strong capacitor behaviour as I increase the frequency ( from 10kHz onwards this is quite visible). </p>

<p>This is most visible when measuring a square wave. When I get close to 30 kHz the signal looks exactly like the text book capacitor charge/discharge wave and nothing like a square wave. Even at around 15 kHz, the square wave looks more like a sine wave/ ramp signal than a square wave.</p>

<p>Based on the behaviour my guess is that a capacitor in the Arduino Due ADC is causing this (as  the frequency increases, the capacitor cannot charge/discharge fast enough). But I'm not sure whether I'm correct about this.
Even if I'm correct, how can I fix this?</p>

<p>Any help would be much appreciated.</p>

<p>Thanks. </p>

<p>I don't have screenshots for the behaviour for a range of frequencies, but I will attach a hand drawing of what it looks like.
<a href="https://i.stack.imgur.com/kRmY2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kRmY2.jpg" alt="enter image description here"></a></p>

<p>Also NOTE that As the frequency increases, the amplitude of the observed wave decreases ( I couldn't show this in my drawing). Think this again links back to the capacitor charge/discharge speed behaviour.</p>

<p>My Vin circuit : I tested by adding a voltage follower at the right most end(not shown on the schematic), but that made no difference.</p>

<p><a href="https://i.stack.imgur.com/v4474.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v4474.png" alt="enter image description here"></a></p>
 23841: <p>Well, if you have source output impedance about 1k and Sample-And-Hold capacitance is 14pF, then RC time constant is about 14us.</p>

<p>You need something with low output impedance. Non-inverting Voltage Follower would be perfect for this (see <a href="http://www.electronics-tutorials.ws/opamp/opamp_3.html" rel="nofollow noreferrer">source</a>):<br/>
<a href="https://i.stack.imgur.com/uOr8k.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uOr8k.gif" alt="enter image description here"></a></p>
 24416: <p>Fixed : The issue was with the LM324 op-amp. It has a small slew rate (0.5 v/uS) which was causing the signal to flatten out at high frequencies. So had to change to an op-amp with a better slew rate.</p>
