This repository contains all configuration and notebook resources needed to reproduce my PiCar-X v2 autonomous driving project on the Raspberry Pi 5.
- config/ — Raspberry Pi 5 boot configuration (
config.txt
) - notebooks/ — Jupyter analysis notebook (
main.ipynb
) - requirements.txt — Python dependencies
- .gitignore — ignore rules for venv, outputs, caches
- README.md — this file
- SunFounder PiCar-X v2 assembled per vendor instructions
- Raspberry Pi 5 running Raspberry Pi OS (64-bit)
- IMX708 camera upgrade on CSI-1 ribbon cable (see note below)
- Network via Wi-Fi, with SSH access
Hardware Note:
- Camera Vendor & Model: Arducam B0312 (12 MP IMX708 Autofocus Camera Module 3 with HDR & PDAF)
- Interface: 22-pin, 0.5 mm-pitch MIPI-CSI connector on both Pi 5 and camera board
- Cable Used: Straight-through 22-way 0.5 mm-pitch FFC (e.g. 300 mm B-to-B)
- Copy
config/config.txt
into the Pi’s boot folder (/boot/firmware/config.txt
on 64-bit OS or/boot/config.txt
on 32-bit). - Ensure it defines your overlays:
dtoverlay=vc4-kms-v3d max_framebuffers=2 dtoverlay=imx708,cam1 dtoverlay=bcm2835-v4l2
- Reboot:
sudo reboot
- Clone this repo:
git clone [email protected]:brucesdad13/autonomous-picar-x.git cd autonomous-picar-x
- Install system packages:
sudo apt update sudo apt install -y python3-picamera2 libcap-dev v4l-utils
- Create & activate the virtual environment:
python3 -m venv --system-site-packages .venv source .venv/bin/activate
- Install Python dependencies:
pip install --upgrade pip pip install -r requirements.txt # (in your activated venv)
- Register the Jupyter kernel:
python3 -m ipykernel install --user \ --name picar-env \ --display-name "PiCar .venv (Python 3.x)"
- In VS Code, connect via Remote-SSH to the Pi
- Open
notebooks/main.ipynb
- Select PiCar .venv (Python 3.x) as the kernel
- Run through the cells to capture frames, preprocess, and explore computer-vision methods.
Notebook Note:
We useipywidgets
sliders innotebooks/main.ipynb
to interactively tune HSV thresholds.
- Flash Raspberry Pi OS and assemble PiCar-X
- SSH into Pi, clone this repo
- Copy
config/config.txt
, install system packages - Create venv & install Python deps
- Open the notebook and run cells
All necessary configuration and code are included here—ready to run on any fresh PiCar-X setup.
The robot uses SunFounder's car engine and horn sounds during startup and lost mode. These sounds are licensed under GPLv2 and are not included in this repository to maintain MIT license compatibility.
To download them manually:
cd sounds
sh get_sounds.sh
-
Sunfounder. 2023. PiCar-X User Manual. Available at: https://docs.sunfounder.com/projects/picar-x/en/latest/
-
Raspberry Pi Ltd. 2024. Picamera2 Library Manual. Available at: https://datasheets.raspberrypi.com/camera/picamera2-manual.pdf
-
Greg V. Klimov, Samuel L. Kwok, Cole R. Manning, Mason V. Powell, Sam P. Rowe, and Adam Yang. 2023. Remote-Controlled Mixed Reality Driving Experience. Major Qualifying Project Report, Worcester Polytechnic Institute. Available at: https://digital.wpi.edu/concern/student_works/70795c11v
-
OpenCV Developers. 2019. Changing Colorspaces. Available at: https://docs.opencv.org/3.4/df/d9d/tutorial_py_colorspaces.html
-
Mueller, John Paul. 2021. Python All-in-One For Dummies (2nd Edition). Wiley. ISBN: 9781119787600. Includes chapters on OpenCV and robotics with HSV color tracking.
-
Daniel Hernandez-Vitela. 2019. Path Planning and Tracking for Autonomous Cars. Available at: http://eureka-csep.cnsi.ucsb.edu/scholars/hernandez-vitela
This project is released under the MIT License. See LICENSE
for details.