# Arduino Temperature Indicator

1,339

27

## Introduction: Arduino Temperature Indicator

This is the sixth module in a series of lesson for the Arduino 101 centred around the use of a temperature sensor.

This project uses a cheap temperature sensor to measure the surface temperature of any objects or the surrounding air and then outputting it to an Arduino Console via serial communication. The circuitry is quite simple although the code is relatively more complicated for this proje

### Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

## Step 2: Circuitry

Connecting the Arduino Power to the breadboard

• Connect the 3.3V pin and GND pin from the Arduino to the red and black power rails in the breadboard, respectively.

The temperature sensor has polarity so it is crucial that you do not reverse the polarity when connecting it.

• Connect the red power rail from the breadboard to the bottom most pin of the temperature sensor with the flat side facing right with an orange jumper cable
• Connect the black power rail from the breadboard to the top most pin of the temperature sensor with the flat side facing right with a black jumper cable
• Connect the middle pin to the A0 header of the Arduino board.

## Step 3: Coding

Depending on the voltage supplied to the temperature sensor, the temperature reading will vary linearly, thus we will multiply the voltage, in this case, 3.3V used by the voltage readings from the analog pin.

const int tempPin = 0;

//voltage variable float volts;

//final temperature variables float tempC; float tempF;

void setup() { // start the serial port at 9600 baud Serial.begin(9600); }

void loop() { //read the temp sensor and store it in tempVal tempVal = analogRead(tempPin);

//print out the 10 value from analogRead Serial.print("TempVal = "); Serial.print(tempVal);

//print a spacer Serial.print(" **** ");

//converting that reading to voltage by multiplying the reading by 3.3V (voltage of //the 101 board) volts = tempVal * 3.3; volts /= 1023.0;

//print out the raw voltage over the serial port Serial.print("volts: "); Serial.print(volts, 3);

//print out divider Serial.print(" **** ");

//calculate temperature celsius from voltage //equation found on the sensor spec. tempC = (volts - 0.5) * 100 ;

// print the celcius temperature over the serial port Serial.print(" degrees C: "); Serial.print(tempC);

//print spacer Serial.print(" **** ");

// Convert from celcius to fahrenheit tempF = (tempC * 9.0 / 5.0) + 32.0;

//print the fahrenheit temperature over the serial port Serial.print(" degrees F: "); Serial.println(tempF);

//wait a bit before taking another reading delay(1000); }

## Step 4: Demo

The temperature is printed on Serial Monitor of the Arduino IDE. You can verify it is running by touching the temperature sensor and see the temperature change as it detects your body temperature at your hand. Participated in the
Makerspace Contest 2017