๐ฆ๏ธ 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)