Introduction: Homemade 6 Digits Precision Thermometer With Farenheit,Reamur,Kelvin and Celcius

Picture of Homemade 6 Digits Precision Thermometer With Farenheit,Reamur,Kelvin and Celcius

In this article I wanna share my experiment on building a homemade digital thermometer with 6 digits precision,
I used a simple NTC and ATMEGA128.
Let's get started with preparing the parts....

Step 1: The Parts Needed for This Experiment...

Picture of The Parts Needed for This Experiment...

We need some parts for this experiment :
1. ATMEGA128 board, schematic please refer to
2. LCD 16x2
3. USBASP for debugger
4. NTC 10K
5  10K resistor

Step 2: Connect the NTC and Resistor to PF0

Picture of Connect the NTC and Resistor to PF0

The next step is connect all the wires from LCD to the board,
D0-D7 to PORTA of ATMEGA128
and the control of LCD to PORTD of ATMEGA128,

For NTC, I'm gonna use ADC port 0, so connect it to PF0 of ATMEGA128,
the circuit of NTC, you can see at :

Step 3: The Next Step Is Coding This ATMEGA128 to Read ADC

Picture of The Next Step Is Coding This ATMEGA128 to Read ADC

The next step is coding this ATMEGA128 to read ADC,
I compiled it with AVR Studio 6 and uploaded to my board with USBASP

void adc_init()
// enable ADC, select ADC clock = F_CPU / 128 (i.e. 125 kHz)

ADCSRA = (1<<ADEN | 1<<ADPS2 | 1<<ADPS1 | 1<<ADPS0 );

//Do a conversion

ADMUX=(1<<REFS0 | ADC_0);                  //Conversion on channel 0, thermistor input
//Internal VCC Voltage Reference
ADCSRA |= (1<<ADSC);                      //Start conversion
loop_until_bit_is_clear(ADCSRA, ADSC);    //Wait for conversion complete

uint16_t read_adc(void)
ADMUX=(1<<REFS0) | (1<<ADLAR) | ADC_0;                  // Conversion on channel 0, AVCC reference, 10 bit mode
ADCSRA |= (1<<ADSC);                     // Start conversion
loop_until_bit_is_clear (ADCSRA, ADSC);         // Wait for conversion complete

and convert the result to string, so it can be displayed on your LCD
double ntc_get_temp(long adcresistence, double A, double B, double C)
// use the Steinhart-Hart Thermistor Equation
// temperature (Kelvin) = 1 / (A + B*ln(R) + C*(ln(R)^3))
double t;
t = log( adcresistence );
t = 1 / (A + (B * t) + (C * t * t * t));
t = -1*(t - 273.15); // convert Kelvin to Celcius
//t = (t * 9.0) / 5.0 + 32.0; // convert Celcius to Fahrenheit
return t;

if (adcA != 0)
    // itoa(adcA,volts,5);
    //measure temperature
    lcd_cmd(0x80);//put the cursor into the first row
    _delay_ms (10);
    lcd_cmd(0x01);//Clear display
    adcresistance = (long)(10230000/adc_result-10000);
    //d = ntc_get_temp(adcresistance, (double)0.947070725e-3, (double)2.450662058e-4, (double)1.853992838e-7);
    d = ntc_get_temp(adcresistance, (double)0.947070725e-3, (double)2.450662058e-4, (double)2.059992838e-7);
    //display temp to LCD
    lcd_string("Temp Value");
    lcd_cmd(0xC0);//goto second row
    //lcd_string("Value of PF0");
    lcd_string("No Result!");

Step 4: Test It and Have Yourself a Homemade Thermometer With 6 Digits Precision

Picture of Test It and Have Yourself a Homemade Thermometer With 6 Digits Precision
Test it and have yourself a homemade thermometer with 6 digits precision
Checkout the video :

With Reamur, Farenheit and Kelvin

Thanks for reading


Ripper-B (author)2014-12-17

Nice attempt, but since you have a 10-bit ADC that corresponds to 1024 values (4 significant figures), you can't have a 9 digit display, not even a 5 digit one. You can refer to for more info!

Sibeiko (author)2013-05-30

If I were you, I might be careful about taking all those digits for the temperature too literally. I did research on liquid crystals for a while, which needed *extremely* precise measurements for (and control of) the temperature - and our equipment was only good to the milliKelvin range (in essence, we got 3 digits past the decimal point). And that was good enough that we could see temperature "spikes" when people entered and exited the lab (and with plenty of insulation around the experiment to boot!).

Of course, if you do want those digits, you need to be careful with the power dissapation of the NTC thermistor and calibrate the setup (icewater and boiling water at a known pressure - will be off of 0*C/100*C by a little - and maybe some other points of reference if you can get them). If I'm not mistaken, you need the calibration data for the Steinhart–Hart equation you're using.

And after all that, you should be able to reliably get those three decimal points. And only under controlled conditions (the power dissipation stuff gets thrown, for example, with moving air - though interestingly enough, that gets used for airflow sensors).

As for the rest of the digits after the decimal (more than 3), I'm not sure what to tell you to do to get them, or if it's even worth it (if you can "see" a person walking into a warm room at the 0.001 range...).

But while it would seem like I'm ragging on you, I actually like the setup you've got going. With a little more refinement, you'll have a thermometer that would be perfectly at home in a nice research lab somewhere. Or something fun to play with at home if that's more your thing!

SuperTech-IT (author)2013-05-28

If you adjust the contrast variable on the display, you can get a much more readable video.