Data Sheet

77 : circuit 4b
NEW COMPONENTS
TMP36 TEMPERATURE SENSOR:
This temperature sensor has three legs.
One connects to 5V, one to ground, and the
voltage output from the third leg varies
proportionally to changes in temperature.
By doing some simple math with this
voltage, we can measure temperature in
degrees Celsius or Fahrenheit.
TMP
NEW CONCEPTS
ALGORITHMS: An algorithm is a process
used in order to achieve a desired result.
Often, the information needed to create
an algorithm lives in the part’s datasheet.
This sketch uses a few formulas to turn
a voltage value into a temperature
value, making them all part of the larger
temperature-retrieving algorithm. The first
formula takes the voltage read on analog
pin 0 and multiplies it to get a voltage value
from 0V–5V:
voltage = analogRead(A0) * 0.004882814;
The number we are multiplying by comes
from dividing 5V by the number of samples
the analog pin can read (1024), so we get:
5 / 1024 = 0.004882814.
The second formula takes that 0–5V value
and calculates degrees Celsius:
degreesC = (voltage - 0.5) * 100.0;
The reason 0.5V is subtracted from the
calculated voltage is because there is a 0.5V
offset, mentioned on page 8 of the TMP36
datasheet found here: http://sfe.io/TMP36.
It’s then multiplied by 100 to get a value
that matches temperature.
The last formula takes the Celsius
temperature and converts it to a
Fahrenheit temperature using the standard
conversion formula:
degreesF = degreesC * (9.0/5.0) + 32.0;
Together, these three formulas make up the
algorithm that converts voltage to degrees
Fahrenheit.
Circuit 4B:
Temperature
Sensor
Want to create a DIY environmental
monitor or weather station? You can use
a small, low-cost sensor like the TMP36
to make devices that track and respond
to temperature. In this activity you will
also use the LCD screen to display sensor
readings, a common use for LCDs in
electronics projects.
YOU
NEED
TMP
LCD DISPLAY POTENTIOMETER TEMPERATURE SENSOR 19 JUMPER WIRES