Hi, i'm working with the ATSAM20DJ18A (using ASF) and i'm doing some temperature monitoring. But it seems like I'am stucked at 169 degre celsius. Is there a way maybe by changing the ADC reference to mesure 200 degre celsius?
Regards,
Hi carrelito1824,
It's possible but you have to do that with caution.
The temperature sensor of the ATSAMD20J18 is an on-chip thermal sensor. The temperature it senses is the die temperature of the MCU. To be able to read 200 °C from the temperature sensor, the die temperature itself should be raised to 200 °C. This may be too much thermal stress for your MCU and you risk damaging the device.
So, if you want to pursue your objective you have to obtain more technical information and guidance before you proceed.
If you were able to read a maximum of 169 °C, you are lucky because for a 1.0 V reference, this is the maximum temperature (169.783 °C) you can read with the minimum temperature sensor slope of 2.3 mV/°C. With the typical temperature sensor slope of 2.4 mV/°C you get only 163.75 °C and with the maximum temperature sensor slope of 2.5 mV/°C you get only 158.2 °C. Note also that the integrated temperature sensor has an accuracy of only ±10 °C.
If you have the typical Analog supply voltage (VDDANA) of 3.3 V, here is a convenient way to allow the microcontroller to read 200 °C from the temperature sensor without using an external voltage reference. Do these:
Because of the 2x gain factor,
2 * 0.667 mV = 1.334 V.
2 * 2.4 mV/°C = 4.8 mV/°C
Owing to the combined effects of the new reference voltage and the 2x gain factor,
2.2297 V - 1.334 V = 895.7 mV
895.7 mV / (4.8 mV/°C) = 186.604 °C
25 °C + 186.604 °C = 211.604 °C.
Using the maximum temperature sensor slope (2x)(2.5 mV/°C), the maximum temperature that can be read is 204.14 °C. Since these maximum temperature estimates are just slightly greater than your 200 °C target, the dynamic range of the ADC is almost fully utilized.
Just be reminded that the reference and gain factor selection affect all ADC channels. This can introduce additional obstacle(s) when you have other quantities to be measured in the other ADC channels.
Goodwin
I just want to echo @Goodwin's comment on being careful with high temperatures. The device has an absolute operating temperature range of -40°C to 85°C where it is guaranteed to work. Running the device outside this range can lead to all sorts of issues and unknown behavior, especially on the analog side. So even though it is theoretically possible to measure 200+°C , you can not be sure that the value you are reading on the ADC is in fact the correct value.
When that is said I have done some experimenting using a K probe thermocouple for measuring high temperatures, that way the device can live in room temperature. The ADC settings I used to make this work is a follows:
static void service_adc_configure(void)
{
struct adc_config config_adc;
adc_get_config_defaults(&config_adc);
config_adc.clock_source = GCLK_GENERATOR_1;
config_adc.clock_prescaler = ADC_CLOCK_PRESCALER_DIV16;
config_adc.positive_input = ADC_POSITIVE_INPUT_PIN3;
config_adc.negative_input = ADC_NEGATIVE_INPUT_PIN2;
config_adc.gain_factor = ADC_GAIN_FACTOR_16X;
config_adc.differential_mode = true;
config_adc.resolution = ADC_RESOLUTION_CUSTOM;
config_adc.accumulate_samples = ADC_ACCUMULATE_SAMPLES_1024;
config_adc.divide_result = ADC_DIVIDE_RESULT_128;
config_adc.reference = ADC_REFERENCE_INT1V;
adc_init(&adc_instance, ADC, &config_adc);
adc_enable(&adc_instance);
adc_register_callback(&adc_instance, service_adc_callback, ADC_CALLBACK_READ_BUFFER);
adc_enable_callback(&adc_instance, ADC_CALLBACK_READ_BUFFER);
}
Note that the k probe is a differential probe, so to get very accurate measurements you need to take into account the temperature on the "other junction" of the k probe, i.e. the temperature where the thermocouple connects to the device. E.g. using the internal temperature sensor of the device. You find more info on thermocouples here Thermocouple - Wikipedia, the free encyclopedia.
If you are not concerned with sub 1 degree accuracy you can do an assumption that the SAM D20 always is at room temperature, hence the transfer function becomes easier. So what I did in my application to calculate the absolute temperature in C:
while (adc_read_buffer_job(&adc_instance, (uint16_t*)results,
sizeof(results)/sizeof(int16_t)) != STATUS_OK);
for (uint8_t i = 0; i < sizeof(results)/sizeof(int16_t); i++) {
result = results[i] / 8;
avg_result += result;
avg_result = avg_result / (sizeof(results)/sizeof(int16_t));
//temperature = ((double)avg_result + 5.0)*0.625;
temp = ((double)avg_result - Toffset)*k;
Where "Toffset" is the value measured at 0°C (ice water) and "k" is given by:
#define Toffset 0
#define ADCt2 149
#define T2 100
#define k T2/(ADCt2 - Toffset)
My application was to convert a toaster oven to a reflow oven, and the k probe together with the SAM D20 ADC seems to work pretty nice.
Best Regards,
Ivar
Hi Ivar,
You tried to @mention me but it didn't work . I also experience this sometimes.
For the U package grade, ambient temperature (TA) range = -40 to 85 °C, the maximum junction temperature (TJ) is 100 °C for the characteristics of the device to be valid.
For the N package grade, ambient temperature (TA) range = -40 to 105 °C, the maximum junction temperature (TJ) is 145 °C for the characteristics of the device to be valid.
Beyond the corresponding temperature rating of the MCU, the temperature sensor characteristics may deviate sharply from my previous computation and there's no assurance to the functional operation of every section of the MCU.
Amazing. I'm extremely surprised that the chip managed to get to 169 degrees centigrade. I though about 150 was the maximum one even ever ran power diodes at.