temperature formula uses battery voltage instead of FVR reference #3

Closed
opened 2026-07-26 17:01:47 +00:00 by daru · 4 comments
Owner

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.

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.
Author
Owner

I'm not sure, actually, if this is correct. Need to check if VTEMP scales with battery voltage.

I'm not sure, actually, if this is correct. Need to check if VTEMP scales with battery voltage.
Author
Owner

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.

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.
Contributor

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.

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`.
daru closed this issue 2026-07-27 02:12:21 +00:00
Author
Owner
Builds, good change
Builds, good change
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
daru/PICsense#3
No description provided.