Skip to Content
Course content

Session 5.pptx (Lecture Slide)


Temperature Senso​r in Microbit


“Heat is the movement. Temperature is the measure.”


💡 Introduction

The BBC Microbit is a powerful educational microcontroller that comes equipped with a variety of built-in sensors. One of these is a temperature sensor, which allows users to measure the surrounding temperature. This feature is particularly useful in building projects such as thermometers, weather stations, and smart home systems.

A temperature sensor is an electronic device that measures the temperature of its environment and converts the data into an electronic signal. These sensors are widely used in appliances like air conditioners, refrigerators, thermostats, and environmental monitoring systems.


📘 Pre-requisite Knowledge

  • Familiarity with the Microbit hardware components (LED matrix, buttons, sensors, etc.).
  • Understanding how to connect Microbit to a computer and use the Python interface.
  • Basics of Python Programming.
  • Understanding how sensors work to collect environmental data.
  • Awareness that the Microbit has a built-in temperature sensor (part of the processor).


🎯 Learning Objectives

  • Understand the Function of the Temperature Sensor.
  • Write Python Code to Read Temperature.
  • Display Temperature Readings on the LED Matrix.
  • Simulate programs virtually.


🛠 Tools & Materials Required

  • Hardware: Computer or Laptop, BBC Microbit Board.
  • Software: Internet Browser.
  • Libraries: Microsoft Makecode.
  • Others: Internet connection.

Built-in Temperature Sensor in Microbit

  • The Microbit does not have a dedicated external temperature sensor.
  • Instead, it uses the temperature-sensing capability of the nRF51/nRF52 processor chip.
  • This chip estimates ambient room temperature based on its internal heat readings.

 

Reading Temperature in Microbit

Microbit provides an easy way to read temperature in degrees Celsius (°C) using both MakeCode block-based and Python based programming.

Using MakeCode Blocks

Use the Set temperature to ( ) block to read temperature. The result is a number representing degrees Celsius.

 

Using MakeCode Python function

input.temperature() is a function in MakeCode Python that reads the current temperature detected by the built-in temperature sensor on the microbit.

It returns the temperature value as a number in degrees Celsius (°C).


Using input.temperature() in a MakeCode Python program


Expected Outcome


Activity- Temperature Alert


Expected Outcome


🔍 Observation

  • Understand how the Microbit reads temperature.
  • Use block and text coding to access temperature data.
  • Apply sensor readings in real-world scenarios.
  • Create a basic indoor-outdoor thermometer project.


 
0 0

There are no comments for now.

to be the first to leave a comment.