Page 1 of 1

Strange ADC behaviour

Posted: 16 Nov 2017 10:04
by knst08
I have a simple set up. A3 channel of ADC is connected to ACS712 current sensor through voltage divider (to get maximum 3v instead of 5v).
No current is applied to ACS712 so it constantly outputs 1.5v. Other channels are not connected to anything.

I collect values to see them on plotter

Code: Select all

* int a0= analogRead(A0);
  int a1= analogRead(A1);
  int a2= analogRead(A2);
  int a3= analogRead(A3);  

  Serial.print(a0);
  Serial.print(" ");
  Serial.print (a1);
  Serial.print(" ");
  Serial.print (a2);
  Serial.print(" ");
  Serial.print(a3);
  Serial.println();
Resulting picture:
Image

a0 blue
a1 red
a2 green
a3 yellow


I can not get:
1. Why A0 and A3 charts has quarter of the range spikes
2. Why levels of not connected channels are so different
2. Why a1 and a2 noise is so correlated

Re: Strange ADC behaviour

Posted: 16 Nov 2017 11:35
by petergebruers
Please have a look at this topic started by me, it might explain a part of what you see... After reading that, please tell me what you think...

viewtopic.php?f=3427&t=25646

Re: Strange ADC behaviour

Posted: 17 Nov 2017 13:44
by p0lyg0n1
Please have a look to different settings I listed in viewtopic.php?f=3427&t=25646. Try to apply this and check the behavior. Looks like it's a internal behavior of ADC. I'll try to get an ACS712 for tests.

Re: Strange ADC behaviour

Posted: 18 Nov 2017 00:48
by p0lyg0n1
Updated. Please, look here viewtopic.php?f=3427&t=25646&start=10. I got 2xACS712 for tests.

Re: Strange ADC behaviour

Posted: 19 Nov 2017 22:00
by knst08
zunoADCAdvConfig(ZUNO_ADC_ADV_AZP1024); removed spikes so I got enough precision.
Actually I now calibrate ACS712 before start using it - constantly get samples within 500ms while there is no current and treat the average as zero while maximum deviation as threshold. So to get current value (AC) I collect samples within 500ms , calculate RMS and if it is greater then sqrt of maximum deviation obtained while calibrating it is returned otherwise current is treated to be 0.

Re: Strange ADC behaviour

Posted: 20 Nov 2017 20:35
by petergebruers
Thanks for reporting back!