-
-
Notifications
You must be signed in to change notification settings - Fork 284
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
Improve ADC accuracy #75
base: main
Are you sure you want to change the base?
Conversation
Note: I'm using a picow, interested in feedback from someone using a pico as the 3.3v supply is slightly different |
Firmware/LowLevel/src/main.cpp
Outdated
#define VIN_R1 9980.0f | ||
#define VIN_R2 998.0f |
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.
Where do these come from? I assume these will be slightly different for every board (10k 1%, 1k 1%), so we should have them at 10k and 1k
Thank you for the PR! Looks good!
|
Firmware/LowLevel/src/main.cpp
Outdated
@@ -601,16 +605,32 @@ void loop() { | |||
if (now - last_status_update_millis > STATUS_CYCLETIME) { | |||
updateNeopixel(); | |||
|
|||
// Disable power saving during ADC | |||
digitalWrite(PIN_SMPS_POWERSAVE, HIGH); |
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.
In spite of what the datasheets says this is actually worse on my mower and seems to be a general issue with all picos from https://pico-adc.markomo.me/
Use the charge voltage ADC when mowing to determine ADC offset.
Replaced the logic to check the high-level mode && GPS to determine that it's mowing, ensures it doesn't try to adjust the offset while docking. |
I haven't tested this PR in my mower, but I did some measurements to see if it could work since I thought it was a great idea to have self calibration. My 0.13.2 mb is somewhat modified since I had issues getting stable readings - I now have a capacitor over 3.3V and an "external" voltage reference to ADC_VREF. From reading PRs here, and postings on discord, I've got the impression that you have some variations in the ADC errors. Like for me on this one, does the same apply for all boards or is just on 0.13.2, or only mine? |
Use the charge current ADC when undocked to determine ADC offset, tweak the resistors values, and disable SMPS powersaving during ADC.
With this I get v_battery pretty close to the measured value