How to Display Analog Value of Current Temperature with Micro:bit?
Overview
In this project, we are going to detect another important index in the environment, that is, temperature. You will learn how to use an analog temperature sensor and micro:bit to display the analog value of current temperature on the micro:bit LED matrix or on the CoolTerm monitor.
Component Required:
-
Micro:bit main board*1
-
Keyestudio Micro bit Sensor V2 Shield*1
-
USB Cable*1
-
keyestudio Analog Temperature Sensor*1
-
DuPont Jumper Wire*3
-
Premium Battery Holder 6-cell AA*1
-
1.5V AA Battery*6
Component Introduction
Analog Temperature Sensor:
This analog temperature module is based on a thermistor whose resistance varies with temperature change.
It can detect surrounding temperature changes in real time.
Through the circuit connection, convert the resistance changes into voltage changes, then input the voltage changes into Analog Input of micro:bit via signal end. Actually the analog value of micro:bit can be calculated into temperature value via programming.
This sensor is convenient and effective, widely applied to home alarm system, gardening, and other devices.
Connection Diagram
Test Code
Test Results
Connect micro:bit to computer via USB cable and transfer code to micro:bit. Open CoolTerm, click Options and select SerialPort, set COM port and baud rate(115200). Click OK and Connect.
Micro:bit displays the detected analog signal and CoolTerm serial monitor shows the analog temperature value, as shown below: