🚨

Door Intruder Alarm

Explorer Β· Ages 7–9

  1. 1Read the conceptLearn the big idea behind this project.
  2. 2Check the partsSee which parts the robot needs.
  3. 3Follow the build stepsBuild it step by step, then test it.
  4. 4Answer the quizTap one answer for each of the 10 questions to earn XP.

πŸ’‘ The concept

A door alarm knows when a door opens. A magnetic reed switch is held closed while the door is shut. When the door opens, the switch releases, the microcontroller notices the change, and the buzzer sounds. Sensing a change and reacting to it is the heart of every alarm system.

Parts you need

  • Buzzer
  • Magnetic reed switch (or button)
  • Microcontroller
  • Battery
  • Jumper wires

πŸ”Ž Parts specification

Exactly what each part is, which models to buy, and what it does.

Microcontrollerβ–Έ

Suggested models: BBC micro:bit V2 or Arduino Uno R3

Features: Needs just 2 pins: one digital input for the switch and one digital output for the buzzer. It checks the switch hundreds of times every second.

Buzzerβ–Έ

Suggested models: Active piezo buzzer (3–5V)

Features: Makes a sound all by itself when you give it power β€” no tunes needed. It has + and βˆ’ legs, so polarity matters. A longer beep pattern makes a better siren.

Switchβ–Έ

Suggested models: Magnetic reed switch MC-38, or a mini push button

Features: A reed switch is two contacts in a sealed tube that touch when a magnet is near. Stick the magnet on the door and the switch on the frame β€” opening the door separates them and the circuit 'sees' it.

Battery / powerβ–Έ

Suggested models: 2Γ—AA pack or 9V with clip

Features: 3V–9V depending on your board. Keep it off while wiring.

πŸ’» Program the microcontroller

πŸ“² App to use: Microsoft MakeCode for micro:bit, or Arduino IDE for Arduino Uno

MakeCode version: forever β†’ if P0 pressed (button released) β†’ play tone high pitch, else β†’ rest.

// Arduino IDE (C++) β€” Door Alarm
const int SWITCH = 2;  // reed switch
const int BUZZ = 8;    // active buzzer

void setup() {
  pinMode(SWITCH, INPUT_PULLUP);
  pinMode(BUZZ, OUTPUT);
}

void loop() {
  if (digitalRead(SWITCH) == HIGH) {
    tone(BUZZ, 1000);   // door open: alarm!
  } else {
    noTone(BUZZ);       // door closed: quiet
  }
}

🧠 How it works: INPUT_PULLUP makes the pin read HIGH when the switch is loose (door open) and LOW when it's held down (door closed by the magnet). The loop checks the switch constantly β€” the moment it goes HIGH, tone() beeps the buzzer at 1000 Hz. Turn the beep on and off in a pattern to make a wee-woo siren.

πŸ› οΈ Build it step by step

Press Play to watch every part go into place and every wire connect. Ask a grown-up to help with real wiring!

+ βˆ’BatteryMicrocontroller

Step 1 of 6

πŸ”‹ Power the board

Connect the battery to the microcontroller. Battery OFF until everything is wired and checked.

🧠 Project quiz

Question 1/10⭐ 0

What does the reed switch do while the door is closed?