Auto-Targeting Drone

Source Code (Click here)

Here, I will talk about a drone I made for a school project. The original goal for this drone was to fly around and shoot a nerf dart at certain targets. Due to time and legal constraints, the final product ended up rotating on a swivel, rather than actually taking flight.

Below is the video overview that my team made. Skip to the end to see the actual demo.




Design

On the hardware side, drone designs are relatively straightforward. The motors are three-phase motors which receive signals from the Electronic Speed Controllers (ESCs). The ESC itself connects directly to the drone's battery and receives a Dshot signal from the flight controller.

The flight controller is responsible for the low-level control of the hardware on the drone. It gathers data from the various sensors such as the barometer, gyroscope, accelerometer, and GPS. It is responsible for telling the ESC how to spin the motors.

We also used a Raspberry Pi Zero with a camera to track objects. The Pi Zero will then tell the flight controller where to move using a protocol called MAVLink. When the red object is aligned with the center of the drone, the Pi Zero's GPIO pins will rotate a stepper motor, which will trigger the spring-loaded launching mechanism.

Here is a picture of the full design diagram. Below that is some information about the protocols.

Design Diagram

Subsystem 1: Raspberry Pi

Name I/O/Comm Description Use
USB Comm Communication with camera and flight controller. Camera: Receive video data from camera
Flight Controller: Receive status commands and issue movement commands
GPIO Output Stepper motor control. Rotate stepper motor for firing mechanism. Stepper motor setup

Subsystem 2: Flight Controller

Name I/O/Comm Description Use
Dshot300 Comm Communication with ESC. Issue motor control commands to ESC.
UART Input Communicate with GPS. Not used in final design.
Bill Of Materials
Part Notes Link Cost
Frame This frame is really cheap, and not very good. YoungRC F450 Drone Frame Kit $21.89
Electronic Speed Controllers (ESCs) ESCs connect motors to battery and controller Radiolink FLYCOLOR 55A ESC 4 in 1 Department bought for us
Motors 4 pack Brushless Motors Department bought for us
Propellers 6 pack Readytosky 1045 Propellers $16.99
Batteries 2PCS 11.1V 3000mAh 15C 3S T-Plug Li-ion Battery Battery Link $27.19
Flight Controller (NxtPX4v2) ArduPilot Page $70
Raspberry Pi Zero W Does the CV and stuff Borrowed
Micro SD Card 128 GB; attaches to RPi Amazon Basics microSDXC Borrowed
Camera Cheapest camera I could find; connects to Raspberry Pi. Arducam Camera $6.99
JST Connector Kit ESC and FC wires do not match properly, so we need to make our own connections. The one linked might not be the same one we used, but it's close enough. Kit $17.39
GPS For position tracking HGLRC GPS $18.99