-
Notifications
You must be signed in to change notification settings - Fork 797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ADC improvement & fix #1314
ADC improvement & fix #1314
Conversation
NEW multiple readings option
main/ZsensorADC.ino
Outdated
int sum_val = val; | ||
if (NumberOfReadingsADC > 1) { // add extra measurement for accuracy | ||
for (int i=1; i<NumberOfReadingsADC; i++){ | ||
delay(7); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to average the accuracy without having a blocking delay()
? I'm afraid about the impacts on the main loop and on other modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, its just 7ms per read so for recommended 10 reads its 70ms in total (still optional) and guess delay
actually yields every ms. Btw check RFB, theres is delay in loop on sending as well
Currently I'm running that (10 readings) with RF and DS1820 temp sensor with no issues so far...
Maybe we can short the delay to 1ms or remove it at all and also add one dummy analogRead as its recommended for 8266:
the reliability of the readings can be significantly improved by discarding an initial reading and then averaging the results
I'm afraid average values across loops adds another noise for already poor ADC in 8266 so better to read all in once
updated PR, readings are much more consistent without delay in adcread loop (prolly caused by yield() in delay() creating noise)
no delay
|
Thanks! |
Description:
Checklist: