Skip main navigation

New offer! Get 30% off your first 2 months of Unlimited Monthly. Start your subscription for just £35.99 £24.99. New subscribers only T&Cs apply

Find out more

Software to tie it all together

What is software, examples of software for the different boards mentioned earlier. An opportunity to see different types of software at work.

Software is a collection of computer instructions that tell the computer how to work. In physical computing you can create or use software to tell your system what to do.

In a physical computing system, sensors gather the input, and actuators respond to the output. Somewhere in between, there is software that is controlling both and making decisions about the data.

Many physical computing systems seem automated. Think of an automatic door. A sensor detects movement in front of the door, and the door opens. We might forget that in between is software that is controlling both the sensor and the door. This software could change the sensitivity of the sensor, for example, it could ignore or turn off the sensor during closing hours, acting as a lock. The software controls how fast the door opens, how long the door stays open for. When the sensor is detecting lots of movement it can keep the door open rather than opening and closing it.

The software can add intelligence to the system. It can also add bias, which we talk about in our next step on the implications of physical computing.

Software can be very simple: a few lines of code in a programming language that accesses the sensor, does a simple calculation and controls an output. Software can be expandable. There are software libraries that allow us to add different sensors to gather data, add motors to control or access data from other systems. These libraries deal with the complication of the external device and give us access to it through our code.

Let’s have a look at the different types of software on the different computers/microcontrollers used in physical computing.

BBC micro:bit

The BBC micro:bit was created as an educational device. Out of the box it does have some software on it but it’s up to you, the creator, to code the software onto the micro:bit to make it do what you want. This is the case with many physical computing devices. They are blank slates waiting for your instructions. The software has to be adaptable because the physical computing setup can be different from project to project.

The micro:bit was created to be programmed with a range of different software languages. Microsoft MakeCode is one example. It allows you to create your software for the micro:bit online through their website using blocks. Here’s a simple example:

Example of MakecodeExample of MakeCode
(Click to expand)

And here’s a physical computing example, this time for a temperature dial:

Temperature dial exampleTemperature dial example
(Click to expand)

The program uses sensors, processing and output – a great example of a physical computing project.

This program uses a sensor (input) to get the temperature of the room where the micro:bit is every second. It multiplies it by 7 (processing) to scale the temperature to an angle. Then it moves a motor (output) depending on that new angle number. You can see an example of the motor working in a different project in the video in the See Also section below.

When you have finished coding your software, you download the code to the micro:bit. You don’t need to install the MakeCode software on your computer. This makes it more accessible to a broad range of users, especially schools who might not have full access to their machines. It also has a simulator, which lets you develop and test without the need for actual hardware.

MakeCode allows extensions to be added so the micro:bit can be used with other pieces of hardware, like light strips or motors.

Raspberry Pi

The Raspberry Pi is a full computer. You install an operating system onto its memory card and run software on it. You can code the Raspberry Pi in many other programming languages like C or Java, but the most widely used is python.

In this example, we have created a simple program using python to display “Hello World” to the screen on the Raspberry Pi, pause for a second, then print “Goodbye World”. This software is written directly onto the pi.

Using python it’s possible to access anything that is connected to the Raspberry Pi: sensors and actuators.

On the first line, the code imported a library called time to pause the program. Like the extensions in MakeCode, Python can import other people’s code to adapt the Raspberry Pi for different uses and access hardware libraries.

Image of Python coding Raspberry PiCoding a Raspberry Pi with Python
(Click to expand)

Here is the code from Lorraine’s stairlights example you saw in Step 1.7:

Stairlights codeStairlights code
(Click to expand)


Arduino pre-dates the micro:bit and the Raspberry Pi. It was one of the first accessible and affordable single board computers that could be used for physical computing. Arduino has less of a structure than both micro:bit and Raspberry Pi: there is no operating system or web interface. You need to install software on a computer to write the software to control an Arduino. The software you write is only in the C programming language.

The software comes with many example pieces of software code. Here’s an example that flashes a light on the Arduino.

C programming for ArduinoExample of C programming for an Arduino
(Click to expand)

Here’s a physical computing example program using two buttons and a buzzer to create an exercise timer on an Arduino:

Exercise timerExercise timer
(Click to expand)

Try it for yourself

Go to the micro:bit MakeCode online editor and try creating your own program.
If you are new to the code, you could use the tutorial videos, or look at the live coding examples to see how examples such as the temperature measure and programmable LEDs are built.
When you’ve finished, share your thoughts and reflections on the software with others in the Comments.
  • Were there any areas that you found challenging?
  • What other physical computing solutions could this code be added to?
This article is from the free online

Introduction to Physical Computing

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now