Skip to the content
PCBKitNew board
2 layers46 × 66 mmDoor sensor schaltplan, the printed circuit board in 3D

Door sensor schaltplan

Brawn1/ATTiny-Door-Sensor

Door Sensor Battery based with Attiny84 and HC-12 Sender

Size
46 × 66 mm
Copper layers
2
Thickness
1.6 mm
Parts
19
Nets
22
Pads
57
Tracks, vias
95, 1
Routed
Yes
KiCad
KiCad 8.0 (file 20240108)
Created
24 Aug 2026
Updated
24 Aug 2026

Overview

Door sensor schaltplan is an open-source printed circuit board by Brawn1, from the Brawn1/ATTiny-Door-Sensor repository on GitHub. It is a 2-layer board of 46 × 66 mm with 19 parts on 22 nets, routed with 95 tracks and 1 via.

It is built around the ATTINY84A-PU. Its parts include 4 resistors, 3 connectors, 2 capacitors, 1 IC and 1 diode. It belongs with the sensors and measurement boards and the AVR (ATmega, ATtiny) boards of this library.

Main components

1

README

README.md

Door Sensor - Wireless Freezer Door Monitor

Batteriebetriebener Funksensor zur Überwachung einer Gefrierschranktür mit Alarm-Eskalation und Home Assistant Integration.

Systemübersicht

text
ATtiny84A + HC-12 Sender  ~~~433MHz~~~>  HC-12 + Raspberry Pi  -->  MQTT  -->  Home Assistant
     (Sensor)                                  (Empfänger)
  • Sender: ATtiny84A misst Türkontakt und Batteriespannung, sendet bei Ereignissen per HC-12 Funkmodul
  • Empfänger: Raspberry Pi empfängt per Serial (HC-12), parst die Pakete und publiziert per MQTT
  • Anzeige: Home Assistant zeigt Status, Batterie, Alarme und Öffnungsdauer an

Features

  • Ultra-Low-Power: Deep-Sleep zwischen Ereignissen (Watchdog-Wakeup)
  • HC-12 Funkmodul: bis zu 1km Reichweite, 433MHz
  • Alarm-Eskalation: Warnung nach 45s, kritischer Alarm nach 90s mit Piezo-Buzzer
  • Batterie-Überwachung: 3x AAA, Messung über interne Bandgap-Referenz
  • Prüfsumme: XOR-Checksum für Datenintegrität
  • Home Assistant: MQTT-Integration mit Binary Sensors und Sensors

Hardware

Sender (ATtiny84A)

KomponentePinFunktion
Türkontakt (Reed)PA3INPUT_PULLUP
HC-12 TXPA1Bit-Banged UART 9600 Baud
HC-12 RXPA2(nicht verwendet)
HC-12 VCCPA4Stromversorgung über NPN (2N2222 + 1kΩ)
Piezo-BuzzerPA5Alarm-/Warntöne
Status-LEDPB0Statusanzeige

Stromversorgung: 3x AAA Batterien (4.5V frisch, ~3.0V leer)

Empfänger (Raspberry Pi)

HC-12 PinRaspberry Pi
VCC5V
GNDGND
TXGPIO15 (RXD)
SETnicht verbunden

Test-Empfänger (Arduino UNO)

HC-12 PinArduino UNO
VCC5V
GNDGND
TXPin 8 (SoftwareSerial RX)
RXPin 9 (SoftwareSerial TX)

Protokoll

Paketformat

text
[0xAA] [0x55] [LEN] [DATA...] [XOR-Checksum]
  Sync1  Sync2  Länge  Nutzdaten  Prüfsumme

Message Struct (30 Bytes, Little-Endian)

FeldTypBytesBeschreibung
typechar[16]16Nachrichtentyp als String
msg_typeuint8_t1Typ-Code (0x01-0x05)
device_iduint16_t2Geräte-ID (Standard: 10)
sequenceuint16_t2Nachrichtenzähler
status_flagsuint8_t1Bit-Flags (s.u.)
valuefloat4Wert (kontextabhängig)
battery_mvuint16_t2Batteriespannung in mV
door_open_secondsuint16_t2Öffnungsdauer in Sekunden

Nachrichtentypen

CodeNameAuslöserValue-Inhalt
0x01STARTUPEinschaltenProtokollversion
0x02CONTACTTür öffnen/schließen1.0 (offen) / 0.0 (zu)
0x03VOLTAGEAlle 5 MinutenBatteriespannung in V
0x04ALARMTür >90s offenSekunden seit Öffnung
0x05HEARTBEATTestmodus (20s)Uptime in Sekunden

Status-Flags

BitFlagBeschreibung
0x01DOOR_OPENTür ist offen
0x02ALARM_ACTIVEAlarm wurde ausgelöst
0x04LOW_BATTERYBatterie unter 3.6V
0x08ERRORFehler

Software Setup

Sender (ATtiny84A)

Firmware flashen mit Arduino IDE:

  • Board: ATtiny84 (z.B. ATTinyCore)
  • Datei: code/code.ino
  • Keine externen Libraries nötig

Empfänger (Raspberry Pi)

bash
# Abhängigkeiten
pip3 install paho-mqtt pyserial

# Serial aktivieren
sudo raspi-config  # Interface -> Serial -> Login-Shell: NEIN, Hardware: JA

# Testen ohne MQTT
python3 receiver/python/door_sensor_v2.py --no-mqtt --debug

# Mit MQTT
python3 receiver/python/door_sensor_v2.py

# Als Systemd-Service installieren
bash receiver/create_service.sh

Optionen:

text
--debug          Debug-Ausgaben (Hex-Dump, JSON)
--no-mqtt        Nur Konsolenausgabe, kein MQTT
--port PORT      Serial-Port (default: /dev/ttyS0)
--baud RATE      Baudrate (default: 9600)

Test-Empfänger (Arduino UNO)

Zum Testen und Debuggen ohne Raspberry Pi:

  • Datei: test/test.ino
  • Serial Monitor: 115200 Baud
  • Zeigt alle empfangenen Pakete mit Hex-Dump

Home Assistant

YAML-Dateien aus receiver/ in den MQTT-Config-Ordner kopieren:

  • home_assistant_config_binary_sensor.yaml - Tür-Status und Alarm
  • home_assistant_config_sensor.yaml - Batterie, Öffnungsdauer, Sequenz

MQTT-Topics unter bailey/tk/sensors/device_10/:

TopicInhaltRetain
/doorOPEN / CLOSEDja
/alarmON / OFFja
/battery_mvBatterie in mVja
/stateKomplettes JSONja

Projektstruktur

text
door-sensor/
├── code/
│   └── code.ino                          # ATtiny84A Firmware (Sender)
├── test/
│   └── test.ino                          # Arduino UNO Empfänger (Test)
├── receiver/
│   ├── python/
│   │   └── door_sensor_v2.py             # Python MQTT-Bridge (Raspberry Pi)
│   ├── create_service.sh                 # Systemd-Service Installer
│   ├── home_assistant_config.yaml        # HA Config (kombiniert)
│   ├── home_assistant_config_sensor.yaml # HA Sensoren
│   └── home_assistant_config_binary_sensor.yaml  # HA Binary Sensoren
├── kicad/
│   ├── door-sensor-schaltplan/           # KiCad Schaltplan + PCB
│   └── Fertigung/                        # Gerber-Dateien für Platinenfertigung
├── HC-12_Datasheet.pdf
├── attiny_pinout.jpeg
└── README.md

Schaltplan & PCB

KiCad-Projekt unter kicad/door-sensor-schaltplan/. Fertigungsdaten (Gerber) unter kicad/Fertigung/.

Lizenz

Privates Projekt.

Parts

19
QtyValueFootprintReferences
4Jumper_2_OpenJumper:SolderJumper-2_P1.3mm_Open_RoundedPad1.0x1.5mmJP1, JP2, JP5, JP6
210kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR1, R2
1100nFCapacitor_THT:C_Axial_L3.8mm_D2.6mm_P7.50mm_HorizontalC3
110µFCapacitor_THT:CP_Radial_D4.0mm_P1.50mmC1
11kResistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR4
1220Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_HorizontalR3
12N2222Package_TO_SOT_THT:TO-92_Inline_WideQ1
14,5V-DCTerminalBlock_CUI:TerminalBlock_CUI_TB007-508-02_1x02_P5.08mm_HorizontalBT1
1ATtiny84A-PPackage_DIP:DIP-14_W7.62mmU1
1BuzzerBuzzer_Beeper:MagneticBuzzer_PUI_AT-0927-TT-6-RBZ1
1IO-AnalogConnector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_VerticalJ2
1IO-DigitalConnector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_VerticalJ3
1SW_DPST_x2TerminalBlock_CUI:TerminalBlock_CUI_TB007-508-02_1x02_P5.08mm_HorizontalSW1
1SenderConnector_PinSocket_2.54mm:PinSocket_1x04_P2.54mm_VerticalJ4
1stateLED_THT:LED_D5.0mmD1

Questions

How big is the Door sensor schaltplan PCB?

It measures 46 × 66 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Door sensor schaltplan use?

19 parts, built around the ATTINY84A-PU. 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 sensor schaltplan KiCad files?

From the Brawn1/ATTiny-Door-Sensor repository on GitHub, at the commit this page was made from: the board is kicad/door-sensor-schaltplan/door-sensor-schaltplan.kicad_pcb and its schematic kicad/door-sensor-schaltplan/door-sensor-schaltplan.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Door sensor schaltplan design in my own project?

Its repository states no licence, so its author keeps all rights: ask Brawn1 before reusing the design.

Similar boards

  • 2 layers96.5 × 25.4 mmLed game, the printed circuit board in 3D

    Led game

    agalakhov/led-game

    Simple LED game for learning soldering.

    20 parts2MIT
  • 2 layers94 × 63.8 mmTinySensorv1, the printed circuit board in 3D

    TinySensorv1

    arcadien/tinySensor

    Firmware and generic board for low-power environment sensors

    45 parts2MIT
  • 2 layers55.2 × 40.6 mmSpectrum, the printed circuit board in 3D

    Spectrum

    jblang/ATtiny84A_spectrum

    ATtiny Spectrum Analyzer

    24 parts2
  • 2 layers35 × 28 mmVolvo240pcb, the printed circuit board in 3D

    Volvo240pcb

    pddenhar/Volvo_240_Info_Display

    OLED dashboard module for the Volvo 240 displaying battery voltage, speed, and RPM.

    18 parts2
  • 2 layers90 × 40 mmPlate, the printed circuit board in 3D

    Plate

    BryceVandegrift/hot-plate

    A DIY PCB hot plate that uses through hole components

    30 parts1CERN-OHL-W-2.0
  • 2 layers92 × 45 mmL6 - P2, the printed circuit board in 3D

    L6 - P2

    AhmedAtefNasr/PCB_Course-IMT_school

    Here's the repo for Assignments & projects of PCB course from IMT school

    49 parts
  • 2 layersBattlecar pcb, the printed circuit board in 3D

    Battlecar pcb

    eirbot/eirbot_league

    Rocket League inspired robots

    26 partsGPL-3.0