Go Down

Topic: Help with Arduino digital thermometer!? (Read 4701 times) previous topic - next topic


Ok so I just ordered an Arduino (Arduino UNO SMD and it comes in Saturday) and I want to make a digital thermometer. I have never even touched one before or seem one in person. I have the 4-digit 7 segment LED, thermometer and a small red bread board with male to male jumper wires. So can anyone explain to me how to hook it up right and where or what is the code to run it on? I already know how to download the software and stuff (connecting it) but I don't know how to set it up right and what's the code to use.




Hi Ethan

This depends entirely on which temperature sensor you have bought.  Do you have the model?  If it's a TMP36 (say) googling "TMP36 Arduino tutorial" will more often than not find you a step-by-step guide.  If you don't find it that way, find a datasheet for the model you have and you might find it's a drop-in replacement for another component where you'll find a guide.

Alternatively, you'll find a lot of history with sensing temperature in the playground on this site, and in this forum.

Cheers ! Geoff
"There is no problem so bad you can't make it worse" - retired astronaut Chris Hadfield



Here's something I found that you might be interested in:

Code: [Select]

//TEMP in deg C ~ /10000
//The sensor isn't very accurate - the data sheet says ±10°C. But once you've worked out the offset and correct for it, accuracy improves
//This sensor is pretty useless unless you calibrate it against a known temperature.
//The sensor outputs in approximately 1°C steps.

long readTemp() {
  long result;
  // 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;
  return result;

void setup() {

void loop() {
  Serial.println( readTemp(), DEC );

I just ran the code last night and it gave me an avg temp (on the arduino board) of 26 C ~ 78.8 F.  I'm going to compare the arduino value to another digital thermometer (infared? I think) for accuracy as soon as I can find it.  You may not have much use for this because it measures the temp of the board, but you never know when it might be useful.



You should go through the Tutorial section of Arduino.cc to get an idea of how to program it and how the language looks like.
We can post code but I assume your goal is to understand your project.

[post sensor type]+1

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up