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

High temperature thermistor support #4098

Conversation

JeanSebastienCarrier-Dyze

This is a follow up of : #2915 and #2941 (since changes that were made in MarlinDev are brought back in Marlin)

These modifications allow the use of high temperature thermistors in order to handle hot ends temperature up to 500 degrees Celsius.

Because thermistors able to read higher temperature tend to have a hard time reading lower values, two "defines" were added to allow a "preheating time" as well as handle some measure of noise reading (sudden drops for a few frames).

These defines have been added to the default configuration. Using another configuration or commenting these additions produce the same execution than before these changes.

A high temperature compatible thermistor has been added (no 66) to the thermistor table

The tests were taken from #2066
The hardware was : Board: Arduino MEGA2560 with RAMPS 1.4
Dyze Design sensor 500°C
HEATER_0_MINTEMP 21
MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED = 5;
MILLISECONDS_PREHEAT_TIME = 20000;

TEST 7 - Hotend's thermistor disconnected before startup
No error is shown. Temperature shown is 20°C, 1°C below the mintemp error.
Since the conditions «is preheating» and «target temperature > 0» is not met, the min_temp error is not shown as it would normally be.

TEST 9 - Hotend's thermistor disconnected after heating begins AND before (preheating time) seconds elapsed
Heater remains ON for the duration of "preheating time". Turns OFF once the duration is elapsed.

TEST 11 - Hotend's thermistor disconnected after heating begins AND after (preheating time) seconds elapsed
Min_temp error, heater is disabled.

TEST 13 - Hotend's thermistor disconnected after target temperature reached.
Min_temp error, heater is disabled.

@@ -161,6 +161,9 @@ int Temperature::maxttemp_raw[HOTENDS] = ARRAY_BY_HOTENDS(HEATER_0_RAW_HI_TEMP ,
int Temperature::minttemp[HOTENDS] = { 0 };
int Temperature::maxttemp[HOTENDS] = ARRAY_BY_HOTENDS1(16383);

int Temperature::consecutive_low_temperature_error[HOTENDS] = ARRAY_BY_HOTENDS(0, 0, 0, 0);
unsigned long Temperature::preheatStartTime[HOTENDS] = ARRAY_BY_HOTENDS(0, 0, 0, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For arrays initialized to zero, you can just use { 0 } rather than these macros.

@Grogyan
Copy link
Contributor

Grogyan commented Jun 20, 2016

I'd prefer seeing people use a PT100 or thermocouple instead of these "high temperature" thermistors

@woodencase01
Copy link

@Grogyan It is true that the best case would be to use the proper amplification circuit with a platinum or thermocouple sensor, but I prefer a drop-in remplacement with minimum hardware add-on and changes.

All sensors have their advantages and disadvantages. Since it is possible to do a little trick on the firmware to go around the weakness of the high temperature thermistor ( low resolution below 40°C ) , it makes this solution more than interesting;

  • Better resolution than an amplified PT100 from 100°C to 400°C (Ultimaker circuit Op-Amp)
  • Better resolution than K type thermocouple from 140°C to 325°C (using AD595)
  • No add-on circuit required
  • Faster response than PT100
  • Very stable

I think these sensors have been underrated due to their limitation at low temperature and I think it is very well suited for 3D printer application.

@Grogyan
Copy link
Contributor

Grogyan commented Jun 21, 2016

@woodencase01 laziness usually wins out every time. Why go out and buy a hammer to tap something in place, when a screwdriver works just as well.
Not really a good analogy. but I reckon you get my drift.
I hope you realize that the PT100 and a AD595 produce a voltage which gets fed into the Arduino ADC which is 10bit (Arduino 2560), normal thermistors also have to utilize the same 10bit ADC channel therefore the resolution is the same.
The MAX6675 uses a on-chip 12bit ADC and the MAX31855 uses a 14bit on-chip ADC therefore higher resolution is available.

I do agree though that Marlin should support a variety of thermistors in the meantime

@woodencase01
Copy link

@Grogyan Thanks for your reply! I didn't know the MAX6675 and MAX31855 at all, very interesting.

Regarding both the PT100 and AD595, they end up having a different resolution because they use a different portion in the 5V ADC range at the output. The amplified PT100 has 1.1V at 0°C up to 2.65V at 400°C.
The AD595 output 0V at 0°C up to 3V at 300°C.
The voltage divider with the high temperature thermistor with a 4.7kΩ pullup end up showing .025V et 500°C up to 4.92V at 20°C.

I'm currently writing a blog about temperature sensors for 3D printers, I'll keep you updated :D

- Added thermistor 66 in configuration.h
- Use ending time and macro instead of start Time for preheat function
- Use { 0 } instead of ARRAY_BY_HOTENDS macro  to initialize static
members when applicable
- Wrapped some variables and functions in #ifdef block where relevant
@JeanSebastienCarrier-Dyze
Copy link
Author

Seems like I did a bad merge with thermistortables.h, will fix this asap

if (celsius == 0.0f)
reset_preheat_time(hotend);
else if (target_temperature[hotend] == 0.0f)
start_preheat_time(hotend);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 4 lines need indentation.

Moved define for high temp thermistors to configuration_adv.h and copied
the segment for every configuration_adv in example_configurations.

Add UNUSED(hotend) in default case of is_preheating to remove warning
@JeanSebastienCarrier-Dyze
Copy link
Author

Any news on this? Does something else needs improvement?

@thinkyhead
Copy link
Member

thinkyhead commented Jul 9, 2016

Hi @JeanSebastienCarrier-Dyze Everything looks good to me, although I have a couple of cleanups that I would make before merging. If you could squash and rebase these commits it will help a lot. Otherwise I'm stuck making a completely new PR and your moniker won't be on any of the commits. My version of this PR is now posted at #4244.

@thinkyhead thinkyhead closed this Jul 11, 2016
@jbrazio jbrazio modified the milestone: 1.1.0 Jul 18, 2016
drewmoseley pushed a commit to drewmoseley/Marlin that referenced this pull request Nov 8, 2023
PFW-1515 Fix an issue with Thermal Anomaly message
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.

5 participants