Projects / Balcony door child safety alarm

Balcony door child safety alarm

Beginner45 minGuided buildReviewed

Build it step by step

0 of 6 done
  1. NANO

    Fit the reed switch

    Put the switch on the door frame and the magnet on the door so they touch when closed.

  2. NANO

    Wire it

    Reed to D2 and GND. Slide switch middle pin to D3 and one side to GND.

  3. NANO

    Add the buzzer

    Passive buzzer between D8 and GND.

  4. NANO

    Power it

    Connect the 4 AA pack to VIN and GND.

  5. NANO

    Test

    Slide child mode on and open the door. The chime plays every 5 s until the door closes.

  6. NANO

    Place it

    Put the box at adult height and tell everyone how the slide switch works.

In short

How do you build a balcony door child safety alarm?

A reed switch on the balcony door chimes the moment it opens while child mode is on, so parents always know. You need Arduino Nano, Door reed switch MC-38, Slide switch SPDT (SS12D00), Passive buzzer, Battery holder 4 × AA with switch, AA alkaline battery × 4 and Jumper wires male to male (40 pcs, 20 cm). It takes 6 steps and about 45 minutes.

Level
Beginner
Time
About 45 min
Parts
7

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Reed switchNano D2 and GNDClosed (LOW) when the door is shut
Slide switch middle pinNano D3Child mode input
Slide switch one outer pinNano GNDChild mode on when slid to this side
Passive buzzer +Nano D8Chime
Passive buzzer -Nano GNDReturn
4 AA packNano VIN and GND (6 V)Battery power

Code

Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones). No libraries. The Nano's USB chip and power LED still draw current in sleep, so battery life improves but is not as long as a bare ATmega328P. Check life by measuring.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <avr/sleep.h>

const byte REED = 2, MODE = 3, BUZZ = 8;

ISR(PCINT2_vect) {}                                 // wakes the Nano when the door or switch changes

void chime() {
  tone(BUZZ, 2400, 150); delay(200);
  tone(BUZZ, 3000, 150); delay(200);
}

void setup() {
  pinMode(REED, INPUT_PULLUP);
  pinMode(MODE, INPUT_PULLUP);
  pinMode(BUZZ, OUTPUT);
  PCICR |= _BV(PCIE2);                              // pin change interrupts on D0 to D7
  PCMSK2 |= _BV(PCINT18) | _BV(PCINT19);            // D2 and D3
}

void loop() {
  bool childMode = digitalRead(MODE) == LOW;
  bool doorOpen = digitalRead(REED) == HIGH;
  if (childMode && doorOpen) {
    chime();
    delay(5000);                                    // repeat every 5 s while open
  } else {
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    noInterrupts();
    sleep_enable();
    interrupts();
    sleep_cpu();                                    // sleeps until the door or switch moves
    sleep_disable();
  }
}

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Child mode off, door openedSilent
Child mode on, door openedChime within a second
Door closed againChime stops
Door closed, mode on for a dayStill awake and working next day

If it does not work

No chime

Check the buzzer is a passive type and the reed polarity. The door open should read HIGH.

Chimes with the door closed

The magnet is too far from the reed switch.

Never sleeps

The pin change interrupt is not set for the right pin or the switch is bouncing.

Batteries die fast

The Nano's board draws current. Use a bare chip for the long-life version.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the balcony door child safety alarm?

Arduino Nano, Door reed switch MC-38, Slide switch SPDT (SS12D00), Passive buzzer, Battery holder 4 × AA with switch, AA alkaline battery × 4 and Jumper wires male to male (40 pcs, 20 cm).

How long does the balcony door child safety alarm take to build?

About 45 minutes for a beginner maker, in 6 steps.

How do I know the balcony door child safety alarm works?

Child mode off, door opened: Silent. Child mode on, door opened: Chime within a second. Door closed again: Chime stops.

No chime: what should I check?

Check the buzzer is a passive type and the reed polarity. The door open should read HIGH.

Chimes with the door closed: what should I check?

The magnet is too far from the reed switch.

Never sleeps: what should I check?

The pin change interrupt is not set for the right pin or the switch is bouncing.

Batteries die fast: what should I check?

The Nano's board draws current. Use a bare chip for the long-life version.