Teachwire Logo
NFER - Tests for Years 1-6
NFER - Tests for Years 1-6
News

Enhance Pupils’ Problem-Solving Skills by Coding Sensors to Control Devices

Bring coding to life in the classroom with this range of activities that use sensors in a real-world setting, says Andy Wicks...

  • Enhance Pupils’ Problem-Solving Skills by Coding Sensors to Control Devices

The primary computing curriculum offers a wonderful opportunity for a wide range of lessons. However, its openness can be bewildering for teachers who might not know where to start.

This series of activities is designed to add real-world elements and practical problem solving to your computing and STEM lessons.

The activities use BBC micro:bit with DFRobot’s Boson Starter Kit. However, these could be substituted with other scaleable non-coding resources.

While the Micro:bit is predominantly aimed at Y7 students, this kit allows early integration to Y5 and Y6 classrooms to help build a deeper understanding of coding from an earlier age.

By following this plan, the children can learn block coding, adding input and output devices and how to program them, controlling devices using sensors and coding in a real-world setting, as well as collaborative problem solving.

This step-by-step guide, which assumes a basic knowledge of micro:bit (you can find a guide at microbit.org/guide/quick), can be split into separate lessons depending on the level of experience in the class.

Cross-curricular links can also be introduced, such as D&T and literacy, by incorporating a design element to the fan (with additional resources like LEGO and cardboard) and including instructions on how to build them.

Alternatively, different peripheral modules could be used instead of the fan to link with a different topic. For example, you could use LED lights to communicate Morse code messages.

Lesson 1

Introduction to the micro:bit: write a message

Working in pairs, set the students up with a micro:bit, Boson Starter Kit, laptop, and internet access.

First, familiarise the students with micro:bit – ask them to examine it, describe it, and talk about how they think micro:bit works.

An easy way to start is to create something on the LED array. Start by clicking the ‘Basic’ tab, and then drag the block called ‘Show Icon’ into the ‘Forever’ loop. Ask the students what they notice about the micro:bit’s LED array and what they think will happen to the display if the icon is changed.

Now download your file and drag it to your micro:bit, which should now show the same icon on its display.

Show the ‘Basic’ blocks again and give the class the task of choosing their own display to show numbers, words, icons, or their own design. Allow the class time to experiment and share their results.

Lesson 2

Cooling down: using a button to control a fan

Introduce the Boson Starter Kit by allowing the children to examine the modules and ask how they can connect these to the micro:bit.

Explain that the button and fan modules will be used to program the micro:bit and control the fan. In this model, the button is the input device and the fan is the output device.

Showing a flowchart is a valuable way of explaining how this works.

Next, connect the button to P0 and the fan to P1. Use the Logic and Pins to create this program and download it. This can be a little confusing the first time, so it’s worthwhile experimenting before the lesson.

Remember to give the program a sensible name so it can be found later. Download it to the micro:bit and show the class how the button turns the fan on and off. Leave the program onscreen and encourage the students to recreate it.

Lesson 3

Automatic fan: switching on and off

This is an extension to the second lesson, building upon the coding and adding a sensor to turn the fan on and off automatically.

Start by providing the class with context by discussing where automatic devices are used – for example, automatic shop doors, light sensors, and alarms.

Then remind the class that they used a button to control the fan in the last lesson and they are now going to use a movement sensor to make it an automatic fan.

Again, a flowchart is a great way to reinforce this.

Ask the class to discuss what they need to do to the devices before they start programming. Do they need to change the program and how will they check that it works?

The coding elements should be the same as the previous lesson, so the students should have their fan up and running quickly.

Some pupils may need to recreate the coding sequence from the beginning, which is a great way of deepening the learning through repetition.

Other pairs will notice that they can load their previous program from the last lesson, which is a great demonstration that they can find different ways to solve the same problem.

Taking it further

Ask the children to experiment using other output devices such as LED bulbs and input devices like sound sensors.

Make sure the class documents their work using cameras, tablets, or other devices. These could then be reproduced online using blogs or web pages.

Reinforce knowledge by distributing blank flowcharts and asking the class to depict their programs in this format.


Andy Wicks is a computing teacher at Nightingale Primary School and computing champion across Maritime Academy Trust. Find out more at maritimeacademytrust.org and on Twitter at @maritimeMAT.

Sign up here for your free Brilliant Teacher Box Set

Want fresh ideas on teaching grammar, punctuation and spelling?

Find out more here >