temperature formula uses battery voltage instead of FVR reference #3
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wait-to-fix
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
daru/PICsense#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
cryogencc_pickle_01.c computes temp_c using batt_v in the formula. AN1333 specifies VTEMP = temp_raw * 2.048 / 1024 using the FVR reference, not battery voltage. Current formula will give wrong readings.
Fix: use FVR 2.048V as reference in the temperature calculation.
I'm not sure, actually, if this is correct. Need to check if VTEMP scales with battery voltage.
It would be best to figure out how to use the battery as the ADC reference voltage for everything, and to simply measure the FVR with the ADC, which will directly give us battery voltage and will extend the measurement range of the ADC by about a volt.
Needs additional work.
Fixed in PR #20: switched ADC reference to VDD, FVR read as ADC channel to determine battery voltage. Temperature formula now VDD-independent:
Vt = 2.048 * (1023 - temp_raw) / (4 * fvr_raw),Temp = (0.659 - Vt) / 0.00132 - 40.