• G-Codes
  • Configuration
  • Develop
  • About us
  • Privacy Policy

Repetier-Firmware - Configuration - Temperatures

Introduction

For monitoring or to control a heater/cooler you will need a temperature output. With this module concept it does not matter how the temperature is measured, all that matters is that you have a output instance that uses the reporting format. So you can have thermistors that get masured by an analog pin, whcih you convert with a conversion table to a temperature or you use a chip that you can query the temperature directly.

Conversion Tables

For all analog inputs that have a nonlinear characteristic, you will need a conversion table that converts a analog signal (value 0..4095) into a temperature in °C. You can define such a table as follows:

#define NUM_MY_TABLE 28
#define MY_TABLE \
    { 4, 864 * 8 }, { 84, 300 * 8 }, { 100, 290 * 8 }, { 116, 280 * 8 }, \
        { 132, 270 * 8 }, { 156, 260 * 8 }, { 184, 250 * 8 }, { 216, 240 * 8 }, \
        { 256, 230 * 8 }, { 300, 220 * 8 }, { 360, 210 * 8 }, { 428, 200 * 8 }, \
        { 512, 190 * 8 }, { 616, 180 * 8 }, { 736, 170 * 8 }, { 884, 160 * 8 }, \
        { 1060, 150 * 8 }, { 1264, 140 * 8 }, { 1500, 130 * 8 }, { 1764, 120 * 8 }, \
        { 2052, 110 * 8 }, { 2352, 100 * 8 }, { 2936, 80 * 8 }, { 3424, 60 * 8 }, \
        { 3752, 40 * 8 }, { 3944, 20 * 8 }, { 4032, 0 * 8 }, { 4095, -20 * 8 }

The table needs a name that is per convention all uppercase. Here it is MY_TABLE. You define a list with {analog value, temperature * 8} seperated by a comma. If you want to split it into several lines finish the last character with a backslash \. All values must be integers so us eonly integer temperatures! The second define is NUM_ plus table name, here NUM_MY_TABLE and contains the number of values.

It is also important that the analog values increase from left to right. This means for NTC sensors the temperatures decrease from left to right while for PTC sensors the temperatures will rise from left to right.

For the typically used case of a 4.7K resistor in series with a thermistor, we have already predefined temperature tables:

Name Thermistor
Epcos_B57560G0107F000 Epcos B57560G0107F000
EPCOS_G550 Epcos G550
ATC_104GT ATC 104GT
Honeywell_135_104LAG_J01 100k Honeywell 135-104LAG-J01
Vishay_NTCS0603E3104FXT 100k 0603 SMD Vishay NTCS0603E3104FXT
Sensing_AL03006_58_2K_97_G1 100k GE Sensing AL03006-58.2K-97-G1
RS_198_961 RS 198_961
PT100_5V PT100 at 5V reference
NUM_PT100_3_3V PT100 at 3.3V reference
NTC_3950 Generic NTC curve with beta 3950
DYZE_DESIGN_500 DYZE DESIGN 500
B3_innovations_500 B3 innovations 500
PT1000_4k7 PT1000 with 4.7k resistor
PT1000_1k PT1000 with 1k resistor

Depending on the type (NTC/PTC) you can now create a temperature table instance using one of the following methods:

NTC Table Conversion
Description

Creates a converter to convert a analog input into a temperature for a table with NTC logic.

Syntax
IO_TEMP_TABLE_NTC(name, table)
Parameter
Parameter Function
name The variable name used to reference this converter later.
table Table name. Do NOT put it in quotes!
Postprocess

Use the converter as input for temperature reading.

PTC Table Conversion
Description

Creates a converter to convert a analog input into a temperature for a table with PTC logic.

Syntax
IO_TEMP_TABLE_PTC(name, table)
Parameter
Parameter Function
name The variable name used to reference this converter later.
table Table name. Do NOT put it in quotes!
Postprocess

Use the converter as input for temperature reading.

Temperature Outputs

Analog to Temperature
Description

Uses an analog input and a conversion table to gain a temperature. Several instances can share the same conversion table. The variant with _PERMANENT_ERROR will keep an error that happened once until reset to make it easier to find the source.

Syntax
IO_TEMPERATURE_TABLE(name, analog, table)
IO_TEMPERATURE_TABLE_PERMANENT_ERROR(name, analog, table)
Parameter
Parameter Function
name The variable name used to reference this temperature output later.
analog Analog input variable.
table Table converter previously defined.
Postprocess

Use the output for heater and cooler controls.

Linear Analog to Temperature
Description

Uses an analog input and the equation T = (V - offset) / vPerKelvin to compute the temperature. Several instances can share the same conversion. The variant with _PERMANENT_ERROR will keep an error that happened once until reset to make it easier to find the source.

The AD8495 has 1.25V offset and vPerKelvin 0.005V/K. The AD595 has 0.01V/K.

Syntax
IO_TEMPERATURE_LINEAR_ANALOG(name, analog, maxVoltage, offset, vPerKelvin)
IO_TEMPERATURE_LINEAR_ANALOG_PERMANENT_ERROR(name, analog, maxVoltage, offset, vPerKelvin)
Parameter
Parameter Function
name The variable name used to reference this temperature output later.
analog Analog input variable.
maxVoltage Voltage at maximum analog read. Normally 3.3 or 5.0
offset Voltage offset for 0°C
vPerKelvin Voltage change per kelvin
Postprocess

Use the output for heater and cooler controls.

Analog to Temperature from Steinhart–Hart equation
Description

Uses an analog input and Steinhart–Hart equation to gain a temperature. Several instances can share the same conversion table. The variant with _PERMANENT_ERROR will keep an error that happened once until reset to make it easier to find the source. A tool to compute the coefficients from given temperature/resistance values can be found here.

Syntax
#define IO_TEMPERATURE_BETA(name, analog, beta, seriesResistance, thermistorR25, cCoefficient)
#define IO_TEMPERATURE_BETA_PERMANENT_ERROR(name, analog, beta, seriesResistance, thermistorR25, cCoefficient)
Parameter
Parameter Function
name The variable name used to reference this temperature output later.
analog Analog input variable.
beta Beta value from your thermistor. See datasheet.
seriesResistance Resistance of extra resistor on board. Normally 4700 ohm.
thermistorR25 Thermistor resistance at 25°C. Normally 100000 ohm types are used for printers. See datasheet.
cCoefficient C coefficient for Steinhart–Hart equation for thermistor. See datasheet.
Postprocess

Use the output for heater and cooler controls.

MAX31855
Description

The MAX31855 offers a SPI interface for PT100 sensors. They return the temperatures directly with a resolution of 0.25°C.

Syntax
IO_TEMPERATURE_MAX31855(name, spiDevice)
Parameter
Parameter Function
name The variable name used to reference this temperature output later.
spiDevice Name of the SPI device. SPI mode 0 (software) or 1 (hardware), Max. frequency 5MHz, MSB bit.
Example

Using software SPI you only need the miso pin for SPI as it is a read only chip.

IO_SPI_SW(SPITc0, 0, 0, true, CS_PIN, CLK_PIN, MISO_PIN, -1)
IO_TEMPERATURE_MAX31855(TempExt1, SPITc0)

For hardware SPI you only need to know the chip select pin used.

IO_SPI_HW(SPITc0, 5000000, 1, true, THERMOCOUPLE_0_PIN)
IO_TEMPERATURE_MAX31855(TempExt1, SPITc0)
Postprocess

Use the output for heater and cooler controls.

MAX6675
Description

The MAX6675 offers a SPI interface for PT100 sensors. They return the temperatures directly with a resolution of 0.25°C in a range of 0-1023°C. Due to conversion timing required new temperatures are only sampled if at least 230ms are past since last measurement!

Syntax
IO_TEMPERATURE_MAX6675(name, spiDevice)
Parameter
Parameter Function
name The variable name used to reference this temperature output later.
spiDevice Name of the SPI device. SPI mode 0 (software) or 1 (hardware), Max. frequency 4MHz, MSB bit.
Example

Using software SPI you only need the miso pin for SPI as it is a read only chip.

IO_SPI_SW(SPITc0, 0, 0, true, CS_PIN, CLK_PIN, MISO_PIN, -1)
IO_TEMPERATURE_MAX6675(TempExt1, SPITc0)

For hardware SPI you only need to know the chip select pin used.

IO_SPI_HW(SPITc0, 4000000, 1, true, THERMOCOUPLE_0_PIN)
IO_TEMPERATURE_MAX6675(TempExt1, SPITc0)
Postprocess

Use the output for heater and cooler controls.

Fake Temperature
Description

Adds a fake temperature input in case you want to test already without having a working sensor connected.

Syntax
IO_TEMPERATURE_FAKE(name, fakeTemp)
Parameter
Parameter Function
name The variable name used to reference this temperature output later.
fakeTemp The temperature to return on queries.
Postprocess

Use the output for heater and cooler controls.