What is physical computing?
Physical computing means building systems where a program senses the real world and acts on it. It uses small boards called microcontrollers (for example micro:bit, Arduino or Raspberry Pi Pico). A microcontroller has a processor, a little memory and input/output pins on one chip.
Every system follows input → process → output, running inside a loop that repeats many times a second.
Sensors and actuators
- Sensors (inputs): button, light sensor (LDR), temperature sensor, ultrasonic distance sensor, accelerometer, soil-moisture sensor, microphone.
- Actuators (outputs): LED, buzzer, servo or DC motor, relay (switches a big device), display, speaker.
Digital and analog signals
A digital input has only two values: 0 or 1 (button up or down). An analog input can take many values; the board's analog-to-digital converter turns a voltage into a number, often 0–1023 (10-bit). Outputs can be digital (LED on/off) or use PWM (quick on-off switching) to dim an LED or set motor speed.
Programming the behaviour
A typical program:
forever:
light = read light sensor
if light < 400:
LED on
else:
LED off
wait 100 msKey ideas: variables store readings, conditions compare with a threshold, the loop keeps checking. Real sensors are noisy, so we average readings or use two thresholds (hysteresis) to stop flickering. A feedback loop uses the result of an action as the next input – for example a fan that slows down once the room has cooled.
Design cycle
Define the problem → choose sensors and actuators → draw a circuit and flowchart → build and code → test with real conditions → improve.
Projects, wearables and art
- Smart home: night light, automatic plant watering, door alarm.
- Wearables: step counters, light-up clothes, heart-rate bands; they need small boards, batteries and safe, flexible wiring.
- Interactive art: sculptures that react to sound, movement or touch.
Think about safety (low voltage, no mains wiring), power use (battery life), privacy (what data sensors collect) and accessibility.
Try it
No board? Be the microcontroller: a friend covers and uncovers a torch (sensor), you follow the rule "if it is dark, clap" (process), and your clap is the actuator. Then change the threshold: "only clap if it is very dark".
Key formulas and definitions
- Input → Process → Output, inside a loop
- Sensor: turns a physical quantity into an electrical signal/number
- Actuator: turns an electrical signal into action (light, sound, motion)
- Analog reading (10-bit): 0 to 1023 (2¹⁰ = 1024 values)
- Digital: 0 / 1 (LOW / HIGH); PWM sets average power
- Threshold rule: if reading < threshold then act
Worked examples
1. Name the input, process and output of an automatic night light.
Input: light sensor reading. Process: if the reading is below a threshold, switch on. Output: LED or lamp.
2. A 10-bit sensor reads 512. About what fraction of full scale is that?
512 / 1023 ≈ 0.5, so about half of the maximum.
3. Light readings near dusk jump between 395 and 405, so the lamp flickers with threshold 400. Fix it.
Use two thresholds: turn on below 380, turn off above 420 (hysteresis), or average several readings first.
4. Design a plant waterer.
Input: soil-moisture sensor. Process: if moisture < 30% then pump on for 3 s, then wait. Output: water pump through a relay. Loop and test.
5. An LED is driven by PWM at 25% duty cycle. How bright does it look compared with full on?
It is on only a quarter of the time, so it looks about one quarter as bright.
Common mistakes
- Mixing up sensors and actuators – a motor is an output, a button is an input.
- Forgetting the loop, so the program reads the sensor only once.
- Using a single sharp threshold on a noisy sensor, which causes flickering.
- Powering motors straight from a data pin instead of a driver or relay.