Skip to the content
2 layers57.7 × 48.1 mmDoor open alarm, the printed circuit board in 3D

When a change is detected, the system transmits the event data through the local network to cloud services. The cloud then relays the information to a mobile application, alerting the property owner via a notification.

Size
57.7 × 48.1 mm
Copper layers
2
Thickness
1.6 mm
Parts
59
Nets
64
Pads
209
Tracks, vias
486, 67
Pours
1
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
3 May 2024
Updated
1 Jan 2026

Overview

Door open alarm is an open-source printed circuit board by dani9875, from the dani9875/door_alarm_system repository on GitHub, published under the Apache-2.0 licence. It is a 2-layer board of 57.7 × 48.1 mm with 59 parts on 64 nets, routed with 486 tracks and 67 vias.

It is built around the ESP32-S3-MINI-1-N8, AP2114HA-3.3TRG1 and CL21A106KOQNNNE, with the STPS140Z, CC0805KRX7R9BB104 and LTST-C190KRKT among its other parts. Its parts include 17 resistors, 8 capacitors, 6 diodes, 3 transistors and 3 switches. It belongs with the ESP32 boards of this library.

Main components

12

README

README.md

Door alarm system

This project is a DIY smart door alarm system designed to enhance property security by providing real-time monitoring and notifications. The system detects whether a door has been opened or closed and instantly reacts to these events.

When a change is detected, the system transmits the event data through the local network to cloud services. The cloud then relays the information to a mobile application, alerting the property owner via a notification. This ensures the owner is promptly informed whenever someone enters or leaves the property.

In case you are interested in making your own instance, please find the HW manufacturing files under the release tab.

How to build, flash and monitor the output the firmware

  1. Check out the repository

  2. Navigate to the door_alarm_fw directory:

    bash
    cd door_alarm_fw
  3. (Once) Build the Docker image by executing the following script if you have not done yet:

    bash
    ./docker_build.sh
  4. After the Docker image is successfully built, start the container using:

    bash
    ./docker_start.sh
  5. Configure the followings in main.c manually before build:

    c
    #define EXAMPLE_ESP_WIFI_SSID      "AP"
    #define EXAMPLE_ESP_WIFI_PASS      "password"
    
    #define EXAMPLE_STATIC_IP_ADDR        "192.168.0.100"
    #define EXAMPLE_STATIC_GW_ADDR        "192.168.0.1"
    #define EXAMPLE_STATIC_NETMASK_ADDR   "255.255.255.0"
    
    #define HOST "us-east-1-1.aws.cloud2.influxdata.com"
    #define PATH "/api/v2/write?orgID=[org_id]&bucket=[bucket_name]&precision=ns"
    #define TOKEN "Token [INFLUX_DB TOKEN]"
  6. Inside the container, build the firmware by running:

    bash
    ./build_firmware.sh
  7. To program the firmware onto the device, use:

    bash
    ./burn_firmware.sh
  8. If you wish to observe the firmware's output, execute the monitoring script:

    bash
    ./monitor_firmware.sh

Release notes

Version: v3.0

Changelog:

  • Voltage divider resistor change
  • Component library update

Version: v2.0

Changelog:

  • Component library organised
  • Fuse introduced
  • IP4283CZ10-TBR,115 ESD diodes

Version: v1.0

Changelog:

  • USB capability (does not work)
  • USB active LED (erroneously glows even when operating from battery)
  • Debug programming header
  • Reed switch gate
  • Debug LED
  • Voltage sense

Technical solutions

The heart of the device is the reed sensor, which operates in normally open mode (the circuit remains open when the magnet and the reed sensor are aligned). This design choice minimizes power consumption, as no current is drawn when the door is closed. The system remains in deep sleep mode most of the time and can only be interrupted by an interaction, such as opening or closing the door. When the system wakes up, it checks the battery charge level and the door status, then initializes the WiFi connection to transmit this data to the cloud.

A time-series data platform, Influx, is used to collect the data, and the data is forwarded to Grafana for visualization. You can find the grafana_door_alarm_system.json file in the docs, which you can import to create a dashboard for monitoring the door status and battery level. Make sure to set the source ID (UID) to ensure proper functionality.

If you would like to receive notifications about state changes, I recommend visiting IFTTT. You can trigger events and subscribe to them. The ideal solution is to create a webhook that can be triggered from the ESP32 when it wakes up. However, this is a PRO feature. If you want to stay within the free tier, you can create a Google Sheet, set it as a trigger, and add a row (GDrive API is enabled). When a row is added, the subscriber can receive a WhatsApp message (note that with the free plan, the message may be delayed up to 1 hour).

V2

After the component placement, I realized that the voltage measurement enable pin pad came off, so I rewired it to the LED enable pin. As a result, every time I measure the battery level, the LED briefly lights up. I also didn't have a fuse in my inventory, so I bypassed it with a direct connection. Since USB communication was functioning properly, I decided not to add the H1 straight header pins.

How to check if the USB interface is working properly:

Run lsusb and look for a device called Espressif USB JTAG/serial debug unit

bash
root@c7cc3ff0b21c:/project# lsusb
Bus 004 Device 001: ID 1d6b:0003  
Bus 003 Device 003: ID 046d:c52b Logitech USB Receiver
Bus 003 Device 002: ID 13d3:54b1 Azurewave Integrated Camera
Bus 003 Device 021: ID 303a:1001 Espressif USB JTAG/serial debug unit
Bus 003 Device 004: ID 0bda:c123 Realtek Bluetooth Radio
Bus 003 Device 001: ID 1d6b:0002  
Bus 002 Device 001: ID 1d6b:0003  
Bus 001 Device 001: ID 1d6b:0002 

A short code snippet (main.c, app_main()) that allows you to check if the general LED blinks:

c
const uint8_t led_en = GPIO_NUM_14;

void app_main(void)
{
    gpio_reset_pin(led_en);
    gpio_set_direction(led_en, GPIO_MODE_OUTPUT);

    while(1)
    {
        gpio_set_level(led_en, 1);
        vTaskDelay(pdMS_TO_TICKS(1000));
        gpio_set_level(led_en, 0);
        vTaskDelay(pdMS_TO_TICKS(1000));
    }   

    return;
}

In a short test, I approached the reed sensor with the magnet, which triggered a wake-up event (the LED lights up). While I held the magnet in place, nothing further happened, and the device went back to sleep. As soon as I removed the magnet, the LED flashed again, indicating that the system had woken up, similar to how it would behave if the door were opened.

Although I did not have a proper casing the setup was mounted above the entrance to collect data and analyze power consumption. Data was being monitored in Grafana.


V1

The first version was revised because the USB interface did not work at all, and it wasn’t even impedance-controlled. As a result, it had to be programmed via the UART interface using a USB-to-TTL adapter.

Consumption calculations

Power usage estimates assume the application wakes up 6 times a day (3 times for door opening and 3 times for door closing), and the system is powered by 4 AA batteries with average capacity.

ComponentCurrent (µA)Time (s)Energy Contribution (µA·s)Comment
AP2114HA-3.3TRG1608640060*86400 = 5184000LDO operates at all times.
ESP32 awake doing its job30000060300000*60 = 18000000Wake-up duration is approximately 10 seconds.
Battery measurement24060240*60 = 14400V_SENSE divider: ~ (6 V / 25000 Ω) = 240 µA, active only during wake-up periods.
Reed switch closed (door open)33045330*45 = 14850The door is left open for a maximum of 15 seconds, and this state occurs during half of all activities.
ESP32 deep sleep mode8863408*86340 = 690720ESP32 consumes minimal power during deep sleep.
Total Energy Contribution (µA·s):

$$ 5184000 + 18000000 + 14400 + 14850 + 690720 = 23903970 \ \text{µAs} $$

Average Current per day (µA):

$$ \text{Average Current} = \frac{23903970}{86400} \approx 276 \ \text{µA} $$

Assumptions: 4 AA batteries in series: Each AA battery provides 1.5V, and the combined voltage will be 6V. Capacity of AA batteries: We'll assume 2000 mAh for typical alkaline AA batteries. Average current consumption: 276 µA (0.276 mA).

Battery life in hours can be calculated by dividing the total battery capacity by the current draw:

$$ \text{Battery Life (hours)} = \frac{\text{Battery Capacity (mAh)}}{\text{Current Consumption (mA)}} $$

For 2000 mAh batteries and 0.276 mA current:

$$ \text{Battery Life (hours)} = \frac{2000}{0.276} \approx 7246 , \text{hours} $$

Convert this to days:

$$ \text{Battery Life (days)} = \frac{7246}{24} \approx 302 , \text{days} $$

Calculation here is not final since batteries are not drained to 0 V. Will be added after some testing. LDO shall be fed at least from 4V.

Limitations/what could be improved

  • HW routing is not ideal
  • Local wifi credentials and static IP as well as INFLUX_DB credentials must be compiled into the project and must be set from source code
  • Consumptions increase when the door is open (around 400-500 uA)
  • HW and FW project is tightly-coupled making versioning obscure
  • Voltage divider resistors are mixed up
  • Creation of a elegant enclosure is lacked
  • Some FW clean-up

Parts

59
QtyValueFootprintReferences
80805W8F1002T5Epepy_sym_lib:[RES_SMD_0805_2012Metric]R1, R2, R5, R7, R9, R10, R12, R15
30805W8F5101T5Epepy_sym_lib:[RES_SMD_0805_2012Metric]R3, R4, R14
3C0805C105M4VACTUpepy_sym_lib:[CAP_SMD_0805_2012Metric]C4, C5, C6
3CL21A106KOQNNNEpepy_sym_lib:[CAP_SMD_0805_2012Metric]C1, C3, C7
3FiducialFiducial:Fiducial_0.5mm_Mask1mmFID1, FID2, FID3
3STPS140Zpepy_sym_lib:[SCHOTTKY_DIODE_40V]STMicroelectronics STPS140ZD1, D2, D4
20805W8F4700T5Epepy_sym_lib:[RES_SMD_0805_2012Metric]R16, R17
2CC0805KRX7R9BB104pepy_sym_lib:[CAP_SMD_0805_2012Metric]C2, C8
2CJ2301 S1pepy_sym_lib:[PMOS]Jiangsu Changjing Electronics Technology Co., Ltd. CJ2301 S1Q2, Q3
2GNDpepy_sym_lib:[TEST_POINT]TestPoint_Pad_D1.0mmTP4, TP6
2LTST-C190KRKTpepy_sym_lib:[LED]Lite-On LTST-C190KRKTD5, D6
2TS-1088-AR02016pepy_sym_lib:[TACTILE_SWITCH]XUNPU TS-1088-AR02016S2, S3
2~pepy_sym_lib:[MOUNTING_HOLE]MountingHole_2.2mm_M2_DIN965_PadMH1, MH2
10466.200NRHFpepy_sym_lib:[FUSE_SMD_1206]F1
10805W8F1001T5Epepy_sym_lib:[RES_SMD_0805_2012Metric]R8
10805W8F1003T5Epepy_sym_lib:[RES_SMD_0805_2012Metric]R11
10805W8F1004T5Epepy_sym_lib:[RES_SMD_0805_2012Metric]R6
10805W8J0203T5Epepy_sym_lib:[RES_SMD_0805_2012Metric]R13
13.3Vpepy_sym_lib:[TEST_POINT]TestPoint_Pad_D1.0mmTP5
1AP2114HA-3.3TRG1pepy_sym_lib:[LDO]Diodes Incorporated AP2114HA-3.3TRG1U1
1BOOT0pepy_sym_lib:[TEST_POINT]TestPoint_Pad_D1.0mmTP11
1BSS138PW,115pepy_sym_lib:[NMOS]Nexperia BSS138PW,115Q1
1DLW21SN900SQ2Lpepy_sym_lib:[COMMON_MODE_FILTER]Murata Electronics DLW21SN900SQ2LL1
1ENpepy_sym_lib:[TEST_POINT]TestPoint_Pad_D1.0mmTP8
1ESP32-S3-MINI-1pepy_sym_lib:[MCU]Espressif Systems ESP32-S3-MINI-1-N8U2
1ESP_RESETpepy_sym_lib:[TEST_POINT]TestPoint_Pad_D1.0mmTP7
1GNDpepy_sym_lib:[TEST_POINT]TestPoint_Pad_2.0x2.0mmTP3
1IP4283CZ10-TBR,115pepy_sym_lib:[ESD_PROT]Nexperia IP4283CZ10-TBR,115D3
1PZ254V-11-06Ppepy_sym_lib:[6P_HEADER_STR]XFCN PZ254V-11-06PH1
1REEDpepy_sym_lib:[TEST_POINT]TestPoint_Pad_D1.0mmTP9
1SS-12D10L5pepy_sym_lib:[SLIDE_SWITCH]XKB Connection SS-12D10L5S1
1TYPE-C 16PIN 2MD(073)pepy_sym_lib:[USB_C_16P_RA_FEMALE]SHOU HAN TYPE-C 16PIN 2MD(073)J1
1VBUSpepy_sym_lib:[TEST_POINT]TestPoint_Pad_D1.0mmTP1
1VCCpepy_sym_lib:[TEST_POINT]TestPoint_Pad_2.0x2.0mmTP2
1V_SENSEpepy_sym_lib:[TEST_POINT]TestPoint_Pad_D1.0mmTP10

Similar boards

  • 2 layers168.5 × 29.6 mmBms csc, the printed circuit board in 3D

    Bms csc

    olin-electric-motorsports/olin-electric-motorsports

    OEM Monorepo

    193 parts14
  • 4 layers83 × 67.5 mmMarineBoard, the printed circuit board in 3D

    MarineBoard

    Cadburies/SisuAssistant

    Sailing yacht Sisu: Home Assistant + ESPHome Marine Board (alternator regulation, tanks) + MQTT kernel, Signal K/Grafana/InfluxDB on a NAS, and Sisu Nav chart & weather-routing cockpit.

    162 parts1Apache-2.0
  • 2 layers69.7 × 40 mm5v to bipolar15v PSU, the printed circuit board in 3D

    5v to bipolar15v PSU

    tommassey/5v_to_bipolar15v_PSU

    Small SMPS to provide ~200mA of +15v/-15v from a single 5v-12v DC supply

    59 parts2
  • 4 layers243.8 × 171.5 mmNeotron Pico, the printed circuit board in 3D

    Neotron Pico

    Neotron-Compute/Neotron-Pico

    A Neotron powered by the Raspberry Pi Pico

    242 parts250
  • 4 layers243.8 × 245.5 mmNeotron Common Hardware, the printed circuit board in 3D

    Neotron Common Hardware

    Neotron-Compute/Neotron-Common-Hardware

    Contains KiCad footprints and symbols shared across multiple Neotron projects.

    287 parts4CC-BY-SA-4.0
  • 2 layers100 × 100 mmLorenz, the printed circuit board in 3D

    Lorenz

    gallicchio/ai_unleashes_chaos

    Lorenz Attractor Circuit by Paul Horowitz in KiCAD

    90 parts1MIT

Questions

How big is the Door open alarm PCB?

It measures 57.7 × 48.1 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Door open alarm use?

59 parts, built around the ESP32-S3-MINI-1-N8, AP2114HA-3.3TRG1, CL21A106KOQNNNE and STPS140Z. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Door open alarm KiCad files?

From the dani9875/door_alarm_system repository on GitHub, at the commit this page was made from: the board is door_alarm_hw/door_open_alarm.kicad_pcb and its schematic door_alarm_hw/door_open_alarm.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Door open alarm design in my own project?

Its repository publishes it under the Apache-2.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).