Skip to content

ArshTiwari2004/Signal-X

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

154 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Breaking the Red Tape of Congestion and Inefficiency

|
Live Now

Click the button above to visit the live version of the Signal-X project hosted on Vercel.

License: MIT Python React Flask

GitHub Stars GitHub Forks GitHub Watchers

Last Commit Repo Size Languages Top Language Contributors

Deployed on Vercel

๐ŸŒŸ Overview

Signal-X is an AI-driven smart traffic management system that uses advanced computer vision, Arduino-controlled signals, and MapmyIndiaโ€™s geospatial analytics to optimize traffic flow in real-time. It prioritizes emergency vehicles, prevents congestion, and enhances road safety through dynamic signal adjustments using live video feeds. Scalable and future-ready, Signal-X is adaptable for cities of all sizes, making urban commuting smarter and more efficient.

๐Ÿšง Problem Statement

โ— The Urban Gridlock Crisis

With rapid urbanization and an ever-increasing number of vehicles, cities are choking under intense traffic congestion. What should be smooth commutes turn into daily nightmares, leading to:

  • โฑ๏ธ Wasted Time stuck in endless queues
  • โ›ฝ Higher Fuel Consumption and rising transportation costs
  • ๐ŸŒซ๏ธ Increased Pollution and carbon emissions
  • ๐Ÿšจ Delayed Emergency Responses for ambulances, fire trucks, and police
  • ๐Ÿ˜  Driver Frustration and rising road rage incidents

๐Ÿšฆ The Flaws of Conventional Traffic Lights

Traditional traffic systems follow fixed-timer logic, blindly rotating signals without considering real-time traffic flow. This outdated mechanism leads to:

  • ๐ŸŸข Green lights on empty roads, wasting valuable intersection time
  • ๐Ÿ”ด Vehicle pile-ups in busy lanes, creating bottlenecks
  • ๐Ÿš‘ Emergency vehicles stuck, unable to move swiftly through intersections
  • ๐Ÿงโ€โ™‚๏ธ Manual control dependency, requiring more manpower
  • ๐Ÿง  No AI, No Adaptability, making systems unresponsive and inefficient

Itโ€™s time to move beyond timers and take the smart route to traffic management.


๐Ÿ’ก Our Solution โ€“ Signal-X

Signal-X is an AI-driven Smart Traffic Management System that transforms urban mobility using the power of computer vision, IoT, and geospatial intelligence. Designed to be scalable, real-time, and intelligent, Signal-X optimizes traffic flow, reduces congestion, and ensures faster emergency response through dynamic signal control.

Workflow of Signal-X


๐Ÿš€ Key Features

  • ๐Ÿง  AI-Powered Traffic Analysis
    YOLOv8-based object detection continuously monitors vehicle flow across all junction lanes.

  • โฑ๏ธ Dynamic Signal Adjustment
    Adaptive signal control based on real-time congestion and traffic density patterns.

  • ๐ŸŒ IoT Integration
    Raspberry Pi/Arduino-based controllers ensure seamless traffic light control and emergency detection.

  • ๐Ÿ—บ๏ธ Geospatial Intelligence
    Integration with MapMyIndia's API offers live congestion updates and smart rerouting.

  • ๐Ÿš‘ Emergency Vehicle Prioritization
    Automatically detects emergency vehicles (ambulance, fire brigade, police) and gives them green-light priority.

  • ๐Ÿ”ฎ Congestion Prediction
    AI models analyze historical + real-time data to predict and prevent traffic bottlenecks.


๐Ÿงฉ How Signal-X Works โ€“ Workflow

Signal-X operates through a seamless, AI-driven pipeline that integrates video processing, intelligent decision-making, and hardware-level execution.

AI Model Processing the Traffic

โžก๏ธ

Result of the Processing Model


โš™๏ธ Step-by-Step Workflow

  1. ๐ŸŽฅ Live Data Collection

    • RTSP streams from CCTV cameras and drones provide real-time traffic video feeds.
  2. ๐Ÿ—บ๏ธ Traffic API Integration

    • Feeds are passed to MapMyIndia Traffic API for real-time congestion data enrichment.
  3. ๐Ÿง  Vehicle Detection using YOLOv8

    • Vehicles are identified and classified into 5 categories:
      ๐Ÿš‘ Ambulance, ๐Ÿงฌ Organ Transport, ๐Ÿš’ Fire Brigade, ๐Ÿš“ Police, ๐Ÿ†˜ Disaster Units
  4. ๐Ÿ”„ Real-Time Multiprocessing

    • Uses Pythonโ€™s multiprocessing to analyze all four lanes at a junction simultaneously for accurate density analysis.
  5. ๐Ÿงฎ Smart Signal Optimization

    • A custom AI model determines the optimal green-light timing using:
      • ๐Ÿ“Š Vehicle Density
      • ๐Ÿ•“ Historical Traffic Patterns (via Reinforcement Learning)
      • ๐Ÿ“ก Live API Congestion Data
  6. ๐Ÿ”Œ IoT-Based Hardware Integration

    • Arduino module integrated into the junction system.
    • If an emergency vehicle is detected, immediate green signal is activated and maintained until it passes.
  7. ๐Ÿ–ฅ๏ธ Real-Time Dashboard (React)

    • Officers monitor and visualize traffic flow and system decisions via a React-based dashboard in real-time.

๐ŸŽฏ Why Signal-X?

Unlike traditional fixed-timer systems, Signal-X uses real-time intelligence and automation to enhance traffic efficiency, reduce delays, and save lives.

โœ… Smart
โœ… Scalable
โœ… Emergency-Ready
โœ… Real-Time
โœ… AI-Optimized

๐Ÿ”ง Technical Architecture

Components Overview

  1. Data Collection Layer

    • CCTV cameras & drones capture live video feeds
    • Microphone sensors detect emergency vehicle sirens
    • IoT devices (Raspberry Pi & Arduino) process sensor inputs
  2. AI Processing Layer

    • YOLOv8 for vehicle detection and classification
    • DeepSORT for vehicle tracking
    • OpenCV for image processing
    • Flask for API management
  3. Backend Processing

    • MongoDB for data storage
    • WebSocket for real-time communication
    • Traffic analysis algorithms
  4. Frontend Dashboard

    • React-based responsive interface
    • Real-time traffic analytics visualization
    • MapMyIndia integration for geospatial display
  5. Signal Control System

    • Priority-based signal switching for emergency vehicles
    • Adaptive traffic light control based on congestion analysis

๐Ÿ’ป Technology Stack

๐Ÿงฐ Tech Stack โ€“ What Powers Signal-X ๐Ÿšฆ

Signal-X is built using a powerful blend of AI, hardware, geospatial analytics, real-time systems, and scalable web technologies. Here's everything under the hood:


๐ŸŒ Frontend โ€“ React Dashboard

Tech Purpose
โš›๏ธ React.js Dynamic, component-based UI
๐Ÿ—บ๏ธ MapMyIndia SDK Interactive maps & live traffic visualization
๐ŸŒˆ Tailwind CSS Modern utility-first styling
๐Ÿ“ก WebSocket Real-time UI updates & traffic stats
๐Ÿ”— Axios API requests and data fetching
๐Ÿ“ฑ React Native (Expo) Mobile traffic monitor app (optional extension)

๐Ÿง  AI & Computer Vision โ€“ Smart Traffic Brain

Tech Purpose
๐Ÿง  YOLOv8 High-speed vehicle detection & classification
๐ŸŽฅ OpenCV (cv2) Image & video stream processing
๐Ÿ“Š NumPy, SciPy Traffic data analytics
๐Ÿ“ˆ Matplotlib Data visualization and graphs
๐Ÿ”ฌ Ultralytics YOLOv8 training and inference
๐Ÿง  Reinforcement Learning Intelligent signal timing optimization

๐Ÿงช Backend โ€“ Core Logic & APIs

Tech Purpose
๐Ÿ Flask RESTful API backend (Python)
๐ŸŒ WebSocket (Flask-SocketIO) Real-time data sync with frontend
๐Ÿƒ MongoDB NoSQL database for storing traffic history & logs
โš™๏ธ Express.js + Node.js API support for mobile & hardware integrations

๐Ÿ”Œ Hardware โ€“ IoT-Powered Signal Controller

Component Role
๐Ÿ’ก Arduino UNO Signal & sensor control unit
๐Ÿ”Š CZN15E Sound Sensor Detects approaching emergency sirens
๐ŸŽฅ OV7670 Camera Module Captures live video for CV analysis
๐Ÿ“ HC-SR04 Ultrasonic Sensor Measures distance & lane occupancy
๐Ÿ’ก LEDs, ๐Ÿงฒ Buzzer, ๐Ÿ”Œ Jumper Wires, ๐Ÿ”ณ Breadboard Circuit components for signal light system
๐Ÿง  Arduino IDE + Embedded C/C++ Logic programming and testing
๐Ÿ–ฅ๏ธ Serial Monitor Debugging and communication with PC

๐ŸŽฎ Bonus Tools & Utilities

Tool Use
๐Ÿงฉ Pygame Simulating traffic flow for testing
๐Ÿ“ˆ Scikit-learn Optional ML utilities
๐Ÿงช Matplotlib Data analysis visualization
๐Ÿง  Gemini API Optional AI assistance (integration idea)

๐Ÿš€ Signal-X combines real-world sensors, cutting-edge AI, and cloud-based data pipelines to create a future-ready traffic management solution.


๐Ÿš€ Getting Started

Prerequisites

  • Python 3.8+
  • Node.js and npm
  • MongoDB
  • MapmyIndia API key
  • Gemini API key
  • Arduino IDE

Installation

  1. Clone the repository
    git clone https://github.com/ArshTiwari2004/Signal-X.git
    cd Signal-X
  2. Setup Frontend
    cd traffic-monitoring/frontend/web/signalx-web
    npm install
  3. Create a .env file in the root of the frontend directory with:
    VITE_MAPPLS_SDK_KEY=your_mapmy_india_sdk_key
  4. Start the development server:
    npm run dev
    
  5. Setup Backend - Create and activate a virtual environment:
    python -m venv venv
    venv\Scripts\activate  # Windows
    source venv/bin/activate  # Linux/Mac
    
  6. Install the required packages:
    pip install -r requirements.txt
    
  7. Start the Flask server:
    python backend/flask_api.py
    
  8. For running the Expo project on mobile
    cd mobile-app/signalx-mobile
    npm i
    
  9. Set up your GEMINI_API_KEY in .env
    VITE_GEMINI_API_KEY=your_gemini_api_key
    
  10. Run the app
npx expo start
  1. Setting up the expo backend
cd mobile-app/mobile-backend
npm i 
  1. Set up env variables for expo backend

     TWILIO_ACCOUNT_SID=your_twilio_account_sid_here
     TWILIO_AUTH_TOKEN=your_twilio_auth_token_here 
     TWILIO_PHONE_NUMBER=your_twilio_phone_number_here 
     MONGO_URI=your_mongodb_connection_string_here
    
  2. Run the Mobile Backend Server

    npm run dev 
    
  3. Setup the Arduino IDE

# โš™๏ธ How to Upload 
1. Open the `.ino` files using the Arduino IDE. 
2. Select the correct board and port: - Tools > Board > (e.g., Arduino UNO) - Tools > Port > (Select the connected COM port) 
3. Connect your Arduino (e.g., UNO, Nano, etc.) via USB. 
4. Click the "Upload" button in the Arduino IDE (โžก๏ธ icon). 
5. Ensure all required components (Servo motors, LEDs, Buzzer, etc.) are connected as per the logic in the code. 

Project Structure

signal-x/
โ”œโ”€โ”€ Arduino_code/
โ”‚   โ”œโ”€โ”€ sketch_Camera/
โ”‚   โ”‚   โ””โ”€โ”€ sketch_Camera.ino           # Controls CCTV pan/tilt
โ”‚   โ””โ”€โ”€ sketch_LED_Buzzer/
โ”‚       โ””โ”€โ”€ sketch_LED_Buzzer.ino       # Controls signal lights & alarms
โ”‚
โ”œโ”€โ”€ mobile-app/
โ”‚   โ”œโ”€โ”€ mobile-backend/
โ”‚   โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ db.js                   # MongoDB connection
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ dotenv.js               # API keys config
โ”‚   โ”‚   โ”œโ”€โ”€ models/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Incident.js             # Report schema
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ User.js                 # Auth schema
โ”‚   โ”‚   โ””โ”€โ”€ routes/
โ”‚   โ”‚       โ”œโ”€โ”€ authRoutes.js           # Login/register endpoints
โ”‚   โ”‚       โ””โ”€โ”€ incidentRoutes.js       # Report submission
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ signalx-mobile/
โ”‚       โ”œโ”€โ”€ components/
โ”‚       โ”‚   โ”œโ”€โ”€ EmergencyAlert.js       # Siren detection UI
โ”‚       โ”‚   โ””โ”€โ”€ LiveTrafficLight.js     # Real-time signal status
โ”‚       โ””โ”€โ”€ screens/
โ”‚           โ”œโ”€โ”€ HomeScreen.js           # Main dashboard
โ”‚           โ””โ”€โ”€ ReportScreen.js         # Incident form
โ”‚
โ”œโ”€โ”€ traffic-monitoring/
โ”‚   โ”œโ”€โ”€ backend/
โ”‚   โ”‚   โ”œโ”€โ”€ templates/                  # Admin panel HTML
โ”‚   โ”‚   โ”œโ”€โ”€ ambulance_detection.py      # Priority vehicle logic
โ”‚   โ”‚   โ””โ”€โ”€ traffic_control.py          # Signal timing algorithms
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ frontend/
โ”‚   โ”‚   โ””โ”€โ”€ web/
โ”‚   โ”‚       โ””โ”€โ”€ signalx-web/
โ”‚   โ”‚           โ””โ”€โ”€ src/
โ”‚   โ”‚               โ”œโ”€โ”€ components/     # Reusable UI elements
โ”‚   โ”‚               โ”œโ”€โ”€ pages/          # Route-specific pages
โ”‚   โ”‚               โ””โ”€โ”€ routes/         # Navigation config
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ models/                         # AI models
โ”‚   โ”‚   โ”œโ”€โ”€ yolov8n.pt                 # Vehicle detection weights
โ”‚   โ”‚   โ””โ”€โ”€ siren_detection.h5         # Audio classification
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ simulations/                    # Traffic simulations
โ”‚   โ”‚   โ”œโ”€โ”€ rippling_effect.py         # Congestion spread model
โ”‚   โ”‚   โ””โ”€โ”€ traffic_simulator.py       # Junction flow simulator
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ utils/                          # Utility scripts
โ”‚   โ”‚  
โ”‚   โ”‚                  
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ alert.wav                      # Emergency sound
โ”‚   โ”œโ”€โ”€ dashboard.png                  # Admin UI mockup
โ”‚   โ””โ”€โ”€ README.md                      # Setup instructions

๐Ÿ–ผ๏ธ Snippets

Landing page of Signal-X Landingpage

Live CCTV Feeds in Signal-X Dashboard

RTSP streams processed in real-time Dashboard

Auth workflow userflow

Snapshots of the Citizen App userflow

๐Ÿ”ฎ Future Enhancements

1. AI-Powered Red-Light Violation Detection :

  • Use AI-based license plate recognition to detect vehicles running red lights. Integrated with government databases, the system can auto-generate challans, improving law enforcement efficiency.

2. Smart Signal Optimization with Reinforcement Learning:

  • Leverage reinforcement learning to optimize signal timings based on real-time and historical traffic data, ensuring faster clearance for emergency vehicles and smoother traffic flow.

3. AI-Based Incident Detection & Rerouting:

  • Utilize AI to detect accidents or breakdowns via CCTV analysis. The system can instantly alert authorities and reroute traffic to prevent congestion.

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  • Fork the repository
  • Create your feature branch (git checkout -b feature/amazing-feature)
  • Commit your changes (git commit -m 'Add some amazing feature')
  • Push to the branch (git push origin feature/amazing-feature)
  • Open a Pull Request

โค๏ธ Made with love by Team Synapse โ€” Arsh Tiwari, Priyanshi Bothra, and Nibedan Pati

๐Ÿ“ฉ Have a suggestion or want to connect? Drop a mail at: arshtiwari12345@gmail.com

About

Signal-X is an AI-powered traffic management system using advanced computer vision, edge computing, and geospatial intelligence. With real-time sensor fusion, machine learning algorithms, and adaptive signal control, it enables dynamic congestion management and emergency vehicle prioritization.

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors