More of everything

main
Filip B P 2 years ago
parent 367191aa5d
commit cb15790ec7

@ -15,6 +15,7 @@ The system must be able to control locks, react to motion sensors, sound an alar
- [display](#display)
- [door-sensor](#door-sensor)
- [motion-sensor](#motion-sensor)
- [controller](#controller)
### Card reader
@ -44,15 +45,102 @@ The source code can be found at https://git.bpfilip.dk/HFJ/alarm-card-reader
### Display
The display module consists
The display module consists of a ESP8266 NodeMCU, a 16x2 character LCD Display, a buzzer, a rotary encoder with an embedded button and a button.
The display subscribes to the `alarm/state` topic on MQTT and by default displays the current state.
When the rotary encoder is pressed you are asked to enter your pin code.
When entered the door is unlocked and the alarm either arms or disarms depending on the previous state.
When the alarm is triggered the buzzer is triggered.
#### Source code
The source code can be found at https://git.bpfilip.dk/HFJ/alarm-card-reader
The source code can be found at https://git.bpfilip.dk/HFJ/alarm-display
#### Hardware connections
| ESP8266 | 16x2 LCD Display | Buzzer | Button | Rotary encoder |
| ------- | ---------------- | ------ | ------ | -------------- |
| 3.3v | 3.3v | V | V | |
| GND | GND | G | G | GND |
| D2 | SDA | | | |
| D1 | SCL | | | |
| D0 | | S | | |
| D3 | | | S | |
| D5 | | | | Button |
| D6 | | | | Rotary #1 |
| D7 | | | | Rotary #2 |
### Door Sensor
The door sensor module consists of a ESP8266 Wemos D1 Mini board, a reed switch (Magnetic switch) and a relay.
The relay emulates a door lock, where when the relay is turned on the door would be locked.
The reed switch should be mounted together with a magnet on the door to detect when the door is opened.
When a card or tag is read on the card reader the door is opened either for 5 seconds or until the door is closed again.
#### Source code
The source code can be found at https://git.bpfilip.dk/HFJ/alarm-door-sensor
#### Hardware connections
| ESP8266 | Relay | Reed switch |
| ------- | ----- | ----------- |
| GND | GND | G |
| 3.3v | | V |
| 5v | V | |
| D6 | S | |
| D5 | | S |
### Motion Sensor
The motion sensor consists of an ESP32 NodeMCU, an analog temperature sensor, a microphone, an analog ambient light sensor, a PIR (**P**assive **I**nfra**R**ed) motion sensor and a LED.
When motion is detected on the motion sensor a message is sent via MQTT.
If the alarm is armed the alarm will trigger.
When the alarm is triggered the LED will flash continually.
While the system is arming while flash two consecutive pulses indicating it's currently arming.
When the system is disarmed it will flash a single time.
When the microphone detects a high sound when the system is armed it will trigger the alarm.
This is to detect a window breaking or an explosion.
The data from the light and temperature sensor is currently just being stored in the database, but no further analysis it performed.
#### Source code
The source code can be found at https://git.bpfilip.dk/HFJ/alarm-motion-sensor
#### Hardware connections
| ESP8266 | 16x2 LCD Display |
| ------- | ---------------- |
| 3.3v | 3.3v |
| GND | GND |
| ESP8266 | Temperature | Microphone | Light | Motion | LED |
| ------- | ----------- | ---------- | ----- | ------ | --- |
| GND | G | G | G | G | G |
| 3.3v | V | V | | | V |
| 5v | V | | V | V | |
| D34 | S | | | | |
| D35 | | S | | | |
| D32 | | | S | | |
| D33 | | | | S | |
| D25 | | | | | S |
### Controller
The controller consist of a Raspberry Pi running a MQTT broker, a PostgreSQL database and a NodeJS application.
The database and MQTT broker is setup in Docker containers.
This makes setup and management of configuration files easier.
The NodeJS application is the brain of the whole alarm system.
It listens for events from all the devices using MQTT and the broker.
It fx. handles when a card is read and checks it against the list of known cards and if it's known sends the messages to the other devices of what to do next. The controller is also in charge of managing the current state of the whole system, each device can be restarted and keeps no state stored.
The controller is also in charge of hosting a REST API and a web interface for controlling the system. Currently the only function on the web interface is to arm and disarm the system. Future improvements could include user management, access control, a history of events, changing user pins and access cards and tags. Currently a history of all events is written to the database, but as of now it isn't exposed anywhere.
Temperature and light data is written to the database, but is currently not shown anywhere.
This could also be integrated into the web interface for graphs of the data.
Documentation of all the different topics the controller sends and listens on can be found here https://git.bpfilip.dk/HFJ/alarm-controller/src/branch/main/API.md
Loading…
Cancel
Save