# Auto-Following Robot

> Jetson Nano + YOLOv8 real-time person tracking driving a repurposed FRC chassis via Arduino and an H-bridge motor driver. Won an Excellence Award (Power Mechanical category) at the 2024 national vocational project competition.

- Result: 2024 National Special Projects Competition — Excellence Award
- Stack: Python, Jetson Nano, YOLOv8, OpenCV, Arduino

The competition entry was "Little Follower (a following tool cart)": a Jetson Nano runs YOLOv8 real-time tracking to recognise a person and signals an Arduino over GPIO, which drives an FRC AM14U5 chassis with CIM motors through a BTS-7960 motor driver to follow the target. The idea came from car repair shops, where tool carts are pushed by hand and cause safety risks. It won an Excellence Award in the Power Mechanical category of the 2024 national vocational high school project and creativity competition.

## Problem

Tool carts in car repair shops are mostly pushed by hand, so mechanics move the cart while carrying tools — a safety risk. The goal of this project was a tool cart that follows the mechanic on its own (the competition entry was called "Little Follower").

## Key decisions

1. **Split detection and control across two boards**: The Jetson Nano runs YOLOv8 to "see" and only tells the Arduino forward, back or stop through high/low GPIO levels; the Arduino drives the motors with PWM. The interface between them is just a few signal wires, which keeps debugging simple.
2. **Judge distance from the height of the bounding box**: A box smaller than the preset means the person has walked away, so move forward; larger means too close, so back up — no extra distance sensor needed.
3. **Reuse an FRC AM14U5 chassis and CIM motors**: A ready-made, competition-proven chassis let the time go into detection and control instead.
4. **Add a physical stop button**: Whatever the software is doing, pressing it cuts the chassis motion.

## Trade-offs

- The motor controller took three tries: the Spark SPX's PWM wasn't compatible with the Arduino → the L298N couldn't supply enough current for the chassis motors → finally the BTS-7960 (up to 43 A)
- The control logic has only three states — forward, back and stop — and distance comes only from one camera's bounding-box height

## Results

- Excellence Award, Power Mechanical category, 2024 (ROC year 112) national vocational high school project and creativity competition

## Architecture

```mermaid
flowchart TD
  C["Logitech C270<br/>camera"] --> J["Jetson Nano<br/>YOLOv8 tracking"]
  J -->|"box height H"| G["GPIO output<br/>high / low"]
  G --> A["Arduino UNO"]
  A -->|"PWM signal"| M["BTS-7960<br/>motor driver"]
  M --> D["AM0255 CIM motors<br/>+ AM14U5 chassis"]
  A -.stop button.-> S["Stop"]
```

## Components

- Jetson Nano 4GB + Logitech C270 (720p): the real-time vision compute and camera
- YOLOv8 (trained with Ultralytics, dataset built in Roboflow) + OpenCV: detection and tracking, outputting bounding-box height, count and confidence
- Arduino UNO + BTS-7960 motor driver (up to 43 A): reads the GPIO signals and drives the chassis with PWM
- Chassis reused from FRC: AndyMark AM14U5 six-wheel chassis + AM0255 2.5-inch CIM motors (5,310 RPM free speed) + 6-inch HiGrip wheels

## Detection & Control

- YOLOv8 keeps tracking the person in frame and outputs the bounding-box height H
- After comparing H with a preset X, the Jetson Nano outputs a high or low GPIO level to the Arduino
- The Arduino reads the level — high means forward, low means back, no signal means stop — and sets the chassis speed with PWM
- A separate physical stop button cuts the chassis motion when pressed

## Fabrication

- The upper storage frame was made by hand from angle steel and steel plate — cut, drilled and spot-welded — with three levels for tools, parts and an air compressor
- The motor controller went through three iterations: Spark SPX (PWM incompatible with the Arduino) → L298N (not enough current for the chassis motors) → BTS-7960 in the end

> This is a physical hardware competition project with no public code repository; the technical details come from the competition entry's write-up.

---

Author: PINGWEI LI (李秉威, Li Ping-Wei)
Original page: https://kbs0830.com/en/projects/auto-following-robot
