For the Fuel Level and Water Temperature, calibration involves storing a set of user reference points. The module then linearly interpolates between these points (arbitrary spacing). The fuel level calibration involves starting with an empty tank, and incrementally adding a known measure (e.g. 5L steps), talking a reference point after each step.
The water temperature calibration is based on ideal values (from the datasheet) for my particular NTC sensor. The red line in the graph below shows the NTC temperature versus 12-bit ADC input value. The green line represents the interpolated values from the reference points.
The reference points are given in the table below. They were selected to minimize the error between interpolated and ideal values using Matlab / Octave.
ADC Value (12-bit) | NTC Temperature |
41 | 180°C |
72 | 150°C |
126 | 124°C |
239 | 100°C |
360 | 84°C |
638 | 65°C |
1154 | 44°C |
3320 | -4°C |
3740 | -19°C |
3892 | -30°C |
3986 | -40°C |
This results in an error of ±1°C, much better than the accuracy of the NTC.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.