← Engineering projects

Robotics / Embedded vision

Vision
tracking robot.

A robot that could find a person, follow them, and keep its distance.

I built a four-wheel robot that paired camera-based human tracking with independent distance sensing. A Raspberry Pi 5 handled perception; an STM32 handled the motors.

MobileNet-SSDRaspberry Pi 5STM32PID control
Completed four-wheel tracking robot with a foliage-covered enclosure
01 / Finished buildView photo ↗
VisionMobileNet-SSDPerson detection
ComputeRaspberry Pi 5Camera + range processing
MotionSTM32Embedded motor control
Demo conditionLive trackingWith a 2-second stationary-person dwell

Live demo

The robot in action.

A video I made of the build in action.

Watch on YouTube ↗

The build

Getting the whole robot to work together.

The goal was to detect a person, keep them centered in the camera view, and maintain a set distance as they moved. I used the Pi Camera 3 for visual input and a time-of-flight sensor for distance feedback, then connected that information to the drivetrain through the STM32.

The demonstration also had a mechanical response: after the person stopped for two seconds, a flywheel mechanism launched foam balls. That made the project about more than following a bounding box—it also involved coordinating perception, movement, and a timed behavior.

Uncovered tracking robot showing the stacked chassis, electronics, front camera, and mechanism
02 / Under the outer enclosure
Early blue-chassis robot prototype with camera, distance sensor, battery, and electronics on a lab bench
03 / Early hardware integration on the bench

System architecture

Two processors. Different jobs.

I separated the camera and sensor processing from the physical motor-control layer. The Pi interpreted what the robot was seeing; the STM32 operated the drivetrain and mechanism.

  1. 01 / Inputs

    Camera + distance

    Pi Camera 3 over its ribbon connection.
    VL53L1X ToF sensor over I²C.

  2. 02 / Perception

    Raspberry Pi 5

    Human detection, tracking information, and interpretation of range measurements.

  3. 03 / Handoff

    UART

    Target presence, horizontal error, distance, measurement quality, and command information.

  4. 04 / Physical response

    STM32

    Motor-control outputs through the driver boards, plus coordination of the demo mechanism.

The project presentation identifies TB6612FNG motor drivers in the STM32 subsystem. The diagrams below are the original presentation artifacts, not a verified wiring guide.

Computer vision

The neural network was MobileNet-SSD.

My presentation lists Detector.py → MobileNet-SSD. This was the person-detection part of the system: camera frames went through the detector, and the detected person's bounding box supplied position information for tracking.

MobileNet is a lightweight convolutional neural-network architecture designed for mobile and embedded vision. SSD stands for Single Shot MultiBox Detector; it predicts object categories and bounding boxes in one network pass. Together, they provide a compact object-detection approach.

Background: original MobileNets paper ↗ · original SSD paper ↗

Program Function presentation slide listing Detector.py with MobileNet-SSD, Tracker.py, Tof_sensor.py, and Main.py beside the bounding-box demo
The original detector/module list and tracking preview. Open to inspect ↗
Detector.pyMobileNet-SSD detection
Tracker.pyTracking layer
Tof_sensor.pyTime-of-flight sensing
Main.pyProgram coordination

Feedback & behavior

Seeing a person was only the start.

Visual feedback

Center the person

The horizontal offset of the detected person's bounding box from the center of the camera view supplied a centering error. As the person moved across the frame, that error supplied the information needed to correct the robot's heading.

Distance feedback

Maintain separation

The ToF sensor added a direct distance measurement. It let the robot maintain a following distance using range feedback, instead of treating the size of a person's image as a distance measurement.

Motor response

PID control

I used PID control to adjust motor response as the tracking error changed. The STM32 operated the motors while the Pi handled the camera and sensor processing. Getting turning corrections to behave well was part of joining those two layers.

What took work

The integration problems were the project.

01

Power for the Pi

The Pi 5 needed more current than expected during integration. I used external power for the Pi, making power distribution a separate problem from controlling the motors.

02

UART pin configuration

Only certain STM32 pins could be configured for the required UART connection. The communication link had to fit the board's available peripheral configuration.

03

Detection within a compute budget

Tracking needed to be accurate and robust without becoming too computationally demanding. Running the vision work on the Pi made that tradeoff part of the system design.

04

Range alignment and stale readings

The ToF sensor was not always aligned with the person seen by the camera. The presentation also records stale readings on poorly reflective surfaces—finding a person in an image did not automatically mean getting a useful range measurement.

Project documentation

From the original presentation.

Expand a slide, then select it to view the full-size image.

Raspberry Pi subsystem Camera · I²C · UARTOriginal Raspberry Pi subsystem diagram showing Pi Camera 3 and TOF400C VL53L1X connected to Raspberry Pi 5 and a UART link to STM32
STM32 subsystem Drivers · Motors · ServoOriginal STM32 subsystem presentation diagram showing UART input and motor-driver and servo outputs
Technical challenges Power · Communication · SensingOriginal technical-challenges slide describing power, UART configuration, human-tracking compute requirements, and ToF alignment alongside a robot CAD rendering