vanvught / linux_rpi_artnet_l6470

2 stars 0 forks source link

Add auto calibration for thermistor #2

Closed vanvught closed 1 year ago

vanvught commented 1 year ago

This is a follow-up for #1

The 5.0V is hardcoded in this function:

    uint32_t resistor(const double vin) {
        const double d = (5 * R_GND) / vin;
        return static_cast<uint32_t>(d) - R_GND - R_HIGH;
    }

When connecting a board analog input channel to the '5V' then we can read out the real value and use this in the function.

This is not part of the auto calibration. The hardware must provide a stable 5.0 Volt reference.

The following functions will be added:

    bool Calibrate(float f) {
    void ResetCalibration() {
    int32_t GetCalibration()

For example, when the sensor reads 26.2 degrees Celsius, and the correct temperature is 26.4 degrees Celsius, then the function must be called as:Calibrate(26.4)

This will create an offset for the resistance. This offset can be read with: GetCalibration()

The calibration can be undone with: ResetCalibration()

The calibration values for each sensor will be stored in the Sensors store.

@parabolic333