Lesson 8

Detecting a burglar

Overview of the project

L8A2R1 - Pressure sensor instructions

Making a pressure sensor

You will need:

Two 15 cm lengths of multi-strand black wire.

Aluminium cooking foil / self adhesive foil ( https://www.bostik.com/UK/products/Idenden-T303-foil-tape)

Wire stripper

Sticky tape

Scissors

Cardboard pressure pad templates (click this link)



Connecting a switch as an input.

Connect a push switch as in input device between pin0 and 3V.

Note that the switch is not connected to GND but to the 3V pin (see below).

An if condition block is used to monitor the state of the switch.

When the switch is closed (e.g. a burglar treads on the pressure switch) the input to pin0 will change from 0 (off) to 1 (on).



Making a pressure switch instructions:

Mark out a piece of card to match the template above (cut out the white hole).

Cut two squares of aluminium foil the same size as each yellow square in the template.

Strip 1 cm of insulation from each end of the 15 cm wires.

Splay the ends of one wire out and tape it to the edge of one piece of aluminium.

Splay the ends of the other wire out and tape it to the edge of the other piece of aluminium.

Place one piece of aluminium foil over the hole in the middle of the card and fold the left hand side of the card over the top of it to keep the foil in place.

Flip the card over and do the same on the other side.

The hole in the centre of the card should now have a piece of foil either side of it.

Tape around the edge of the card ‘sandwich’ to keep the foil in place.

You now have a homemade pressure sensor, the two wires are used to connect it to a micro:bit.

L8ExR1 - Burglar alarm algorithm challenge

Rearrange the 7 instructions below to create an algorithm for the burglar alarm program written in the correct sequence.


---- turn buzzer on

-- if button A and B are pressed

-- if pressure pad is pressed

---- turn buzzer off

---- display text string 'Reset'

forever

---- display burglar detected icon