- Introduction
- Features
- Technologies Used
- System Architecture
- Prerequisites
- Installation
- Configuration
- Running the Application
- API Documentation
- Frontend Structure
- Backend Structure
- IoT Simulation
- Data Flow
- Troubleshooting
- Future Enhancements
- Contributing
- License
The Urban Soundscape Harmonizer is an innovative project aimed at monitoring and analyzing urban noise levels in real-time across major Indian cities. By leveraging IoT simulations, machine learning, and data visualization techniques, this project provides a comprehensive view of the acoustic environment in urban areas.
Our system simulates IoT sensors deployed in six major Indian cities: Mumbai, Delhi, Bangalore, Kolkata, Chennai, and Hyderabad. These virtual sensors collect noise level data and frequency distributions, which are then processed, stored, and visualized in an interactive dashboard.
- Real-time noise level monitoring for six major Indian cities
- Interactive map showing sensor locations and current noise levels
- Dynamic charts displaying historical noise level data
- Color-coded noise level indicators for quick assessment
- Simulated IoT sensor data generation
- RESTful API for data retrieval and storage
- Responsive web design for various device sizes
-
Frontend:
- React.js
- Material-UI
- Framer Motion (for animations)
- Recharts (for data visualization)
- Leaflet (for map integration)
-
Backend:
- FastAPI (Python)
- Uvicorn (ASGI server)
-
Database:
- InfluxDB (for time-series data storage)
-
IoT Simulation:
- Python
-
Development Tools:
- Git & GitHub (version control)
- npm (package management)
- Visual Studio Code (recommended IDE)
The Urban Soundscape Harmonizer consists of three main components:
- Frontend: A React-based web application that provides an interactive dashboard for visualizing noise data.
- Backend: A FastAPI server that handles data processing, storage, and retrieval.
- IoT Simulation: A Python script that simulates IoT sensors generating noise level data.
These components interact as follows:
- The IoT simulation generates noise data for each city.
- This data is sent to the backend via HTTP POST requests.
- The backend processes the data and stores it in InfluxDB.
- The frontend periodically fetches the latest data from the backend and updates the dashboard.
Before you begin, ensure you have the following installed:
- Python 3.8+
- Node.js 14+
- npm 6+
- Git
- InfluxDB 2.0+
-
Clone the repository:
git clone https://github.com/ascender1729/urban-soundscape-harmonizer.git cd urban-soundscape-harmonizer
-
Set up the backend:
cd src/backend python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` pip install -r requirements.txt
-
Set up the frontend:
cd ../../src/frontend npm install
-
Install InfluxDB following the official documentation for your operating system.
-
Backend Configuration:
- Create a
.env
file in thesrc/backend
directory with the following content:INFLUXDB_URL=http://localhost:8086 INFLUXDB_TOKEN=your_influxdb_token INFLUXDB_ORG=your_organization INFLUXDB_BUCKET=soundscape
- Replace
your_influxdb_token
andyour_organization
with your InfluxDB credentials.
- Create a
-
Frontend Configuration:
- If your backend is running on a different port or host, update the API URL in
src/frontend/src/config.js
.
- If your backend is running on a different port or host, update the API URL in
-
Start the InfluxDB server (follow InfluxDB documentation for your OS).
-
Start the backend:
cd src/backend source venv/bin/activate # On Windows use `venv\Scripts\activate` uvicorn main:app --reload --port 3001
-
Start the frontend (in a new terminal):
cd src/frontend npm start
-
Run the IoT simulation (in another new terminal):
cd src/iot python sensor_simulation.py
-
Open your browser and navigate to
http://localhost:3000
to view the dashboard.
The backend provides the following API endpoints:
GET /
: Welcome messagePOST /soundscape
: Submit new soundscape dataGET /soundscape/{location}
: Retrieve soundscape data for a specific location
For detailed API documentation, run the backend and visit http://localhost:3001/docs
.
The frontend is organized as follows:
src/
components/
: React componentsDashboard.js
: Main dashboard componentMap.js
: Map component for visualizing sensor locations
App.js
: Root componentindex.js
: Entry point
Key components:
Dashboard
: Manages the overall layout and data fetchingMap
: Renders the interactive map using Leaflet
The backend is structured as follows:
main.py
: FastAPI application and route definitionsmodels.py
: Pydantic models for data validationdatabase.py
: InfluxDB connection and query functions
The IoT simulation (sensor_simulation.py
) generates random noise level data for each city. It sends this data to the backend every 5 seconds, simulating real-time sensor readings.
- IoT simulation generates data
- Data is sent to the backend via POST request
- Backend validates and stores data in InfluxDB
- Frontend fetches latest data from backend every 5 seconds
- Dashboard updates with new data
- If the frontend fails to fetch data, ensure the backend is running and the API URL is correct in
config.js
. - If the backend fails to start, check your InfluxDB connection settings in the
.env
file. - For InfluxDB connection issues, verify that the InfluxDB server is running and accessible.
- Implement user authentication
- Add more cities and sensor types
- Integrate machine learning for noise prediction
- Develop mobile app versions
- Implement real-time notifications for high noise levels
We welcome contributions to the Urban Soundscape Harmonizer! Please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.