Asked — Edited
Resolved Resolved by Rich!

Noisy Analog Dat On The V4

I have about 5 adc units of noise on my 256 adc analog inputs. Also the battery voltage and cpu temperature are noisy. I have checked my incoming battery voltage and it is steady. I tried to filter the analog inputs but no luck there. Thanks oops I guess I can not go back and fix my typo in the title.


ARC Pro

Upgrade to ARC Pro

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

#25  

Wow @Rich, you just saved me a stressful hour or two resurrecting my math skills. I was just going to sit down and try to write this same script. Thanks!

#26  

Thanks Rich, I'll be sure to give this a try.

United Kingdom
#27  

I could have done it a quicker way too by making a loop that goes around 10 times adding the ADC value each time then diving it at the end... But I wrote that without thinking too much.

This is a more economical method.


$x = 0
$ADCValue = 0
RepeatUntil($x = 10)
$x++
$ADCValue = $ADCValue + GetADC(ADC0)
Sleep(10)
EndRepeatUntil
$ADCValue = Round($ADCValue/10,2)

Print("ADC: " + $ADCValue)

You could, if you wanted to, increase the number of readings easily by changing the 10 in the repeatuntil and the 10 in the $ADCValue = Round($ADCValue/10,2)

You could also go for more or less decimal places by changing the 2 in the Round($ADCValue/10,2)

You may even be able to remove or reduce the sleep(10) or increase it if you aren't checking every 100ms.