Hello guys,
I am trying to use the in-built temp.sensor of arduino(AtMega328).
It is belived to perform around +/-10 °C accuracy.
But i am trying to get it work with as much little error as possible.I have googled and found that it can be done after an initial 'caliberation'.
I have tried the code from
https://code.google.com/p/tinkerit/wiki/SecretThermometer,
My problem is I didnt understand the code,particularly the following lines:-
// Read temperature sensor against 1.1V reference
ADMUX = _BV(REFS1) | _BV(REFS0) | _BV(MUX3);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
result = (result - 125) * 1075;
It seems like we have to adjust two parameters for caliberating the sensor.
Can someone explain how to adjust these parameters to get good accuracy and precision of readings, atleast in the room temperature ranges?(I mean around 20°C-50°C)
Also it would be great if you can explain the above mentioned lines of the code.
Thanks in advance..
I am trying to use the in-built temp.sensor of arduino(AtMega328).
It is belived to perform around +/-10 °C accuracy.
But i am trying to get it work with as much little error as possible.I have googled and found that it can be done after an initial 'caliberation'.
I have tried the code from
https://code.google.com/p/tinkerit/wiki/SecretThermometer,
My problem is I didnt understand the code,particularly the following lines:-
// Read temperature sensor against 1.1V reference
ADMUX = _BV(REFS1) | _BV(REFS0) | _BV(MUX3);
delay(2); // Wait for Vref to settle
ADCSRA |= _BV(ADSC); // Convert
while (bit_is_set(ADCSRA,ADSC));
result = ADCL;
result |= ADCH<<8;
result = (result - 125) * 1075;
It seems like we have to adjust two parameters for caliberating the sensor.
Can someone explain how to adjust these parameters to get good accuracy and precision of readings, atleast in the room temperature ranges?(I mean around 20°C-50°C)
Also it would be great if you can explain the above mentioned lines of the code.
Thanks in advance..