{"id":28304734,"url":"https://github.com/freya135/smart-traffic-system","last_synced_at":"2026-04-29T09:36:42.001Z","repository":{"id":292202953,"uuid":"978798190","full_name":"Freya135/Smart-Traffic-System","owner":"Freya135","description":"A Python-based system leveraging a Raspberry Pi to capture and process traffic images, dynamically control traffic lights and servo motors based on real-time vehicle detection using edge detection, and optimize traffic flow intelligently.","archived":false,"fork":false,"pushed_at":"2025-05-08T16:33:20.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T10:42:57.269Z","etag":null,"topics":["canny-edge-detection","gpiozero","image-processing","numpy","open-cv","python","raspberry-pi-5","real-time-processing","servo-motor","signal-duration","smart-traffic-light"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Freya135.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-06T14:21:49.000Z","updated_at":"2025-05-08T16:36:33.000Z","dependencies_parsed_at":"2025-05-08T17:41:47.452Z","dependency_job_id":"642cb991-cb97-4c3a-a471-4d10f7da2611","html_url":"https://github.com/Freya135/Smart-Traffic-System","commit_stats":null,"previous_names":["freya135/smart-traffic-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Freya135/Smart-Traffic-System","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freya135%2FSmart-Traffic-System","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freya135%2FSmart-Traffic-System/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freya135%2FSmart-Traffic-System/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freya135%2FSmart-Traffic-System/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Freya135","download_url":"https://codeload.github.com/Freya135/Smart-Traffic-System/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freya135%2FSmart-Traffic-System/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32420350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["canny-edge-detection","gpiozero","image-processing","numpy","open-cv","python","raspberry-pi-5","real-time-processing","servo-motor","signal-duration","smart-traffic-light"],"created_at":"2025-05-24T01:11:35.689Z","updated_at":"2026-04-29T09:36:41.992Z","avatar_url":"https://github.com/Freya135.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Smart Traffic Signal Controller using Raspberry Pi\n\nThis project is designed to automate traffic signal timing based on live image processing. It utilizes a Raspberry Pi, Pi Camera 2, and GPIO components to dynamically adjust the green light duration according to traffic conditions.\n\n## 🛠️ Project Structure\n\n| File | Description |\n|------|-------------|\n| `camera_capture.py` | Captures an image using the Pi Camera 2. |\n| `image_processing.py` | Processes the captured image using Canny Edge Detection to assess traffic density. |\n| `lights.py` | Sets the duration of the green signal based on processed image data. |\n| `lightspigpio.py` | Interfaces with GPIO pins using the `gpiozero` library to control the signal lights. |\n| `main.py` | Main script that orchestrates the full process from image capture to signal control. |\n| `references.py` | Captures and stores a reference image for background subtraction or comparison. |\n| `servomotor.py` | Controls a servo motor to rotate or move at specific time intervals. |\n| `__pycache__/` | Contains Python bytecode files (auto-generated). |\n\n## ⚙️ How It Works\n\n1. **Image Capture**: `camera_capture.py` triggers the Pi Camera to capture a real-time image of the traffic lane.\n2. **Image Analysis**: `image_processing.py` applies Canny Edge Detection to identify vehicles and estimate traffic density.\n3. **Signal Timing**: Based on the density, `lights.py` adjusts the green light duration dynamically.\n4. **Signal Control**: `lightspigpio.py` handles GPIO interactions to turn the traffic lights on or off.\n5. **Reference Image**: `references.py` allows capturing a reference image to help in differential analysis.\n6. **Servo Control**: `servomotor.py` manages timed servo operations (e.g., gate opening/closing).\n\n## 📦 Requirements\n\n- Raspberry Pi 5 (or any model with GPIO support)\n- Pi Camera 2\n- Traffic Light Modules\n- Servo Motor\n- Python 3.x\n- Libraries:\n  - `gpiozero`\n  - `opencv-python`\n  - `numpy`\n\nInstall Python dependencies:\n\n```bash\npip install gpiozero opencv-python numpy\n```\n\n## 🚀 Getting Started\n\n1. Connect your Pi Camera and traffic signal LEDs to GPIO pins.\n2. Run the main script:\n\n```bash\npython main.py\n```\n\n3. The system will:\n   - Capture an image.\n   - Analyze traffic density.\n   - Adjust green signal timing.\n   - Rotate servo motor (if applicable).\n\n## 🧠 Future Improvements\n\n- Integrate with cloud for data logging.\n- Add GUI to visualize traffic and timings.\n- Expand to multi-lane or multi-signal support.\n\n## ⚠️ Disclaimer\n\nEnsure safe practices when working with electronics and live environments. Use dummy loads during development.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreya135%2Fsmart-traffic-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreya135%2Fsmart-traffic-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreya135%2Fsmart-traffic-system/lists"}