Strange ADC behaviour

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
knst08
Posts: 28
Joined: 15 Oct 2017 20:14

Strange ADC behaviour

Post 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
Attachments
adc.png
adc.png (396.83 KiB) Viewed 6026 times
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: Strange ADC behaviour

Post 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
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Strange ADC behaviour

Post 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.
p0lyg0n1
Posts: 242
Joined: 04 Aug 2016 07:14

Re: Strange ADC behaviour

Post by p0lyg0n1 »

Updated. Please, look here viewtopic.php?f=3427&t=25646&start=10. I got 2xACS712 for tests.
knst08
Posts: 28
Joined: 15 Oct 2017 20:14

Re: Strange ADC behaviour

Post 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.
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: Strange ADC behaviour

Post by petergebruers »

Thanks for reporting back!
Post Reply