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,
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.
Goodwin