Arduino UNO simulation using proteus - analog sampling 1Hz sine signal

Thread Starter


Joined Oct 24, 2017
Dear all,

I need some help to understand more about how ADC works in arduino.
I'm doing simulation of arduino uno using proteus for analog signal sampling. I put signal sine waveform 1Hz with amplitude 4V (p-p).
For programming, i'm using Arduino IDE to write the code, compile, and put the hex file to run it in proteus.
You can see the schematic on attached pic. analog signal were passed to voltage divider to capture whole sinusoidal wave,
then the sampled shown using serial monitoring. I took all the data and plot it in Excel to see how the sample data look like.

What makes me confuse is the output signal always has different frequency against input signal frequency.
In my project, i want to sample 1Hz sine signal at analog pin A1, then i got output signal with frequency ~5Hz.
I believe that ADC feature on arduino has way more faster sample rate rather than 1Hz (to prevent aliasing),
but still i got the incorrect output signal frequency.

I have tried with simple program following arduino IDE code template or doing more precise by using bit manipulation.
but still i couldn't get 1Hz signal output. Does anyone can help me to understand why & how to sample 1Hz signal.
(the amplitude was correct, but basically i want to simulate the simple analog sampling with output signal mimicking input signal)

int adc_value;

void setupADC()
  ADMUX  = (1 << REFS0) | (1 << MUX0);
  ADCSRA = (1<<ADEN) | (0<<ADIE) | (1<<ADPS2) | (1<<ADPS1) | (1<<ADPS0);

void startConversion()
  ADCSRA |= (1<<ADSC);

void setup() {


void loop() {
   adc_value = ADCW; //Store ADC value



Joined Feb 19, 2010
Let us review.
You have 4V peak to peak signal. I assume the signal oscillates about 0V. So. You have -2V to 0 and 0 to +2V. Amplitude is 2V. Then you pass this signal through voltage divider. The output of the voltage divider is exactly half of the input. Where before you had amplitude of 2V (4V peak to peak), now you have amplitude of 1V (2V peak to peak). The voltage divider is pointless.

Now. The real problem.
Uno ADC is 0 to 5V. This means that any voltage lower than 0V is automatically read as 0V. So. You should be able to see a bunch of zeros instead of -2V, -1V, etc. Basically you lost half of your sine wave because Uno ADC is not able to read that half.

You have choices:
1. You can run negative half of the wave through half wave rectifier, where this half is rectified and then Uno will be able to read it.
2. You can offset the wave up. Instead of being -2 to 2V (4V peak to peak), move the wave up so that -2 will become 0V and +2V will become +4V. Now your wave is 0 to 4V (still 4V peak to peak). Since your wave is now in the 0 to 5V range of Uno ADC, the Uno will be able to read the full range of the wave.

Thread Starter


Joined Oct 24, 2017
Hi shteii01,

Thank you for highlighting this clipped sine output. Exactly as per your explanation, UNO cannot read negative voltage,
given i didn't put voltage divider, i will see bunch of zeros on the output reading.

What i did with voltage divider is following your second method, by giving offset on the input signal.
In this way, i can capture negative voltage as well.

I did comparison between 'w/ volt divider' and 'w/o volt divider', put it in excel, convert it to voltage value (attached pic).
(without volt divider, i remove both resistors and tap sine generator directly to pin A1)
the output without volt divider is as per you said. I clip the data up to 1000ms and i can see the output frequency.
I notice slight different result in terms of frequency which is another additional problem in terms of frequency.

the input signal set 1Hz, but the output:
with voltage divider become ~5Hz (5 peaks in 1000ms)
without voltage divider become ~4Hz (4 peaks in 1000ms)

I still have no idea why this happen. Up to my knowledge, i have no issue with sampling frequency
as the input signal was lower than sampling rate capability of ADC.



Joined Jul 5, 2008
Your about right at 9600 baud your lucky to get 4 readings in a second.
The arduino doesn't send data raw for one plus your sending a word two bytes to get 10 bit's bad part is that it's being sent asii so it's even slower.
send it as fast as it can would help but to get what you want you'd have to not use the cores at all.
Arduino library's the cores

Plus you can't go -2 volt like been said. As a mater of fact you can kill the adc very easy like that I think that datasheet said - anything over a -0.3 volt can kill the adc module
You can do about 1000 Conversion in 1ms
Last edited:

Thread Starter


Joined Oct 24, 2017
Hi be80be,

I confuse with the frequency output result. I set the ADC clock to be 125kHz (pre-scaler 128).
According to datasheet, ADC conversion took 13cycles, so ADC sampling rate is 9,615Hz (125000/128). CMIIW.
Regardless of this sampling rate which is more than nyquist sampling theorem (min 2x signal source frequency),
I think this is more than enough to capture 1Hz input signal to be shown through serial monitor.
So, you have any idea how can I get correct frequency reading as per input signal showing through serial monitor?
If you can elaborate which part should I modified on the code above.



Joined Feb 19, 2010
One thing you can do is increase the baud rate. The 9600 is kinda... standard, but it is NOT required.
You can do 115200:
If you use Arduino IDE, when you open terminal, in the bottom right corner you will have a drop down menu to choose baud rate, just match it to whatever you have in the program.