Skip to content

IoT system for monitoring urban lighting and collecting citizen feedback via web app (React, Node.js, MongoDB, LoRaWAN).

License

Notifications You must be signed in to change notification settings

go34loj/IoT-Web-platform

Repository files navigation

SafeWalkMunich: IoT for Citizen Engagement in Smart Cities

License: GPL v3 Live Demo Node.js React MongoDB

A proof-of-concept IoT-based system promoting citizen engagement and urban safety through real-time data collection and visualization.


πŸ“‹ Table of Contents


🌍 About the Project

SafeWalkMunich is a proof-of-concept IoT-based system developed to promote citizen engagement and enhance urban safety through real-time data collection, visualization, and feedback.
The project focuses on street lighting and nighttime safety in Munich, using mobile IoT sensors mounted on vehicles such as e-scooters and buses to record illumination and environmental data.
Citizens can view lighting conditions and leave geotagged feedback via an interactive web application.

Using mobile IoT sensors mounted on vehicles (e-scooters, buses), the system records:

  • πŸ’‘ Illumination levels (lux)
  • 🌑️ Temperature
  • πŸ’§ Humidity
  • πŸ—ΊοΈ GPS coordinates
  • πŸ“Š Pressure and environmental parameters

Citizens can:

  • πŸ“ Drop pins on poorly lit areas
  • πŸ’¬ Leave geotagged comments and feedback
  • πŸ“Š View real-time heatmaps and charts
  • πŸ—³οΈ Participate in community polls

Academic Context: Developed as part of the course GeoSensor Networks and the Internet of Things at the Technical University of Munich, 2025.
πŸ”— Course Information


✨ Key Features

  • πŸ—ΊοΈ Interactive Mapping – Real-time heatmaps showing illumination distribution
  • πŸ“Š Data Visualization – Charts displaying environmental correlations
  • πŸ’¬ Citizen Feedback – Geotagged comments and reports
  • πŸ—³οΈ Community Polls – Engage citizens in urban planning decisions
  • πŸ“± Responsive Design – Works seamlessly on desktop and mobile
  • πŸ”’ Secure API – RESTful backend with MongoDB persistence
  • 🌐 LoRaWAN Integration – Low-power, long-range IoT communication
  • πŸ“ˆ Real-time Analytics – Correlation analysis between environmental factors

🧠 System Architecture

The system follows a layered IoT architecture:

Layer Description Technologies
Sensing Layer Data collection from environmental sensors BME680, VEML7700, GPS (Air530)
Network Layer Low-power, long-range communication LoRaWAN (TTN, SWM), Cayenne LPP
Data Management Middleware and persistent storage FROST Server, MongoDB, Mongoose
Application Layer User interfaces and visualizations React, Express.js, Leaflet, Chart.js

πŸ› οΈ Built With

Frontend

Backend

Hardware & IoT

  • Seeeduino LoRaWAN – Microcontroller with LoRa capability
  • BME680 – Temperature, humidity, pressure, gas sensor
  • VEML7700 – High-sensitivity light sensor
  • Air530 GPS Module – Geolocation tracking
  • LoRaWAN Protocol – Long-range, low-power communication
  • FROST Server – OGC SensorThings API implementation

πŸš€ Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v18.0.0 or higher) – Download
  • npm (comes with Node.js) or yarn
  • MongoDB (local or cloud instance) – MongoDB Atlas
  • Git – Download

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/IoT-Web-platform.git
    cd IoT-Web-platform
  2. Install backend dependencies

    cd backend
    npm install
  3. Install frontend dependencies

    cd ../frontend
    npm install

Environment Variables

Backend Configuration

Create a .env file in the backend directory:

# Server Configuration
PORT=5000
NODE_ENV=production

# CORS Settings (optional)
ALLOWED_ORIGINS=https://munichsafewalk.netlify.app,http://localhost:5173

Frontend Configuration

Create a .env file in the frontend directory:

# API Base URL
VITE_API_URL=http://localhost:5000

# For production
# VITE_API_URL=https://your-backend-url.com

πŸ’» Usage

Development Mode

  1. Start the backend server

    cd backend
    npm start

    The API will run on http://localhost:5000

  2. Start the frontend development server

    cd frontend
    npm run dev

    The app will run on http://localhost:5173

Production Build

# Build frontend
cd frontend
npm run build

# Preview production build
npm run preview

Access the Application


πŸ“ Project Structure

IoT-Web-platform/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ Comment.js          # Comment schema
β”‚   β”‚   β”œβ”€β”€ Feedback.js         # Feedback schema
β”‚   β”‚   └── Poll.js             # Poll schema
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ commentRoutes.js    # Comment endpoints
β”‚   β”‚   β”œβ”€β”€ feedbackRoutes.js   # Feedback endpoints
β”‚   β”‚   └── pollRoutes.js       # Poll endpoints
β”‚   β”œβ”€β”€ index.js                # Entry point (alias for server.js)
β”‚   β”œβ”€β”€ server.js               # Express app configuration
β”‚   β”œβ”€β”€ package.json            # Backend dependencies
β”‚   └── .env                    # Environment variables (not in repo)
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   └── combined_lux_gps.geojson  # Sensor data
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   β”œβ”€β”€ Charts/
β”‚   β”‚   β”‚   β”œβ”€β”€ CombinedSensorChart.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ EnvironmentalRadialBarCharts.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ HumidityRadialBarChart.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ IlluminanceRadialBarChart.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ PressureRadialBarChart.jsx
β”‚   β”‚   β”‚   └── TemperatureRadialBarChart.jsx
β”‚   β”‚   β”œβ”€β”€ tools/
β”‚   β”‚   β”‚   β”œβ”€β”€ CommentTool.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ feedbackTool.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ LightingHeatmapTool.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ LightingTool.jsx
β”‚   β”‚   β”‚   └── PollTool.jsx
β”‚   β”‚   β”œβ”€β”€ App.jsx              # Main app component
β”‚   β”‚   β”œβ”€β”€ Dashboard.jsx        # Dashboard page
β”‚   β”‚   β”œβ”€β”€ Home.jsx             # Landing page
β”‚   β”‚   β”œβ”€β”€ PollModal.jsx        # Poll modal component
β”‚   β”‚   β”œβ”€β”€ FloatingButtons.jsx  # Navigation buttons
β”‚   β”‚   β”œβ”€β”€ ToolContext.jsx      # Context API for tools
β”‚   β”‚   β”œβ”€β”€ toolRegistry.jsx     # Tool registration
β”‚   β”‚   β”œβ”€β”€ main.jsx             # Entry point
β”‚   β”‚   └── index.css            # Global styles
β”‚   β”œβ”€β”€ vite.config.js           # Vite configuration
β”‚   β”œβ”€β”€ package.json             # Frontend dependencies
β”‚   └── .env                     # Environment variables (not in repo)
β”œβ”€β”€ scripts/                     # Data processing scripts
β”œβ”€β”€ LICENSE                      # GNU GPL v3
└── README.md                    # This file

βš™οΈ Hardware Components

Microcontroller & Shields

  • Seeeduino LoRaWAN (Arduino-compatible with LoRa radio)
  • Base Shield V2 (Grove connector interface)

Sensors

Sensor Measurement Interface
BME680 Temperature, Humidity, Pressure, Air Quality I2C
VEML7700 Ambient Light Intensity (0.0036 - 120k lux) I2C
Air530 GPS GPS coordinates (latitude, longitude) UART

Power Supply

  • Li-Po Battery: 3.7V, 2000 mAh
  • USB Power Bank: Backup power for extended operation

Enclosure

  • Custom 3D-printed case designed in Autodesk Fusion 360
  • Weatherproof and mountable on vehicles

πŸ›°οΈ Communication Protocol

LoRaWAN Configuration

  • Protocol: LoRaWAN Class A
  • Networks:
    • SWM (Stadtwerke MΓΌnchen) – Municipal network
    • TTN (The Things Network) – Community network
  • Frequency: EU868 MHz
  • Payload Format: Cayenne LPP (Low Power Payload)
  • Data Rate: SF7-SF12 (adaptive)

Data Flow

Sensors β†’ Seeeduino β†’ LoRa Radio β†’ Gateway β†’ TTN/SWM β†’ FROST Server β†’ MongoDB β†’ API β†’ Web App

πŸ”Œ API Endpoints

Comments

Method Endpoint Description
GET /api/comments Retrieve all comments
POST /api/comments Create a new comment
GET /api/comments/:id Get comment by ID
DELETE /api/comments/:id Delete a comment

Feedback

Method Endpoint Description
GET /api/feedbacks Retrieve all feedback
POST /api/feedbacks Submit new feedback
GET /api/feedbacks/:id Get feedback by ID

Polls

Method Endpoint Description
GET /api/polls Retrieve all polls
POST /api/polls Create a new poll
PUT /api/polls/:id/vote Submit a vote
GET /api/polls/:id/results Get poll results

Base URL (Development): http://localhost:5000
Base URL (Production): [Your deployed backend URL]


πŸš€ Deployment

Frontend (Netlify)

Backend (Render)

  • Runtime: Node.js
  • Build Command: npm install
  • Start Command: npm start
  • Environment Variables: Configure in Render dashboard
  • Auto-deploy: Enabled on main branch

Database (MongoDB Atlas)

  • Cloud-hosted MongoDB cluster
  • Connection: Via MONGO_URI environment variable
  • Backup: Automated daily backups

πŸ§ͺ Testing

Field Testing

  • Location: Moosfeld district, Munich, Germany
  • Duration: 3-hour nighttime walk
  • Date: August 2025

IoT device performance

βœ… LoRaWAN Performance: Stable connectivity throughout test area
βœ… GPS Accuracy: Β±5 meters
βœ… Battery Life: 6+ hours continuous operation
βœ… Sensor Reliability: 99.2% successful readings
βœ… Data Transmission: 98.7% packet delivery rate

Verification

  • Real-time monitoring via Grafana dashboards
  • Post-processing analysis in web application
  • Cross-validation with city lighting infrastructure data

🧱 Challenges & Solutions

Challenge Impact Solution
Heavy, non-ergonomic sensor enclosure Limited deployment mobility 3D-printed lightweight, ergonomic case
Grafana dashboard complexity Steep learning curve Reimplemented with Chart.js + ApexCharts
Insufficient TSL2561 sensitivity Poor low-light readings Upgraded to VEML7700 (120k lux range)
GPS coordinate rounding (Cayenne LPP) Loss of precision Implemented heatmap visualization
Timestamp timezone offset Data synchronization issues Reconstructed timing using photo metadata

πŸ“Š Results Summary

  • Identified uneven illumination along pedestrian routes.
  • Confirmed correlation between temperature drops and humidity peaks near open fields.
  • Demonstrated technical feasibility of mobile IoT data collection for citizen-engaged smart-city services.

πŸ“„ License

Distributed under the GNU General Public License v3.0. See LICENSE for more information.

This means you can freely:

  • βœ… Use this software for any purpose
  • βœ… Modify the source code
  • βœ… Distribute copies
  • βœ… Distribute modified versions

Conditions:

  • πŸ“ Disclose source code
  • πŸ“ Include original license and copyright
  • πŸ“ State changes made to the code

πŸ‘₯ Team

Group 04 – IoT for Citizen Engagement in Smart Cities (2025)

Name Role GitHub
Gloria Asenath Kiawa IoT Hardware & Backend gloriak9
Margarita Zykova Data Visualization & Frontend @go34loj

Supervisors:
M.Sc. Joseph Mureithi Gitahi, M.Sc. Benedikt Schwab, Univ.-Prof. Dr. rer. nat. Thomas H. Kolbe


πŸ“š References

For complete citations and bibliography, please refer to:


⬆ Back to Top

Made with ❀️ in Munich πŸ‡©πŸ‡ͺ

Β© 2025 Technical University of Munich – Group 04 Β· Smart Cities IoT Project

About

IoT system for monitoring urban lighting and collecting citizen feedback via web app (React, Node.js, MongoDB, LoRaWAN).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •