Vision‑Based Obstacle‑Avoiding Mobile Robot on Raspberry Pi
Abstract
This report presents the design and implementation of a low‑cost mobile robot that uses computer vision to detect and avoid obstacles. Powered by a Raspberry Pi and a USB webcam, the system demonstrates how inexpensive hardware can enable autonomous navigation in indoor environments, such as warehouses, without human operators.
Introduction
Commercial autonomous robots are often expensive and tailored for a single environment, relying on passive sensors like ultrasonic or infrared modules for collision avoidance (Wang et al., 2011). Recent advances in embedded computing allow the use of high‑performance vision algorithms on inexpensive platforms. A vision‑based approach can detect obstacles well before they come into close proximity, offering a more robust solution for indoor navigation.
Proposed Solution & Artefact
The goal is to build an autonomous robot that detects obstacles through a USB webcam connected to a Raspberry Pi. The development process involved:
- Designing a computer‑vision algorithm with SimpleCV to identify obstacles.
- Porting the algorithm to the Raspberry Pi.
- Implementing DC‑motor control via Python GPIO.
- Testing and evaluating system performance on the Pi.
Key objectives were achieved:
- Detection range adjustable through algorithm parameters.
- Obstacles marked with a constant‑size circle for easy identification.
- SimpleCV interfaces with the Pi to command two DC motors.
- System performance validated at various obstacle distances.
Hardware and Software Stack
Hardware
- Raspberry Pi Kit
- USB webcam
- Two DC motors
- H‑Bridge motor driver
- Chassis and wiring
- Breadboard and cables
Software
- SimpleCV Python library
- Ubuntu / Raspberry OS (Raspbian)
- Python 2.7
Computer‑Vision Algorithm Overview
The algorithm was first developed on an Ubuntu laptop and later ported to the Pi, leveraging Linux compatibility. It identifies a circular marker placed on obstacles, binarises the image to isolate the shape, and calculates its radius to estimate distance. The screen is divided into three vertical zones; the circle’s horizontal position determines the robot’s steering action.
Because the Raspberry Pi’s 700 MHz processor and 512 MB RAM limit high‑resolution processing, a 320×240 resolution was chosen to balance detection accuracy and frame‑rate stability.
Experimental Setup
An experimental rig measured the relationship between the circle’s pixel area and its physical distance from the robot. By moving the obstacle closer or farther, the algorithm’s pixel‑to‑distance mapping was calibrated, enabling accurate distance estimation from a single camera view.
System Flowchart
In the operational flow, the USB webcam streams frames to the Pi. SimpleCV scans each frame for the circular marker. Upon detection, the Pi calculates the marker’s position, then actuates the H‑Bridge to drive the motors left, right, or forward accordingly.
Conclusion
The project demonstrates that a Raspberry Pi, a USB webcam, and SimpleCV can form a viable, cost‑effective obstacle‑avoidance system suitable for indoor robotics applications. Future work could extend the algorithm to detect unmarked obstacles and integrate sensor fusion for enhanced reliability.
Manufacturing process
- gatoBot: Raspberry Pi Zero W Web‑Controlled Robot with Live Video Streaming
- AI-Powered Obstacle Avoidance System with Arduino and Ultrasonic Sensors
- UV Disinfection Robot Powered by Arduino Mega: Remote‑Controlled Germicidal System
- Servo‑Driven Obstacle‑Avoiding Robot: Build with Arduino & HC‑SR04
- Bluetooth‑Controlled Obstacle‑Avoidance Robot: Build a Smart, Remote‑Operated Vehicle
- Build Your Own AI Assistant Robot Using Arduino & Python
- Arduino‑Powered Robot Arm with Custom Controller – Servo & Potentiometer Build
- KUKA KMR iiwa: Mobile Collaborative Robot Arm for Industry 4.0
- Revolutionizing Automotive Production with Advanced Robot Vision
- Enhancing Manufacturing Efficiency with Vision-Integrated Robotics