diff --git a/README.md b/README.md new file mode 100644 index 0000000..e13f745 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# door-alarm + +This is a simple, home-made door alarm based on ultrasound sensor distance measurements + +The peripheral device is powered by a Raspberry Pi Pico W, with the following diagram + +![door alarm peripheral device circuit diagram](circuit.svg "Circuit Diagram") diff --git a/circuit.cddx b/circuit.cddx new file mode 100644 index 0000000..7c19f43 Binary files /dev/null and b/circuit.cddx differ diff --git a/circuit.svg b/circuit.svg new file mode 100644 index 0000000..6d32397 --- /dev/null +++ b/circuit.svg @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 230 Ω + + + + + + + + + + + + + + + + + + + VCC + TRIG + ECHO + GND + Raspberry Pi Pico + + + GP0 + + VBUS + + GP1 + + VSYS + + GND + + GND + + GP2 + + 3V3_EN + + GP3 + + 3V3_OUT + + GP4 + + ADC_VREF + + GP5 + + GP28 + + GND + + GND + + GP6 + + GP27 + + GP7 + + GP26 + + GP8 + + RUN + + GP9 + + GP22 + + GND + + GND + + GP10 + + GP21 + + GP11 + + GP20 + + GP12 + + GP19 + + GP13 + + GP18 + + GND + + GND + + GP14 + + GP17 + + GP15 + + GP16 + + + \ No newline at end of file diff --git a/peripheral/main.py b/peripheral/main.py index 3a73406..3c32ba9 100644 --- a/peripheral/main.py +++ b/peripheral/main.py @@ -76,7 +76,7 @@ def connect(): def send_req(opened: bool): print("Updating state...", end="\r") - + data = {"opened": opened} raw = ujson.dumps(data) r = requests.post(f"{server}/write", diff --git a/server/main.go b/server/main.go index 41adc80..9ac3330 100644 --- a/server/main.go +++ b/server/main.go @@ -216,7 +216,7 @@ func sendAlert(action string) { to := fmt.Sprintf("%s/message?token=%s", gotifyURL, gotifyToken) what := echo.Map{ "title": fmt.Sprintf("Your door has been %s", action), - "priority": 1, + "priority": 5, "message": fmt.Sprintf("Your locked door has been %s at %s", action, time.Now().Format(TimeFormat)), } b, err := json.Marshal(&what)