AI-Powered Pothole Detection System with Raspberry Pi and Computer Vision

Real-Time Road Hazard Detection with Raspberry Pi, Pi Camera, Roboflow ML Model, Docker Inference Server, and Audible Alert System

Category: Embedded Systems, AI/ML, Computer Vision, Road Safety
Tools & Technologies: Raspberry Pi, Pi Camera (Picamera2), Roboflow AI (pothole-voxrl model), Docker (ARM inference server), OpenCV, Python, 20x4 I2C LCD, Buzzer, Push Button, Arduino IDE

Status: Completed

Introduction

This project implements an AI-powered pothole detection system using a Raspberry Pi with a camera module for real-time road surface analysis. The system captures continuous video frames and processes them through a Roboflow machine learning model running on a local Docker inference server. When potholes are detected with confidence levels at or above 65%, the system triggers a buzzer alarm and displays detection status on a 20x4 LCD. The Roboflow model annotates detected potholes with bounding boxes and confidence scores on the video feed. A physical push button provides a graceful shutdown mechanism. This solution demonstrates the integration of edge AI with embedded systems for practical road safety applications.

System Overview System Overview


Aim and Objectives

Aim:
Design and develop an edge AI pothole detection system using Raspberry Pi and computer vision for real-time road hazard identification and alerting.

Objectives:

  • Capture real-time video frames using Pi Camera with Picamera2 library at 480×320 resolution.
  • Detect potholes using Roboflow ML model inference running on a local Docker container.
  • Annotate detected potholes with bounding boxes and confidence scores on the video feed.
  • Trigger buzzer alarm when detection confidence reaches or exceeds 65%.
  • Display detection status and confidence percentage on a 20x4 I2C LCD.
  • Monitor internet connectivity for model availability with status LED indication.

Features & Deliverables

  • AI Pothole Detection: Roboflow ML model identifies potholes in real-time camera feed with confidence scoring.
  • Edge Inference: Docker-containerized inference server runs locally on Raspberry Pi ARM CPU.
  • Visual Annotations: Bounding boxes and confidence percentages overlaid on detected potholes in video.
  • Audible Alert: Buzzer alarm activates when pothole confidence ≥ 65% for driver/rider notification.
  • LCD Status Display: 20x4 LCD shows detection state and confidence percentage in real-time.
  • WiFi Status Monitoring: Periodic connectivity checks with LED indicator for internet/model availability.
  • Physical Controls: Push button for graceful program termination.
  • FPS Monitoring: Real-time frame rate tracking for performance analysis.

Process / Methodology

Hardware Assembly

Components: Raspberry Pi, Pi Camera Module, 20x4 I2C LCD, Buzzer, WiFi LED, Push Button.

  • Connected Pi Camera via CSI interface for low-latency video capture.
  • Wired I2C LCD display for detection status output.
  • Integrated GPIO-connected buzzer, WiFi LED, and push button for control interface.

Software Development

  • Deployed Roboflow inference server as a Docker container (ARM CPU variant) on port 9001.
  • Developed Python application using Picamera2, OpenCV, and Roboflow SDK for frame capture and inference.
  • Implemented bounding box rendering with confidence labels using OpenCV drawing functions.
  • Created GPIO-based alert system with buzzer threshold logic and LCD updates.
  • Added internet connectivity monitoring with 30-second periodic checks.

Testing & Calibration

  • Validated detection accuracy against known pothole images and real road conditions.
  • Tuned confidence threshold (65%) to balance sensitivity and false positive rate.
  • Measured inference latency and frame rate on Raspberry Pi hardware.

Challenges & Solutions

  • Challenge: ML inference speed on Raspberry Pi ARM CPU limiting frame rate.
    Solution: Reduced capture resolution to 480×320 and used Docker-optimized inference server for ARM.
  • Challenge: False positives from shadows, puddles, and road markings.
    Solution: Set confidence threshold at 65% and used a well-trained Roboflow model for disambiguation.
  • Challenge: Model requiring internet for initial download but needing offline operation.
    Solution: Cached model locally after first download; system checks connectivity at startup only.

Results & Impact

  • Real-Time Detection: Successfully identified potholes in live camera feed with bounding box annotations.
  • Timely Alerts: Buzzer alarm provided immediate notification upon pothole detection above threshold.
  • Edge AI Feasibility: Demonstrated practical ML inference on low-cost Raspberry Pi hardware.
  • Road Safety: System showed potential for vehicle-mounted deployment to improve driver awareness.

Future Enhancements

  • Add GPS module for geotagging detected potholes and building a road hazard map.
  • Implement cloud data upload for municipal road maintenance reporting.
  • Upgrade to Raspberry Pi 5 or use Coral TPU for faster inference speeds.
  • Add night vision camera for low-light pothole detection.

Demonstration / Access

  • GitHub Repository: Coming soon
  • Live Demonstration Video: Coming soon

Thank You for Visiting My Portfolio

I sincerely appreciate you taking the time to explore my portfolio and learn about my work and expertise. If you have any questions or wish to discuss potential collaborations, please feel free to reach out via the Contact section.

Best regards,
Damilare Lekan, Adekeye.