Skip to content
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

User-configurable Temperature Offsets #18687

Conversation

Bob-the-Kuhn
Copy link
Contributor

@Bob-the-Kuhn Bob-the-Kuhn commented Jul 18, 2020

This is in response to Feature Request #16561

This PR add the option for the user to configure offsets for each of the temperature sensors. This allows the user to make the sensors display properly at room temperature and/or make all the sensors display the same at room temperature.


CHANGES:

Configuration.h - add temperature offset defines

temperature.cpp:

  • Temperature::updateTemperaturesFromRawValues() - add array for the heater temperature offsets
  • Temperature::updateTemperaturesFromRawValues() - add in the offset every time analog_to_celsius_XXX is called

The offsets for the following have been tested:

  • TEMP_SENSOR_0_OFFSET
  • TEMP_SENSOR_1_OFFSET
  • TEMP_SENSOR_BED_OFFSET
  • TEMP_SENSOR_PROBE_OFFSET
  • TEMP_SENSOR_CHAMBER_OFFSET
  • TEMP_SENSOR_1_AS_REDUNDANT

The offset for TEMP_SENSOR_1_AS_REDUNDANT has not been tested.

@AnHardt
Copy link
Contributor

AnHardt commented Jul 18, 2020

Amplification errors are as likely as offset errors.
Why not t = t*a+b.
That would be good for a two point calibration.

Not knowing where in the chain from sensor, amplifier, reference/pullupresistor, ADC, evalueation formular/table the error is makes the position of the corrections application a bit random. Where to apply can only be deducted from the shape of the non linearity, from more than two reference measurements. But this thoughts open a can of worms. The user would have to know what he does.

@Bob-the-Kuhn
Copy link
Contributor Author

This is basically for those that think something is "wrong" if the sensors don't all show "reasonable" values at room temperature.

For platinum RTDs I think a single point is enough. They are very linear.

If I remember correctly thermistors curves can be caIculated if you have 3-5 observed points. I know there are some methods to do this but ... my experience has been that none of the methods produce results that are anymore believable than the current Marlin thermistor tables.

Maybe the comment being added to Configuration.h should be changed to say that the offsets are only useful for PT100 and PT1000 based sensors. Maybe change the names from the current TEMP_SENSOR_xxx_OFFSET to RTD_TEMP_SENSOR_xxx_OFFSET.


Strange - I thought I had an Excel spreadsheet that would calculate a new PT100 amplifier temp table based on actual vs. reported temperature. What I found doesn't seem to be working. Oh, well - something to work on if someone wants it.

@thinkyhead thinkyhead changed the title [bugfix-2.0.x] Add User Configurable Temperature Offsets User-configurable Temperature Offsets Jul 18, 2020
@thinkyhead
Copy link
Member

When Marlin does some of its thermal runaway protection, it looks at the raw temperatures and compares against the max raw value which is calculated in-place to decide if there is some overage. I believe this change will have some effect on where the runaway appears to be triggered because the calculated celsius values may be offset from the interpreted raw value.

@AnHardt
Copy link
Contributor

AnHardt commented Jul 18, 2020

It will neiter change anything in detecting "Thermal runaway" nor "Heating failed" errors. These react only on temperature differences.
But it will affect MIN- and MAX- temperatures- when measured by the (internal) ADCs.

@thinkyhead
Copy link
Member

But it will affect MIN- and MAX- temperatures- when measured by the (internal) ADCs.

Yeah, those are the routines I was thinking of. They could be tweaked to use these offsets, but AFAIK shorting or disconnecting the sensor will throw an error even without the change.

@Bob-the-Kuhn
Copy link
Contributor Author

As far as I'm concerned this was just a "nice to do" item. I definitely don't want to inadvertently affect any of the protection features.

Time to kill this PR.

@Bob-the-Kuhn Bob-the-Kuhn deleted the Temperature-Offset branch July 23, 2020 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants