{"id":25518605,"url":"https://github.com/aeyage/bank-vault-sec","last_synced_at":"2026-02-09T00:32:29.128Z","repository":{"id":273914198,"uuid":"847034995","full_name":"aeyage/bank-vault-sec","owner":"aeyage","description":"breadboarded an intelligent system to detect unauthorised access to the bank vault","archived":false,"fork":false,"pushed_at":"2025-01-23T17:42:53.000Z","size":95,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-21T07:47:49.602Z","etag":null,"topics":["arduino-ide","google-cloud","mongodb-atlas","nodemcu-esp32"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aeyage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-24T16:57:03.000Z","updated_at":"2025-01-23T17:42:56.000Z","dependencies_parsed_at":"2025-01-23T18:37:18.093Z","dependency_job_id":"65a1a21b-5564-4056-a1cc-9d7f821e3633","html_url":"https://github.com/aeyage/bank-vault-sec","commit_stats":null,"previous_names":["aeyage/bank-vault-sec"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aeyage/bank-vault-sec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeyage%2Fbank-vault-sec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeyage%2Fbank-vault-sec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeyage%2Fbank-vault-sec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeyage%2Fbank-vault-sec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aeyage","download_url":"https://codeload.github.com/aeyage/bank-vault-sec/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aeyage%2Fbank-vault-sec/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29251541,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T22:49:53.206Z","status":"ssl_error","status_checked_at":"2026-02-08T22:49:51.384Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino-ide","google-cloud","mongodb-atlas","nodemcu-esp32"],"created_at":"2025-02-19T16:54:03.078Z","updated_at":"2026-02-09T00:32:29.094Z","avatar_url":"https://github.com/aeyage.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bank Vault Security #\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/dd7d8b47-196b-4420-a8e0-b1c59b37a4cb\" width=\"50%\"\u003e\n\u003c/p\u003e\n\nAuthored by Aiman Hakimi, 2025.\n\n- - - -\n\n## Project Overview ##\n\nThe system deploys a passive infrared (PIR) motion sensor and an MC-38 door magnetic sensor switch that are interfaced with the NodeMCU-32S to detect unauthorised access to the bank vault through the use of those sensors by providing alerts in near-real-time. When the door and the PIR sensors detect an opening or movement in close proximity, the data will be transmitted to the NodeMCU-32S board which will then engage the buzzer to sound the alarm and blink the LED to provide a visual alert signal.\n\nSubsequently, NodeMCU-32S interfaces with Google Cloud via MQTT protocol to publish the intrusion event data to the cloud. Google Cloud enables the ingestion of the data and stores it in MongoDB for data persistence. Finally, MongoDB Atlas will visualise the ingested intrusion events data via Charts dashboard.\n\n\u003e [!NOTE]\n\u003e Some working knowledge in physics and electronics will be useful didactically albeit not necessarily required.\n\u003e\u003e Good-to-haves before getting started with IoT projects are basic knowledge in electronic components\n\u003e\u003e including microcontrollers, sensors, actuators, and servo, alongside with networking protocols, and wireless connectivities such as\n\u003e\u003e WiFi, Zigbee, BLE, LoRa, etc. Finally, extensive knowledge in cloud computing and programming languages like C++, Python, and Lua (non-exhaustive list).\n\n\n## System Architecture ##\n\n### Components ###\n\nHardware  | Software\n------------- | -------------\nNodeMCU-32S WiFi Bluetooth BLE IoT Dev Board  | Google Cloud Platform\nPassive Infrared Motion Sensor  | Arduino IDE\nMC-38 Door Magnetic Sensor | MongoDB Atlas\nActive Buzzer - PCB Mount | \\|\nLED 5mm | \\|\nResistor 0.25W 5% 1M2 Ohm | \\|\nMale-to-Male Jumper Wires | \\|\n\n### Schematic Diagram\u003ca name=\"DIAG\"\u003e\u003c/a\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/018c6123-b557-465e-a160-82bed9491b87\" width=\"50%\"\u003e\n\u003c/p\u003e\n\n## Setup Guide\n\n### Hardware Setup\n\nWe may commence setting up the project by wiring each component on the NodeMCU-32S board before interfacing it with the software.\n\n\u003e[!IMPORTANT]\n\u003e The NodeMCU-32S board has several GPIO pins. For a clearer understanding of the available pins on the board, kindly refer to\n\u003e [pinout diagram](https://wiki.geekworm.com/NodeMCU-32S) or the [schematic diagram](#DIAG).\n\n  - Active Buzzer - PCB Mount\n    - GPIO12 -\u003e +ve leg\n    - GND -\u003e -ve leg\n\n  - PIR Motion Sensor\n    - VCC -\u003e 3.3V\n    - GND -\u003e GND\n    - OUT -\u003e GPIO14\n\n  - MC-38 Door Magnetic Sensor\n    - One end -\u003e GND\n    - Another end -\u003e GPIO16\n\n  - LED 5mm\n    - Anode -\u003e GPIO18 through the resistor 0.25W 5% 1M2 Ohm\n    - Cathode -\u003e GND\n\n\u003e[!NOTE]\n\u003e You may use M-M, M-F, F-F jumper wires to connect the components to any available GPIO pin.\n\u003e Please take care to match the pin number with the value defined in the source code\n\u003e to ensure that the data can be ingested and read successfully in the software section below.\n\n### Software Setup\n\n#### 1. Arduino IDE \n\nDownload the latest release of [Arduino IDE](https://www.arduino.cc/en/software) and set it up by installing all necessary libraries such as `Arduino_JSON`, `EspMQTTClient` and configure the board by installing and including `esp32` library in the IDE through board manager. \n\nConnect your machine to the NodeMCU-ESP32 via serial port (COMx) before compiling `intru_det.ino` sketch.\n\n#### 2. Google Compute Engine Virtual Machine\n\nCreate a VM instance on the cloud console. \n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/81bc6f4c-819d-4b70-aa8d-0fc6f09e519b\" width=\"50%\"\u003e\n\u003c/p\u003e\n\nUpon completion, spin up the instance and SSH into the newly created VM to install the MQTT broker to ensure that the publishers and subscribers route the messages correctly.\n\n```sh\n$ sudo apt-get update\n$ sudo apt-get upgrade\n$ sudo apt-get install mosquitto\n$ sudo apt-get install mosquito-clients\n```\n\n\u003e[!TIP]\n\u003e By default, most cloud vendors block all ingress traffic to ensure maximum security. This includes Google\n\u003e Cloud Platform (GCP). To expose your service to external machines or users, particularly for MQTT, you\n\u003e have to explicitly open the required ports. In this regard, MQTT uses port 1883 for non-TLS communications.\n\nConfigure Virtual Private Cloud (VPC) network and set up the firewall rules accordingly to allow ingress traffic on TCP port 1883 to traverse on the network.\n\n\u003e [!IMPORTANT]\n\u003e Note that setting the source IP ranges to **0.0.0.0/0** will allow access from anywhere, which is not recommended for\n\u003e production environments. As for the priority, VPC firewall rules with lower numbers have higher priority and\n\u003e will be applied first.\n\n#### 3. MongoDB Atlas\n\nA persistent data storage is required for this use case instead of ingesting and storing the event data in localhost to preserve information across multiple instances.\n\nCreate an Atlas cluster and configure it accordingly. Upon completion, authenticate and set up the connection with MongoDB Driver to retrieve the URI for database deployment.\n\n#### 4. MQTT and Database Configurations\n\nCheck on the current state and status of the Mosquitto MQTT broker service to ensure that the\nservice is functioning as expected. In this regard, we want to determine if the Mosquitto service is running (active), stopped (inactive), or has failed.\n\n```sh\n$ sudo systemctl status mosquitto\n```\nIf the Mosquitto service is disabled/ not running, execute the following commands to enable and start the service accordingly.\n\n```sh\n$ sudo systemctl enable mosquito\n$ sudo systemctl start mosquito\n```\nIn order to ingest data into the database through the MQTT client, Paho MQTT library for Python is required to allow Python applications to use MQTT for messaging.\n\n```sh\n$ sudo apt install python3-pip\n$ pip install paho-mqtt\n```\nInstall MongoDB and pymongo library which is a Python driver to allow interaction with MongoDB.\n\n```sh\n$ sudo apt-get install -y mongodb\n$ pip install pymongo\n```\nExtract the contents from `mongo_ingest.py` and nano into the script in the cloud VM CLI and paste the contents. Write out (\u003ckbd\u003e⌃\u003c/kbd\u003e + O) the script and\nexit the nano editor (\u003ckbd\u003e⌃\u003c/kbd\u003e + X).\n\nRun the data ingestion script.\n\n```sh\n$ python3 mongo_ingest.py\n```\n\n## Data Visualisation\n\nThe ingested data is visualised in MongoDB Atlas via Charts in near-real-time.\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/262cad02-8974-4d8a-a934-930075d00523\" width=\"50%\"\u003e\n\u003c/p\u003e \n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/6243f8f2-f071-40f0-b300-3a94855cd848\" width=\"50%\"\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeyage%2Fbank-vault-sec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faeyage%2Fbank-vault-sec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faeyage%2Fbank-vault-sec/lists"}