This project is a simple home arrest GPS tracking and geofencing system. It uses an Arduino with a GPS module to track a person's location, sends alerts if they leave a defined area, and visualizes live tracking data on a web map. It also logs data to Firebase and sends SMS alerts using Twilio.
- Live GPS Tracking: See the person's current location on a map in real time.
- Geofencing: Set a safe area (radius) around a home. Get alerts if the person leaves this area.
- SMS Alerts: Sends SMS to police/guardian if the person leaves the safe area or moves rapidly.
- Data Logging: Saves all location updates and alerts to a CSV file and Firebase.
- Web Visualization: View live location and recent logs in your browser.
- Easy Setup: Simple Python and HTML files, easy to run and modify.
- Modern UI: Clean, responsive, and easy-to-read web pages for monitoring.
- Arduino Uno (or compatible)
- GPS Module (e.g., NEO-6M)
- Buzzer
- Jumper wires
- USB cable for Arduino
| GPS Module Pin | Arduino Pin |
|---|---|
| VCC | 3.3V or 5V |
| GND | GND |
| TX | D3 |
| RX | D4 |
| Buzzer Pin | Arduino Pin |
|---|---|
| + (long) | D5 |
| - (short) | GND |
- Open
sketch.txtin the Arduino IDE. - Select the correct board and port from the Tools menu.
- Click the Upload button.
- Important: Close the Arduino IDE after uploading, so Python can use the serial port.
- Download and install Python 3.x from python.org.
- During installation, check "Add Python to PATH".
Open a terminal (Command Prompt or PowerShell) and run:
pip install pyserial folium twilio firebase-admin
- Go to firebase.google.com and create a new project.
- In the project settings, go to Service Accounts and generate a new private key.
- Download the JSON file and place it in your project folder as
firebase_service_account.json. - In the Firebase Realtime Database, create a new database and set the rules to allow read/write for testing.
- Copy your database URL and update it in
track.py(look forFIREBASE_DB_URL).
- Sign up at twilio.com.
- Verify your phone number.
- Get your Account SID, Auth Token, and Twilio phone number from the Twilio Console.
- Put these in
track.py(use placeholders for public sharing).
- Plug in your Arduino with the GPS module and buzzer attached.
- Make sure no other program (like Arduino IDE) is using the same COM port.
- Open a terminal in the project folder.
- Run:
python Geofencing/track.py
- The script will:
- Read GPS data from Arduino
- Log data to CSV and Firebase
- Send SMS alerts if needed
- Update the map HTML file
- Open the map in your browser
- Open
arrest_monitor.htmlin your browser to see the live map and subject details. - Open
Geofencing/live_tracking.htmlin your browser to see live tracking and recent logs (requires Firebase setup). - Both pages are styled for clarity and mobile-friendly viewing.
- All location updates are saved in
tracking_log.csvfor your records. - You can open this file in Excel or any spreadsheet app.
- Use placeholder credentials for public code sharing.
- Do not share your real Twilio or Firebase keys.
- The system is for educational/demo purposes. For real use, add security and privacy features.
- If you change the COM port or wiring, update the code accordingly.
- Serial port error:
- Check that the Arduino is connected and no other program is using the port.
- Use Device Manager (Windows) or
ls /dev/tty*(Linux/Mac) to find the correct port.
- Map does not update:
- Check your Python script output for errors.
- Make sure the browser is opening the correct HTML file.
- Firebase or Twilio errors:
- Double-check your credentials and internet connection.
- Make sure your Firebase rules allow writing.
- No GPS data:
- Make sure the GPS module has a clear view of the sky.
- Wait a few minutes for the first GPS fix.
- Made for learning and demo purposes.
- Uses open source libraries: Folium, Leaflet, Firebase, Twilio, PySerial.
- UI inspired by modern dashboard designs for clarity and ease of use.