🌦️ Adaptive Traffic Science: Smart Speed Limit Controller 🚗
Drive Safe, Drive Smart! A React.js prototype that dynamically adjusts speed limits based on real-time weather conditions ⚡
🚀 Features
- 🌩️ Real-time Weather Detection (Rain/Drizzle)
- 🚦 Dynamic Speed Adjustment (60 km/h in bad weather)
- 🔄 Manual Refresh Button for instant updates
- 📱 Responsive UI with clean interface
- 🔧 IoT-Ready Architecture for future expansion
📋 Table of Contents
🌍 Overview
The Adaptive Traffic Science system automatically adjusts highway speed limits using live weather data:
- 📡 Fetches weather data from OpenWeatherMap API
- ⚠️ Reduces speed to 60 km/h during rain/drizzle
- 📊 Displays real-time updates in clean UI
- 🔄 Includes manual refresh capability
🛠️ Prerequisites
Before getting started:
| Requirement | Description |
|---|---|
| 🔑 API Key | OpenWeatherMap Account |
| ⚛️ React/TS | Basic understanding of React & TypeScript |
| 🖥️ Node.js | Node.js v16+ |
| 📝 Editor | VS Code recommended |
💻 Tech Stack
Frontend : React + TypeScript
API Integration: OpenWeatherMap API
HTTP Client : Axios
Styling : Pure CSS
Deployment : Netlify/Vercel
⚙️ Setup Guide
1️⃣ Clone Repository
git clone https://github.com/adaptive-traffic-science.git
cd adaptive-traffic-science
2️⃣ Install Dependencies
npm install
3️⃣ Configure API Key
Create a .env file:
REACT_APP_OPENWEATHERMAP_API_KEY=your_api_key_here
4️⃣ Start Development Server
npm start
🧠 How It Works
🔑 Key Components
| Component | Description |
|---|---|
| 🌤️ WeatherDisplay | Shows location, weather condition, and temperature |
| 🚦 SpeedController | Dynamically adjusts speed limit based on weather |
| 🔄 RefreshButton | Manual weather data refresh capability |
⚡ Core Logic
// SpeedLimitController.tsx
const determineSpeedLimit = (weatherCondition: string): number => {
const SPEED_LIMITS = {
NORMAL: 100, // km/h
REDUCED: 60 // km/h
};
return ['Rain', 'Drizzle'].includes(weatherCondition)
? SPEED_LIMITS.REDUCED
: SPEED_LIMITS.NORMAL;
};
🔮 Future Plans
- 🚨 IoT Integration: Connect with physical speed boards
- 🗺️ Multi-Location Support: Track different highways
- 🌨️ Advanced Alerts: Snow/fog detection system
- 📊 Analytics Dashboard: Historical data visualization
🤝 Contribution
We welcome contributions! Please follow these steps:
- Fork the repository
-
Create a feature 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
GitHub Repo: github.com/your-username/adaptive-traffic-science
📜 License
This project is licensed under the MIT License - see the LICENSE.md file for details.


Top comments (0)