# TMP36 Analog Temperature Sensor ## TMP 36

• Analog temperature sensor
• Measures environment temperature and returns a voltage
• Output voltage is linearly proportional to temperature
• What does this mean?

## TMP 36 ## TMP 36 Datasheet

• What are the most important elements we should be looking for?
• Datasheet

## Conversion

• 10 mV / deg Celsius with a 500 mV offset (since voltage is 500 mv at 0 deg Celsius)
• Try this: if Vout is 1.2V, what is the temperature in Celsius? in Fahrenheit?
• Remember:
• `T(fahr) = T(cel) * (9/5) + 32`
• `T(cel) = (T(fahr) - 32 ) * (5/9)`

## Important: C++ `int` and `float`

• Division with `ints` in C++ truncates decimals
``````int x = 3;
int y = 6;
float result = x / y; // 0 since 3/6 is truncated`
``````
• Instead, make sure to cast (convert) one of the `int` values to be a `float`
``````int x = 3;
int y = 6;
float result = (float) x / y;
``````

## TMP36 Wiring • Note that is BOTTOM VIEW

## Exercise Wiring ## Exercise

• Connect a TMP36 and output the current temperature to the serial monitor
• Consider what type of input is this signal? How will this value be read by Argon?

Updated: