Lab 11
Lab 11
Semester
Signature: __________________________________
11 Interfacing TMP36 Temperature Sensor with
Arduino
Lab conduct
1. You have to perform this experiment using Arduino and its Arduino IDE.
2. You are required to work in groups; everyone must attempt to understand the language syntax and
programming.
3. In case some aspect of the lab experiment is not understood, you are advised to seek help from the
instructor, lab engineer or the TA.
4. Every student has to submit individual lab manual in printed form. Use the provided Word document
to fill the manual and convert it to PDF before printing.
Lab details
One of the easiest and inexpensive ways to add temperature sensing in your Arduino project is to use
TMP36 Temperature Sensor. These sensors are fairly precise and needs no external components to work.
So, with just a few connections and some Arduino code you’ll be sensing temperature in no time.
TMP36 Temperature Sensor
The TMP36 is a low voltage, precision centigrade temperature sensor manufactured by Analog Devices.
It is a chip that provides a voltage output that is linearly proportional to the temperature in °C and is,
therefore, very easy to use with an Arduino.
The TMP36 temperature sensor is fairly precise, never wears out, works under many environmental
conditions and requires no external components to work. In addition, the TMP36 sensor does not require
calibration and provides a typical accuracy of ±1°C at +25°C and ±2°C over the −40°C to +125°C
temperature range. The sensor can be powered with a 2.7V to 5.5V power supply and consumes only
50µA.
Here are the complete specifications:
Power supply 2.7V to 5.5V
Current draw 50µA
Temperature range -40°C to 125°C
Accuracy ±2°C
Output scale factor 10mV/°C
Output range 0.1V (-40°C) to 1.75V
(125°C)
Output at 25°C 750mV
+Vs is the power supply for the sensor which can be anywhere between 2.7V to 5.5V.
Vout pin produces an analog voltage that is directly proportional (linear) to the temperature. It should
be connected to an Analog (ADC) input.
GND is a ground pin.
Connecting the TMP36 Temperature Sensor to an Arduino
Below is the hookup for the experiments with the TMP36:
The sensor can be powered from 3.3 or 5V output. The positive voltage connects to ‘+Vs’ and ground
connects to ‘GND’. The middle pin ‘Vout’ is the analog signal output from the sensor and connects to
the A0 analog input of an Arduino. To measure air temperature, leave the sensor in the open air or attach
it to an object you want to measure the temperature of, such as a hit sink.
Reading the Analog Temperature Data
As you can see in the wiring diagram above, the output of the TMP36 is connected to one of the analog
inputs of the Arduino. The value of this analog input can be read with the analogRead() function.
However, the analogRead() function does not actually return the output voltage of the sensor. Instead, it
maps the input voltage between 0 and the ADC reference voltage (technically it is the operating voltage
i.e., 5V or 3.3V unless you change it) to 10-bit integer values ranging from 0 to 1023. To convert this
value back to the sensor’s output voltage, use this formula:
Task
1. Arduino Code – Simple Thermometer
The following sketch shows a quick way to read a TMP36 temperature sensor and can serve as the
basis for more practical experiments and projects. It simply reads the value from the TMP36 using
analog port A0 and prints the current temperature (in both °C and °F) on the serial monitor. Go ahead
and upload it to your Arduino.
Execute the code and screenshot the results.
2. Problem Statement
Interface a temperature sensor with a microcontroller to measure and display the temperature on an
LCD screen and turn on and off the led when
Led on: when temperature is above 50 degrees
Led off: when temperature is below 25 degrees
You need to
1. Make the block diagram
2. Make the flow chart
3. Write the code
4. Execute the code and screenshot your results
Assessment rubric for Lab
Method for assessment:
Lab reports and instructor observation during lab session.
Outcome assessed:
a. Ability to conduct experiments, as well as to analyze and interpret data (P)
b. Ability to function on multi-disciplinary teams (A)
c. Ability to use the techniques, skills, and modern engineering tools necessary for engineering practice (P)
Signature: ______________________