Thermometer

Learners turn the micro:bit into a thermometer, compare it with the weather report and work out the difference.

Go to the code ↓

Lesson at a glance

45 to 60 minutes · Grades 5 to 7

maze.education/microbit/lessons/thermometer

Grades
Grades 5 to 7
Time
45 to 60 minutes
The CAPS gives Coding and Robotics 2 hours a week (Coding and Robotics CAPS, Grades 4 to 6, page 22; Grades 7 to 9, page 22).
Level
Getting started
A good first or second micro:bit lesson. No coding needed before.
Board
Any micro:bit
Code with
MakeCode and Purple Mash blocks, with Python as an extension
CAPS
Mathematics, Natural Sciences and Technology, Natural Sciences, Coding and Robotics
Aligned: Grade 6, Term 3 · Where it fits

Learning intentions

Learners will learn to:

  1. Read the micro:bit's temperature sensor and show the result in degrees Celsius.
  2. Measure, record, compare and order temperatures in different places.
  3. Calculate the difference between the micro:bit's reading and the weather report's.

Success criteria

Each learner can say:

  • I can program the micro:bit to show the temperature in degrees Celsius.
  • I can record temperatures in a table and order them from coldest to warmest.
  • I can work out the difference between two temperatures.

Competencies

From the Coding and Robotics CAPS places this lesson cites.

  • R.5Design a simple artefact based on a set of design instructions

Key words

temperature
How hot or cold something is.
degrees Celsius (°C)
The unit we use for temperature. Water freezes at 0 °C and boils at 100 °C.
sensor
A part that measures something. The micro:bit's temperature sensor is inside its processor chip.
difference
How much bigger one number is than another: subtract the smaller from the bigger.

What you need

  • One micro:bit per pair, with a USB cable and a battery holder
  • A computer with Chrome or Edge for each pair
  • The current temperature for your town on a weather website, opened on the class computer, and a recording table

From our shop: BBC micro:bit V2 Go, BBC micro:bit V2.21 Next Gen Classroom Pack

Safety

  • Never put the micro:bit near a heater, a stove or in a fridge: measure air temperatures only.
  • Keep the micro:bit dry, and hold it by its edges rather than the parts on the back.
  • Use the battery holder with two AAA batteries. Never mix old and new batteries, and take the batteries out before the kits are packed away.

The lesson plan

One lesson of 45 to 60 minutes in three parts: introduction, lesson development and consolidation. The CAPS gives Coding and Robotics 2 hours a week, so it fits one of the week's lessons. Times are a guide.

  1. Introduction

    5 to 10 minutes
    Retrieval practice

    What is an input? (Information going into a computer, such as a button press or a reading from a sensor.)

    Problem statement

    On hot afternoons some classrooms become hard to work in, and the school wants to know which rooms and corners get warmest. Turn the micro:bit into a thermometer, check it against the weather report, and measure the warmest and coolest places.

    1. Ask: what is the temperature outside right now? Collect guesses, then look up the current temperature for your town on a weather website.
    2. Read the problem statement. Ask: where in the school is the warmest place? The coldest? Write predictions on the board.
  2. Lesson development

    35 to 40 minutes
    1. Unplugged first. Pairs order five picture cards from coldest to hottest: an ice cube, the Highveld on a winter morning, the classroom, a cup of tea, boiling water. Add a sensible temperature to each.
    2. Plan on paper first. Pairs fill in an IPO table for the thermometer and write its algorithm in numbered steps. Grade 7 learners add a trace table for three passes of the loop.
    3. Predict. Ask: will the micro:bit read the same as the weather website, or higher, or lower? Pairs write their prediction beside the plan.
    4. Build in blocks. Pairs share one computer. The driver builds the thermometer from the Blocks tab; the navigator checks each block against the algorithm. Swap roles halfway, once the temperature block is in place.
    5. Test and debug. Move the simulator's temperature control and check that the number changes. Then download it, leave the micro:bit on batteries outside in the shade for two minutes, and record its reading and the weather website's temperature for your town. Work out the difference: the micro:bit measures the temperature of its own chip, which is often a little warmer than the air.
    6. Measure three places with the micro:bit: a sunny windowsill, a shady corner, inside a bag. Record the results, order them, and discuss which place was warmest and why.

    Plan on paper: a model answer

    In pairs, fill in an IPO table for the thermometer and write its algorithm. Grade 7 learners also trace three passes of the loop.

    Algorithm
    1. Read the temperature.
    2. Show the number.
    3. Show the letter C.
    4. Wait one second.
    5. Go back to step 1.
    IPO table
    InputProcessingOutput
    The temperature sensor inside the processor chipRead the temperature in degrees Celsius, once a second, foreverThe number, then the letter C, on the display
    Trace table
    Grade 7: three passes of the forever loop, for example as the board is carried to a sunny windowsill.
    PassTemperature read (°C)The display shows
    12323, then C
    22323, then C
    32626, then C
  3. Consolidation

    5 to 10 minutes
    1. Ask: by how many degrees did your micro:bit differ from the weather report?
    2. Ask: if the micro:bit always reads 2 degrees high, how could we change the program to correct it?
    3. Back to the problem: order the class's warmest and coldest readings on the board. Which room or corner would you tell the principal about, and what evidence would you show?

Build it, step by step

Pairs build the program in blocks, following the numbered steps, with the same program as text beside them to check against or paste. Test in the simulator before sending it to a board.

A forever loop: read the temperature in degrees Celsius, show the number, show the letter C, pause one second, and repeat. A note explains the sensor is inside the processor chip.
The temperature sensor sits inside the processor chip, which is often a little warmer than the air, so learners compare it with the weather report.

These are the MakeCode steps. The other routes are on the lesson's web page.

Build it in MakeCode blocks

  1. Start a New Project called Thermometer.
  2. From Basic, drag show number into forever.
  3. From Input, drag temperature (°C) into the number.
  4. From Basic, add show string and type C, so it reads like 24 then C.
  5. From Basic, add pause (ms) of 1000 so it shows the temperature once a second.
  6. Test in the simulator with its temperature control, then Download.
The same blocks as text (to paste into MakeCode)
basic.forever(function () {
    basic.showNumber(input.temperature())
    basic.showString("C")
    basic.pause(1000)
})

To use the text instead: open MakeCode, start a new project, click JavaScript at the top, replace what is there with this code, then click Blocks to see it as blocks.

To send it to the board, click Download. In Chrome or Edge, MakeCode can connect to the micro:bit by USB so the program goes straight onto it. Otherwise a .hex file downloads: drag it onto the MICROBIT drive.

Extension or homework

Challenges for learners who finish early, or to take further in a club or as homework.

  1. Challenge 1

    Record the temperature at the same time each day for a week, and draw a line graph.

  2. Challenge 2

    Find the warmest and coolest places in the classroom with the board, then see whether the warm spots are near windows.

  3. Challenge 3

    Log the temperature automatically with the Data logger lesson (micro:bit V2).

  4. Challenge 4

    Make an LED temperature alert, as in the Grade 6 CAPS: show a warning picture when the room is warmer than 30 °C.

Support and extension

Support

For learners who need more help

  • Give a recording table with the places already written in.
  • Let learners read the micro:bit with a partner and agree on the reading.

Extension

For learners who are ready for more

  • Correct the reading in code: subtract your measured difference with a minus block from Math.
  • Use if and show icon to show a happy face between 18 and 26 degrees and a sad face outside it.

Informal assessment

Ask these as learners work. Informal assessment happens every day and is not recorded.

  1. What unit does the micro:bit use for temperature?
  2. Why might the micro:bit read warmer than the air around it?
  3. The micro:bit says 27 and the weather report says 24. What is the difference?
Exit question

Which reading would you trust more, and why?

Observation checklist

Watch pairs as they plan, build and test. Write each pair's initials under the level you see.

Watch forBeginningDevelopingAccomplishedExemplary
Fills in the IPO table: the sensor in, the reading processed, the number out.
Builds the loop with the reading, the C and a pause.
Records readings carefully in a table, with the unit.
Works out a difference and explains why the chip may read warm.
Beginning:
not yet, even with help
Developing:
with help
Accomplished:
on their own
Exemplary:
on their own, and explains it or takes it further

The four levels are the CAPS rubric levels (Coding and Robotics CAPS, Grades 4 to 6, page 176; Grades 7 to 9, page 163). The short descriptions are ours.

This lesson is not a formal task, but it is good practice for the term's practical task in Grades 4 to 6 (Coding and Robotics CAPS, Grades 4 to 6, page 170), and for the mini-PATs in Grades 7 to 9 (Coding and Robotics CAPS, Grades 7 to 9, page 157).

Common mistakes and fixes

  • Problem: The reading keeps going up while it is plugged in.Fix: The computer and the busy chip warm it. Run it on batteries and wait two minutes before reading.
  • Problem: It shows the number but not the C.Fix: Check the show string block is inside forever, under show number.
  • Problem: The numbers scroll too fast to read.Fix: Make the pause longer, for example 2000.

Where it sits in CAPS

  • Coding and RoboticsAlignedGrade 6, Term 3: read the built-in temperature sensor and show the temperature (the CAPS temperature display).Source: Coding and Robotics CAPS, Grades 4 to 6 (opens in a new tab), Grade 6, Term 3, Robotics, R.5 Design a simple artefact based on a set of design instructions, page 153: Use the built-in temperature sensor and display the current temperature on a LED matrix.
  • MathematicsGrades 5 and 6 Mathematics: measuring, recording and comparing temperatures, and working out differences.Source: CAPS Mathematics, Grades 4 to 6 (opens in a new tab), Section 2, topic 4.5 Temperature (Grades 5 and 6): calculating temperature differences limited to positive whole numbers
  • Natural Sciences and TechnologyFits Natural Sciences and Technology (Natural Sciences in Grade 7): measuring temperature carefully and recording it in a table.

Coding and Robotics quotes come from the Department of Basic Education's final CAPS, with the page number of the 2024 printed edition (the Department's October 2025 library copies number their pages differently). Schools may teach a topic in another term: the CAPS leaves the order to each school's annual teaching plan.

Ready to teach it?

Get a micro:bit for every learner or pair, and let us train your staff to run lessons like this one.

More lessons

All lessons →
  • Grades 5 to 7

    Grades 5 to 745 to 60 minLevel: Some experience

    Night light

    The micro:bit measures the light in the room and switches its own lights on when it gets dark.

    Subjects: Coding and Robotics · Natural Sciences and Technology · Natural Sciences

    Code with: MakeCodePurple MashPython

  • Grades 4 to 7

    Grades 4 to 745 to 60 minLevel: Getting started

    Step counter

    Every step adds one: learners use a variable to count steps, show the total and reset it, then test how accurate it is.

    Subjects: Coding and Robotics · Mathematics · Life Skills · Life Orientation

    Code with: MakeCodePurple MashPython

  • Grades 4 to 7

    Grades 4 to 745 to 60 minLevel: Some experience

    Music maker

    Buttons play notes, A and B together play a scale and a shake starts a tune: a pocket instrument learners compose for.

    Subjects: Creative Arts · Coding and Robotics

    Code with: MakeCodePurple MashPython

micro:bit is a trade mark of the Micro:bit Educational Foundation, and BBC is a trade mark of the British Broadcasting Corporation. Maze Education is an independent reseller of genuine BBC micro:bit products. Our teacher training and our other products and services are our own, and are not endorsed by the Foundation or the BBC.

WhatsApp