Build a Person Tracking Drone Using Arduino UNO Q and YOLOv8n

A AGNIVESH
Author
Share
Person Tracking Drone Using Arduino UNO Q and YOLOv8n

A camera drone that follows a person usually carries a companion computer such as a Raspberry Pi for the vision model, plus a microcontroller for the time-critical jobs. Both add weight and heat, and both run off the battery that keeps the drone in the air. So, can one board do both jobs? The Arduino UNO Q has a Qualcomm processor running Linux and an STM32 microcontroller on the same PCB, and ARGUS is our attempt to find out.

Circuit Digest sponsored the Builder in Residence: Hardware Edition Hackathon in collaboration with TinkerSpace, Kochi. Supporting the next generation of hardware innovators, makers, and builders!

In this project, we built ARGUS, a quadcopter that carries an Arduino UNO Q and a USB webcam. The UNO Q finds people with a YOLOv8n model, gives each one a tracking ID and works out how the drone should move to follow the selected person, and the same code can read hand gestures once a pose model is loaded. The flight side is a standard Pixhawk quadcopter running PX4. The person-tracking drone flies under RC control with the camera on board, but its follow commands are only printed as JSON for now, as the link from the UNO Q to the Pixhawk is not built yet. You can also check out similar Raspberry Pi projects and drone projects done previously here at Circuit Digest.

What is a Person Tracking Drone?

ARGUS is a proof of concept for a drone that does its own computer vision on board. The work is split into separate features: person detection, tracking, following a selected person, gesture-mapped actions and Pixhawk-based flight control. The vision code is kept apart from the flight control, so it can be tested on the bench before it ever touches a drone, and any autonomous flight test should start tethered or caged. If you are new to YOLO, do check out our object detection on Raspberry Pi tutorial as well.

Arduino UNO Q or Raspberry Pi 5 for the Vision Code

The same Python code runs on both boards. We developed it on a Raspberry Pi 5 first and then moved it to the UNO Q, and the table below compares the two, with the frame rates we saw on each.

ParameterArduino UNO QRaspberry Pi 5
ProcessorQualcomm Dragonwing QRB2210, quad-core Cortex-A53Broadcom BCM2712, quad-core Cortex-A76
Real-time MCUSTM32U585 on the same boardNone, needs a separate MCU
Pipeline speed we sawAbout 0.9 FPSAbout 3.0 to 3.5 FPS

The Pi 5 was three to four times faster in our screenshots, though the two setups differ and this was not a controlled benchmark. If you are building this, get the code running on a Pi 5 first, as it is faster and easier to debug.

How Does the ARGUS Person-Tracking Drone Work?

The working is split into two halves. The flight half is a normal quadcopter: the LiPo feeds the Matek PDB-XT60, the PDB powers four ESCs, and the Pixhawk running PX4 drives them from the RC receiver input. On top of that, the UNO Q reads webcam frames, runs YOLOv8n on every second frame, tracks the people it finds, checks them for gestures and prints one JSON line with the flight intent. Below is the block diagram of the ARGUS person-tracking drone.

Block Diagram of Person Tracking Drone

The dashed line is the link that is not built yet; once it is in place, the intent will go to the Pixhawk over MAVLink. Until then, the drone is flown by hand, and the intent output is tested on the bench with the motors off. Here is another tutorial on connecting the LiteWing ESP32 drone to Betaflight, where a drone's flight controller is configured step by step.

Gesture-to-Action Mapping

S.NoGestureAction
1.Right hand upstart_follow
2.Left hand upstop_follow
3.Both hands upland

A gesture counts only after the same person holds it for 4 processed frames, and it is then ignored from that person for 2 seconds. Gestures also need a pose model, which the troubleshooting section explains.

Components Required for the Person Tracking Drone Using Arduino

Below is the list of components required to build this project.

Components Required for Person Tracking Drone
S.NoComponentDescriptionQuantity
1.Arduino UNO QOnboard vision computer1
2.Raspberry Pi 5For developing the vision code1
3.Raspberry Pi Camera Module TODO: versionCamera for the Pi stage1
4.USB 2.0 PC Webcam (generic)Onboard camera1
5.Powered USB Hub and Power BankConnect and power the webcam1 each
6.Pixhawk 2.4.8Flight controller running PX41
7.M10 GPS ModuleGPS for the Pixhawk1
8.Matek PDB-XT60Power distribution, 3S to 4S LiPo1
9.Electrolytic Capacitor TODO: valueOn the PDB battery leads2
10.ESC TODO: current ratingMotor driver4
11.A2212/13T 1000KV Brushless MotorThrust4
12.Propeller TODO: sizeOne per motor4
13.F450-Style Quadcopter FrameReady-made frame1
14.LiPo Battery TODO: cells and capacityFlight power1
15.RC Transmitter and Receiver TODO: modelManual control1 set

The UNO Q is the board that flies. The Pi 5 and its camera are only needed if you want to develop and test the vision code on a faster board first. The webcam goes through a powered USB hub with its own power bank, because that was the quickest way to get a camera on the drone with the parts we had. If you like to see more builds like this, check out our collection of Arduino projects.

Wiring Diagram of the Person Tracking Drone 

Below is the wiring diagram for the ARGUS drone.

Wiring Diagram of Person-Tracking Drone

The flight side follows the standard Pixhawk quadcopter layout. The LiPo plugs into the XT60 input of the PDB, and the four ESCs take their power from it. Each ESC drives one brushless motor, and the ESC signal leads go to MAIN OUT 1 to 4 on the Pixhawk in the PX4 Quadrotor X order. On the vision side, the webcam plugs into the powered USB hub and the hub into the UNO Q. There is no data link between the UNO Q and the Pixhawk yet. That is all about the wiring.

Person Tracking Drone Connection Table

FromToNote
LiPo batteryXT60 input of the Matek PDB-XT60Two electrolytic capacitors on the PDB battery leads
PDB battery padsPower leads of ESC 1 to 4Standard wiring, not confirmed in the logs
ESC 1 to 4Brushless motors 1 to 4Three wires each
ESC 1 to 4 signal leadsPixhawk MAIN OUT 1 to 4PX4 Quadrotor X order, check with the motor test
RC receiverPixhawk RC inputStandard wiring, receiver model not recorded
M10 GPS modulePixhawk GPS portStandard wiring for the Pixhawk 2.4.8
Pixhawk power inputTODO: power module or PDB 5V outputNot recorded
USB webcamPowered USB hub, then the UNO Q USB portPower bank feeds the hub
Arduino UNO Q powerTODO: UNO Q power source during flightNot recorded

Building the ARGUS Frame

The ARGUS that flies uses a ready-made F450-style quadcopter frame, and that is the frame we suggest. We first designed and printed our own frame, but we did not trust PLA arms with the loads and vibration of flight; the carbon-fibre-infused PETG we wanted was not available, and screws and fasteners were hard to find as well. So, we moved to a strong ready-made frame and strength-tested the parts we had replaced.

Optional: The 3D-Printed Frame

If you want to try a printed frame, below is the CAD model of ours from Fusion 360. The CAD files are not in the repository.

Person Tracking Drone Frame CAD Design

It has a 96 mm centre plate and a 182 mm bottom plate with four arms between them. Print one landing leg first and test its strength before printing the plates and arms. Below is the centre plate printing on a Bambu Lab printer.

3D Printing the Person Tracking Drone Centre Plate

Check your filament stock before you start. PLA went out of stock for us, and the alternative filament we tried gave extrusion problems and had to be cleaned out of the printer by hand. The image below shows one of the failed prints.

3D Printed Person Tracking Drone Frame with Motors

You can also check out our robotics projects for more mechanical builds.

Hardware Assembly of the Person Tracking Drone 

Below is the drone during assembly, with the Pixhawk, the ESC wiring and the motors on the frame.

Person Tracking Drone Hardware Assembly

Step 1⇒ Mount the Motors and ESCs

Fix the four A2212 motors to the arms and the ESCs alongside them, then connect each ESC to its motor with the three motor wires.

Step 2⇒ Wire the PDB with Its Capacitors

Solder the ESC power leads and the battery lead to the Matek PDB-XT60, and fit the electrolytic capacitors on the battery leads before connecting a battery. Below is our PDB, with two capacitors on its battery leads.

Matek PDB XT60 Power Distribution Board

Pixhawk Setup with PX4 and QGroundControl

Below are the flight controller setup steps that worked for us. We also tried ArduPilot with Mission Planner, but its calibration failed, so stay with PX4 and QGroundControl for this build.

Step 1⇒ Flash the PX4 Firmware

Connect the Pixhawk over USB, open QGroundControl and flash PX4 from Vehicle Setup > Firmware.

Step 2⇒ Calibrate the Sensors

Run the compass and accelerometer calibrations under Sensors. The accelerometer step asks for six orientations, one after another, and each box turns green once it is done. Below is our calibration run.

Step 3⇒ Calibrate the ESCs and Test Each Motor

Calibrate the ESCs, then take the propellers off and spin one motor at a time with the motor test. If the wrong motor spins, the ESC signal leads are on the wrong MAIN OUT pins; this is how we found ours in the wrong order. Below is the motor test after ESC calibration.

Step 4⇒ Run the Pre-Flight Checks

QGroundControl showed three warnings for our setup: low battery, no GPS and no safety switch. Do not ignore them to get airborne. Sort out the battery, GPS and safety-switch settings for your flight mode before arming.

USB Webcam Mounted on Person Tracking Drone

Setting Up the ARGUS Vision Code

The Python code needs Python 3.11 or newer with NumPy, ONNX Runtime and PyYAML. On Raspberry Pi OS, Picamera2 and OpenCV come from apt, so create the virtual environment with --system-site-packages, or it will not see them.

sudo apt install python3-picamera2 python3-opencv
git clone https://github.com/BuilderinResidencyTinkerspace/InfiniteInferno.git
cd InfiniteInferno/code
python3 -m venv --system-site-packages .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
Then start the pipeline. The settings for the model, camera, tracker, gestures and controller all live in configs/config.yaml.
python -m src.main --auto-follow --display

On the UNO Q, use the OpenCV camera path with the webcam's device, for example --camera opencv --source /dev/video2. Our UNO Q needed a reset before it responded, and the Pi code was adapted for it with AI-assisted conversion and then fixed by hand. We ran it there with a small web dashboard (dashboard.py) on port 8080, which is not in the repository yet. For another Raspberry Pi build with a USB camera, refer to our Raspberry Pi helmet detection project.

Command-Line Options

OptionWhat It Does
--camera opencv --source 0Uses a USB webcam or a video file in place of Picamera2
--target-id 1Follows one specific track ID
--auto-followLocks on to the largest person in the first frame with a confirmed track
--displayShows the annotated preview window (needs a desktop)
--max-frames 100Stops after 100 frames

--target-id and --auto-follow cannot be used together.

Testing ARGUS Before Flight

Test the vision side on its own before anything flies. First, run the smoke test from the code folder. It runs one blank frame through the model and prints the shapes; an output of [1, 84, 8400] means a detection model.

python scripts/pi_smoke_test.py

Next, run the unit tests. They cover the camera, detector, pre- and post-processing, tracker, gestures, controller and configuration. pytest is not in requirements.txt, so install it first.

python -m pip install pytest
python -m pytest

Then run the pipeline on the bench with --auto-follow --display --max-frames 100, step in front of the camera and check that the JSON lines switch from hover to follow. Keep the propellers off for every bench test, and fly the first flights by RC only, as the intents do not reach the Pixhawk yet.

ARGUS Vision Code Explanation

The vision code is split into small Python modules under code/src, one per stage, with the settings in configs/config.yaml. Below is the program workflow of src/main.py.

Person Tracking Drone Vision Pipeline Flowchart

Letterbox Preprocessing

scale = min(input_width / width, input_height / height)
resized_width, resized_height = max(1, round(width * scale)), max(1, round(height * scale))
...
canvas = np.full((input_height, input_width, 3), 114, dtype=np.uint8)
pad_x = (input_width - resized_width) // 2
pad_y = (input_height - resized_height) // 2
canvas[pad_y:pad_y + resized_height, pad_x:pad_x + resized_width] = resized
tensor = np.ascontiguousarray(canvas.transpose(2, 0, 1)[None], dtype=np.float32) / 255.0
return tensor, ImageTransform(scale, pad_x, pad_y, input_width, input_height, width, height)

The camera gives 640 x 480 frames, and the model wants 640 x 640. This function scales the frame without changing its aspect ratio and pads the rest with grey (114), which leaves an 80-pixel band at the top and bottom.

ONNX Runtime Session

options = ort.SessionOptions()
options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL
options.intra_op_num_threads = max(1, threads)
options.inter_op_num_threads = 1
session = ort.InferenceSession(str(path), sess_options=options, providers=["CPUExecutionProvider"])

This sets up ONNX Runtime on the CPU with all graph optimisations on and 4 threads, one per core on both boards. Inference runs on every second frame only (inference_stride: 2).

Decoding the YOLOv8 Output

for row in _rows(output):
   if row.size == 56:  # YOLOv8 pose: xywh, person score, 17*(x,y,confidence)
       score = float(row[4])
       keypoint_values = row[5:56]
   elif row.size >= 6:  # YOLOv8 detect: xywh followed by class scores
       class_scores = row[4:]
       class_id = int(np.argmax(class_scores))
       if class_id != 0:
           continue
       score = float(class_scores[class_id])
       keypoint_values = None

A detection model gives 84 values per candidate, four for the box and 80 class scores, and only class 0, person, is kept. A pose model gives 56: the box, a person score and 17 keypoints. Candidates under 0.45 confidence are dropped, and a greedy NMS at an IoU of 0.45 removes duplicates.

Matching Detections to Tracks

for track_id, track in self._tracks.items():
   for detection_index, detection in enumerate(detections):
       overlap = box_iou(track.box, detection.box)
       dcx = (detection.box[0] + detection.box[2]) / 2 - track.center[0]
       dcy = (detection.box[1] + detection.box[3]) / 2 - track.center[1]
       distance = hypot(dcx, dcy) / max(diagonal, 1.0)
       if overlap >= self.iou_threshold or distance <= self.max_center_distance:
           candidates.append((overlap - distance * 0.25, track_id, detection_index))

Every track is compared with every detection, and a pair counts as a candidate if the boxes overlap by 0.20 IoU or more, or the centres are within 0.18 of the frame diagonal. A track is confirmed after 2 hits and survives 12 missed frames, so a person hidden for a moment keeps the same ID.

Reading Hand Gestures from Keypoints

nose, left_shoulder, right_shoulder, left_wrist, right_wrist = points[[0, 5, 6, 9, 10]]
if min(nose[2], left_shoulder[2], right_shoulder[2]) < self.keypoint_threshold:
   return None
left_up = left_wrist[2] >= self.keypoint_threshold and left_wrist[1] < left_shoulder[1]
right_up = right_wrist[2] >= self.keypoint_threshold and right_wrist[1] < right_shoulder[1]
if left_up and right_up:
   return "both_hands_up"
if right_up:
   return "right_hand_up"
if left_up:
   return "left_hand_up"
return None

The gesture check uses five COCO keypoints: the nose, both shoulders and both wrists, each needing at least 0.35 confidence. A hand counts as raised when its wrist is higher in the image than the shoulder on that side, and both hands up wins over one.

Turning the Target Position into a Flight Intent

frame_width, frame_height = frame_size
cx, cy = target.center
error_x = (cx - frame_width / 2) / (frame_width / 2)
error_y = (frame_height / 2 - cy) / (frame_height / 2)
area = (target.box[2] - target.box[0]) * (target.box[3] - target.box[1])
area_ratio = area / max(1, frame_width * frame_height)
distance_error = (self.target_area_ratio - area_ratio) / self.target_area_ratio
yaw = 0.0 if abs(error_x) <= self.deadband_x else _clamp(error_x * self.max_yaw, self.max_yaw)
vertical = 0.0 if abs(error_y) <= self.deadband_y else _clamp(error_y * self.max_vertical, self.max_vertical)
forward = 0.0 if abs(distance_error) <= 0.1 else _clamp(distance_error * self.max_forward, self.max_forward)
return FlightIntent(yaw, forward, vertical, "follow", target.track_id, "target locked")

The controller measures how far the target's centre is from the middle of the frame, from -1 to 1, and uses the box area as a rough distance, aiming for the person to fill 18% of the frame. Errors inside the deadbands (0.08 yaw, 0.10 vertical) are ignored, and the outputs are clamped to ±0.35 yaw, ±0.30 forward and ±0.25 vertical. If the target drops out, the intent becomes a hover, marked target temporarily occluded for the first 0.75 seconds and target lost after that. Once a target is locked, nobody else's gestures count.

Live Video Demonstration

Below is the full ARGUS project demo that the team published on YouTube.

The drone also flew with the webcam on board while the UNO Q streamed its dashboard to a laptop, as shown below. The dashboard shows the onboard camera feed live at 0.9 FPS, with the action set to hover.

Output of the Person Tracking Drone

Below is the person-detection test on the Raspberry Pi 5.

Raspberry Pi 5 Person Detection Test

Each person gets a green box and a track ID, and the terminal prints one JSON line per processed frame. The fps field reads 3.0 to 3.5. No target was selected, so every line says hover. Below is the UNO Q version with its web dashboard.

Arduino UNO Q Drone Vision Dashboard

Track ID 2 is locked at 0.82 confidence, and the panel shows that frame's intent: yaw -0.112, forward 0.174 and vertical -0.09. YOLO runs at 0.89 FPS on the UNO Q here, which is the number to improve before these intents can steer a drone in flight. In addition to this drone, here is a collection of AI projects for reference.

Troubleshooting the Person Tracking Drone

SymptomLikely CauseFix
Gestures never triggerThe bundled yolov8n.onnx is a
detection model with no keypoints
Use a YOLOv8 pose model, or pick the target
with --auto-follow or --target-id
"Picamera2 is unavailable" Picamera2 missing, or the venv
cannot see apt packages
Install python3-picamera2 and use --systemsite-packages, or run with --camera opencv
"Camera/video stream ended" on the UNO QWrong /dev/video index, or the USB hub losing powerCheck ls /dev/video* and pass the device with --source (ours was /dev/video2)
Wrong motor spins in the motor testESC signal leads on the wrong
MAIN OUT pins
Rewire to the PX4 Quadrotor X order and
test again
PDB burns out on the first
power-up
No capacitor on the PDBFit a suitable capacitor before connecting the
battery
Calibration fails in Mission
Planner
ArduPilot calibration did not work on our boardFlash PX4 and calibrate in QGroundControl

Conclusion

The Arduino UNO Q can run the whole person-detection and tracking pipeline, and the drone has flown with the UNO Q and camera on board. At 0.89 FPS, though, it is too slow to steer the drone, and the intents do not reach the Pixhawk yet, so ARGUS is flown by hand for now. There is still room for improvement, such as a camera module wired straight to the UNO Q, power from the PDB through a regulator into its VIN pin, a MAVLink connection to the Pixhawk and faster inference. Further, one can extend this project to track objects in flight, just like this ESP32 drone with object tracking using LiteWing on Circuit Digest.

GitHub Repository

The vision code, configuration, YOLOv8n model files, unit tests and build logs for ARGUS are all in the InfiniteInferno repository. ARGUS was built at Tinkerspace as part of Builder in Residence; the logs credit the work to Agnivesh, Amrutha and Abhinand, and the code is released under the MIT licence.

Person Tracking Drone GitHub RepoPerson Tracking Drone Zip File

Frequently Asked Questions About the Person Tracking Drone

⇥ 1. Does ARGUS follow a person on its own right now?
No. The vision code works out the follow commands and prints them as JSON, but nothing sends them to the Pixhawk yet, and the flights so far were flown with the RC transmitter.

⇥ 2. Why do the hand gestures not work with the default model?
The yolov8n.onnx in the repository is a detection model, so it gives boxes but no body keypoints. Export a pose model with yolo export model=yolov8n-pose.pt format=onnx imgsz=640 from the Ultralytics package and point model.path at it; the post-processing already reads the 56-value pose output.

⇥ 3. Why use the UNO Q when the Pi 5 is faster?
Its STM32 microcontroller is on the same board as the Qualcomm processor, so one board could cover both the vision work and the real-time jobs that a Pi needs a second microcontroller for. That should make the drone lighter and cooler, but we have not measured it yet.

Similar DIY Drone Projects Using ESP32 and LiteWing

Explore innovative drone projects built around the ESP32-powered LiteWing platform, featuring wireless loudspeaker integration, voice-controlled flight, and hand gesture-based navigation. These projects demonstrate how ESP32, Python, sensors, and wireless communication can enhance drone functionality.

LiteWing ESP32 Drone for Wireless Audio Announcement

LiteWing ESP32 Drone for Wireless Audio Announcement

In this project, we upgraded LiteWing, an ESP32-based development drone, by adding a lightweight Bluetooth speaker system to extend its capabilities beyond flight.

 ESP32 Voice Controlled Drone with LiteWing

ESP32 Voice-Controlled Drone with LiteWing

This ESP32 drone voice control project is designed to be practical and approachable, whether you are a student exploring drone programming, a maker experimenting with speech interfaces, or an engineer evaluating human–machine interaction for embedded systems.

Gesture Control Drone with LiteWing and ESP32

Gesture Control Drone with LiteWing and ESP32

In this article, we'll show you how to build a gesture-controlled drone. To do this, we will obviously need a drone, which in our case is a LiteWing Drone, and to control this drone we will use an ESP32 dev module along with an MPU6050, both of which are strapped to our hand. 

Have any question related to this Article?

Add a comment

No account needed. Your comment appears once a moderator has reviewed it.

Never shown publicly.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.