Target Tracking
Overview
Section titled “Overview”Now that you have learned how to install a camera on the drone and experience first-person view, let’s make it smarter! In this project you will learn how to make the drone automatically track a red ball, becoming your “tagalong” and experiencing smarter flight features.
What You’ll Learn
Section titled “What You’ll Learn”- The basics of color recognition
- Target tracking algorithms
- Automatic flight control
- Intelligent flight modes
Materials Needed
Section titled “Materials Needed”| Item | Quantity | Notes |
|---|---|---|
| Drone with camera installed | 1 | The drone built in Project 04 |
| Red ball | 1 | 10 cm diameter, used as the tracking target |
| USB cable | 1 | For firmware flashing |
| Computer | 1 | For downloading and flashing firmware |
Step 1: Flash the Tracking Firmware
Section titled “Step 1: Flash the Tracking Firmware”1.1 Download the tracking firmware
Section titled “1.1 Download the tracking firmware”- Go to the resource download page and download
track_ball.binto your desktop
1.2 Flash the firmware
Section titled “1.2 Flash the firmware”- Hold down the “BOOT” button on the ESP32 board while plugging the USB cable into the computer
- Open
flash_tool.exeand select thetrack_ball.binfile - Click “Flash” and wait for the process to complete (about 10 seconds)
- After the tool shows “Flash successful”, unplug the USB cable
Step 2: Test the Tracking Feature
Section titled “Step 2: Test the Tracking Feature”2.1 Preparation
Section titled “2.1 Preparation”- Turn on the drone power (the lithium battery switch)
- Connect your phone to the drone’s Wi-Fi
- Open the
Drone Controlapp
2.2 Start the tracking mode
Section titled “2.2 Start the tracking mode”- Tap the “Tracking mode” button in the app
- The drone enters tracking mode and the camera starts looking for a red target
2.3 Test tracking
Section titled “2.3 Test tracking”- Hold the red ball and move it around in front of the drone
- Watch whether the drone follows the red ball!
- Try different speeds and directions to test the tracking effect
Step 3: Challenge Tasks
Section titled “Step 3: Challenge Tasks”3.1 Guiding-the-drone challenge
Section titled “3.1 Guiding-the-drone challenge”- Use the red ball to guide the drone around a table
- See whether it follows you
- Practice controlling the speed of the red ball so the drone keeps an appropriate distance
3.2 Multi-person interaction challenge
Section titled “3.2 Multi-person interaction challenge”- Invite a friend to join in
- Take turns holding the red ball to guide the drone
- See who can keep the drone following for the longest time
Troubleshooting
Section titled “Troubleshooting”Poor tracking
Section titled “Poor tracking”- Make sure the red ball is bright and contrasts well with the background
- Avoid testing in very bright or very dark environments
- Keep the red ball within the camera’s field of view
Drone reacts slowly
Section titled “Drone reacts slowly”- Check that the battery is sufficiently charged
- Make sure the camera is clean and unobstructed
- Try adjusting the flight speed setting
Achievement
Section titled “Achievement”Congratulations! Your drone has become your tagalong! By learning color recognition and target tracking, you have made your drone much smarter. It can recognize and track a red ball and follow your movements — this is a really fun feature.
Next Steps
Section titled “Next Steps”In the next project, you will learn how to use two drones to form a team and fly together, experiencing the fun of multi-drone formation.