7

Introduction


Temperature sensor is a kind of sensor that can detect temperature and transfer it into output data. Temperature sensor is the core component of temperature gauges and instruments with multiple categories. In this experiment, we are going to learn analog temperature sensor–TMP36 and display its data on micro:bit.

Components List


Hardware:

**Tips: If you want all components above, you may need Elecfreaks Micro:bit Starter Kit.**

Major Components Introduction


TMP36

TMP36 is a kind of analog temperature sensor. Its output voltage and temperature forms a linear relationship. That means higher temperature will have bigger output voltage.

Note: When we look at the front side marked “TMP36”, the left side pin of the chip is VCC, middle is Vout, and the right side pin is GND. Do not connect it wrong or the components connected might be damaged.

Here’s the curve chart for output voltage of TMP36 changing with temperature:

We can know from the above chart that the temperature formula is:

Temperature(℃)=(Output Voltage(mV)-500)/10

Experimental Procedure


Hardware Connection

Connect your components according to the picture below:

You would see as below after you finish the connection:

Software Programming

Click to open Microsoft Makecode, write the following code in the editor.

Program as the picture shows:

Details for the code:

Reference

Links:https://makecode.microbit.org/_AKuYFoDsLJ7D

You can also download the links directly:


Result


The current temperature is showing on the micro:bit.

Exploration


FAQ