Skip to content

Activity

Pressure switch alarm

Advanced | MakeCode, Python | LED display, Pins, Radio, Sound | Electricity, Electronics, Input/output, Radio waves, Selection, Sensors

Step 1: Make it

What is it?

Create a wireless intruder alarm that will warn you when someone steps on a home-made pressure sensor.

Sensor micro:bit with pin 0 connected to one foil pad, GND pin connected to another. A flap of cardboard with foil folds over and connects the two other foil pads when someone treads on it.

How it works

  • Flash the sensor program onto a micro:bit.
  • Make a pressure input switch out of cardboard and tin foil like in the picture. Fold it over and place it under a rug or carpet. You may need to add some foam to keep each side apart. Connect the two foil pads on one side to pins 0 and GND on the sensor micro:bit. When you step on it, the foil on the top completes an electrical circuit, and it sends an ‘intruder’ radio message.
  • Flash the alarm program on to the other micro:bit (the alarm) and attach a buzzer or speaker to pin 0 and GND if you have one. When it receives the ‘intruder’ message it shows an angry face on the LED display and plays an audible alarm sound. Press button A to clear the display.

What you need

  • 2 micro:bits and at least 1 battery pack
  • 2 crocodile clip leads
  • tin foil, scrap cardboard, glue, scissors, foam
  • optional buzzer, amplified speaker or headphones and 2 crocodile clip leads

Step 2: Code it

Sensor / transmitter:

Alarm / receiver:

Step 3: Improve it

  • Add multiple sensors each sending its own message, e.g. ‘room1’, ‘room2’ and have the alarm show where the intruder is.
  • Try different designs for the pressure switch or use
  • You could make a rain alarm using two tin foil pads very close together – if they get wet, they will trigger the alarm. Be sure not to get your micro:bit wet though!