Student Name: Sophie Hayes
Student ID: 20114793
Project Repository Repository
Not On My Network is an IoT-based network administration tool designed to give users control over who, and what, connects to their home WiFi.
As more and more connected technologies enter our homes, "Digital Wellbeing" is becoming a priorit and people are also seeking to disconnect. This project will allow users to disconnect devices of their choosing from their home network. It will aid with security, as ony devices on the chosen list will have access to the network.
This project allows users to enforce Allow Lists (Whitelists), block intruders, and schedule "Digital Curfews" (Night Mode) using blacklists to automatically disconnect specific devices at night to encourage better sleep hygiene and habits.
This project was created to solve two problems:
-
Security: Users rarely check who is on their network. This tool allows users to choose allowed and restricted devices and makes intruders visible instantly via a physical dashboard (SenseHat) and mobile alerts (Blynk and discord).
-
Digital Wellbeing: Parents or individuals often want to disconnect devices at night without physically taking them away. This project automates network restriction based on a schedule. NOTE: As this is a student project, device blocking is simulated, but could be completed using
arptables.
This project will create an allowed list of devices on the network. Any other mac addresses will be disallowed. The Raspberry Pi runs python scripts that are activated mobile Blynk app button, temporarily restricting chosen devices. Additionally, a 'night-time' schedule restricts specific devices (e.g., gaming consoles) overnight and restores them in the morning.
- Active Network Scanning: Uses SCAPY and ARP protocol to detect every device on the LAN.
- Intruder Detection: Compares active devices against a Whitelist. If an unknown device appears, the SenseHAT flashes a "Skull" alert and a notification is sent to the Blynk app and to discord.
- Cloud Control (Blynk): View system status and toggle "Lockdown Mode" remotely via a mobile app.
- Night Mode Automation: Automatically restricts the network between 9 PM and 8 AM (configurable via Blynk app).
- Live Logging: Intruder alerts and weekly and daily reports are sent to discord channel using webhooks, all events in the app are logged to MongoDB Atlas (cloud) database collection and certain events trigger Blynk events and notifications, (e.g. late night overriding restriction).
- Web Dashboard (Streamlit): A browser-based analytics center to view historical logs and intruder stats.
- Dockerized Deployment: Runs in a container for easy installation and stability.
This project demonstrates a multi-service architecture separating the Edge Device (Raspberry Pi) from the Cloud Services.
This project uses ARP (Address Resolution Protocol).
-
ARP operates at Layer 2 (Data Link Layer). Every device must answer ARP requests to communicate on the LAN, making it impossible to "hide" from this scanner.
-
Implementation: The Python script broadcasts Ethernet frames to ff:ff:ff:ff:ff:ff asking "Who has IP X?".
The system operates in a state loop managed by notOnMyNetwork.py:
-
Scan Phase: Scan the network.
-
Verify Phase: Compare MAC addresses against
whitelist.txtand blacklist.txt. -
Action Phase:
-
If Intruder -> Trigger Visual Alarm (SenseHAT) -> Webhook to Discord & Log to Mongo.
-
Night Mode: -> If time is > 9 PM (user can configure in blynk app), check for blacklisted devices -> Log violations.
-
-
Hardware: Raspberry Pi 4 + SenseHAT.
-
Protocols:
- ARP: Local device discovery.
- HTTPS/REST: Discord Webhooks and MongoDB Atlas API.
- Blynk Protocol (MQTT): Bidirectional communication for mobile control.
- Raspberry Pi 4: The central edge gateway running the scanning logic.
- SenseHAT: Provides immediate visual feedback (LED Matrix) and physical control (Joystick). The SenseHAT provides immediate "headless" feedback (LED Matrix) without needing a monitor.
- Python 3: Core logic. Extensive library support for low-level networking (Scapy) and data handling (Pandas).
- Scapy: Chosen for network scanning because it uses ARP (Address Resolution Protocol) to identify devices by MAC address.
- Streamlit: Used to build a data-driven web dashboard quickly without complex HTML/CSS.
- Docker: Ensures the application runs reliably on any device without dependency conflicts. Scapy requires root privileges and specific system dependencies. Docker isolates these, preventing conflicts with the host OS.
- MongoDB Atlas: A cloud-based NoSQL database used to store event logs and historical data. It was chosen for its flexibility with JSON-style log data.
- Blynk IoT: Provides the mobile interface, event handling and push notification infrastructure.
- Discord: Acts as a real-time logging channel for alerts.
| Mobile App (Blynk) | Web Dashboard (Streamlit) | Hardware (SenseHat) | Sample Output - Intruder |
|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
- Raspberry Pi (4 used in this project) with Raspberry Pi OS.
- Docker & Docker Compose installed.
- A Blynk Account and MongoDB Atlas Account and Discord Account.
git clone https://github.com/Oiche000/NotOnMyNetwork.git
cd IoT-Project-
Create a free MongoDB Atlas account and create a cluster on MongoDB Atlas.
-
Create a Database User and password.
-
Network Access, whitelist the Public IP of your Raspberry Pi. You can find this by running
curl ifconfig.meon the Pi. -
Connection: Choose connect via Driver: Python 3.6+ and copy the connnection string.

-
Create Blynk account and create a Template.
-
Setup Datastreams:
- V0: Master Switch (Integer 0/1) - Trigger Network restriction/restoration
- V2: Start Time (Integer) - configure the time
- V3: End Time (Integer) - configure the time
-
Setup Events for Notifications:
- Go to the Events tab in your Template.
- Create intruder_alert: Type = Critical, Notifications = ON, Limit = 1 Hour.
- Create schedule_override: Type = Warning, Notifications = ON, Limit = 5 minutes - 1 hour (depending on preference).
- Create system_log: Type = Info, Notifications = OFF, Limit = None (Show in Timeline only).

-
Copy your BLYNK_AUTH_TOKEN from the Device Info tab.
-
Create a free discord account and create a server.
-
In your Discord Server, go to Channel Settings -> Integrations -> Webhooks.
-
Create New Webhook -> Copy Webhook URL.
Create a file named .env in the root directory to store secrets, add this file to .gitignore file if applicable:
BLYNK_AUTH=your_blynk_auth_token_here
MONGO_URI=your_mongodb_connection_string_here
DISCORD_URL=your_discord_webhook_url
This project requires low-level network access for scanning -> include --privileged.
Build the image.
docker build -t not-on-my-network .
docker run --privileged --network host --env-file .env not-on-my-network
Manual Installation (Virtual Env)If not using Docker:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
sudo .venv/bin/python notOnMyNetwork.pyTo view streamlit dashboard run following from project folder:
pip install streamlit pandas pymongo
streamlit run dashboard.pyMobile and Web Dashboard
Physical Alert Toggle restrictions & get alerts Analyze 7-day trends & logs Red Skull = Intruder Detected
To ensure the system is adaptable to different home environments, the project avoids "hard-coding".
-
Environment Secrets: API keys and Database URIs are stored in .env (not committed to version control).
-
Config File: The behaviour of the app is controlled by a JSON config file that allowd adjustment of default night start/end times, location of white- and black- lists
-
State Management: Whitelists are maintained in persistent storage, allowing the system to remember devices even after a reboot.
-
Reporting Parameters (analytics.py) The analytics module is designed to be flexible. While the default dashboard shows the "Last 7 Days," the functions in analytics.py accept dynamic arguments.
-
Night Mode start/end times are controlled dynamically via the Blynk App widgets either via the mobile or web dashboards.
Fork the repo.
Create a feature branch (git checkout -b feature/NewFeature).
Commit your changes.
Push to the branch and open a Pull Request.
MIT © Sophie Hayes
The following resources were instrumental in building this project. They are highly recommended for anyone replicating this work.
Scapy Documentation: Usage for Scanning - Used to understand ARP packet construction. Dev Dev GeeksForGeeks
MongoDB for Python: PyMongo Tutorial - Guide on CRUD operations. Followed steps in Chapter 1 of guide GeeksForGeeks - Mongo Connection
Streamlit Docs: Connect to Data - How to bind Python scripts to web UIs. Streamlit
Streamlit Youtube - Building a dashboard app
Streamlit Youtube - Dashboards
Programming is Fun - Python and Streamlit Dashboards
Fanilo Andrianasolo - Streamlit Dashboards
Where applicable, all other references are included in a comment near the relevant code in the code files.
One of the biggest challenges in this project was handling the "stateless" nature of network scanning.
The Problem: The scanner detects devices now, but doesn't know if they were there 5 minutes ago.
The Solution: I implemented a robust logging system in MongoDB. By querying the last known state from the database before performing an action, the system gained "memory," allowing it to calculate things like "Late Night Restores" and "Intruder Duration" for my Dashboard.
Future Improvements: Currently, the system detects intruders but cannot physically kick them off the network (it relies on notifications). A future iteration could use arpspoof or arptables to disconnect unwanted devices. Device lists could also be read from MongoDB Atlas in the future to prevent having to read files on the device. A configuration collection could be created to control these lists as well as device parameters such as saving state and configuration if device is offline. Once re-connected, the device can get these values and apply them.




