Turn Any Drone Into a Delivery DronešŸ“¦

by Iloke Alusala in Circuits > Microcontrollers

466 Views, 8 Favorites, 0 Comments

Turn Any Drone Into a Delivery DronešŸ“¦

Turn ANY Drone into a Delivery Drone.png
Drone_Flying.jpg
Drop_vid_2.gif

We're living in a new era where everything is evolving at a rate that humanity has never seen before, and because of this, everyone is chasing the next BIG thing. With companies like Amazon, Zipline, UPS and the like investing heavily on the future of parcel delivery, delivery drones, it makes it seem out of reach for a normal person like you and I to ever get their hands on one šŸ˜¢.

But, let's say that we change that šŸ’”. Today I'll show you how you can turn any drone into a Delivery Drone šŸ“¦

Supplies

For this project, the only pre-built thing that you should have on hand is a drone which you have access to it's Flight Controller (FC). The entire build of the drone is outside the scope of this project, but there's so many sources online to build a drone that you won't struggle to find the help that you need. Alternatively you could just buy a droneā€ ā€

Here's a list of what you'll need to build your delivery drone :

Software:

  1. Ultimaker Cura (or any other slicer)
  2. Betaflight Configurator
  3. Fusion 360 (eligible students, educators, and qualifying educational institutions should have free access to it) (optional)

Equipment:

Supplies Image

  1. Access to a 3D printer (if you don't have your own, check with your local library, or college. I used one at a makerspace at my University)
  2. PLA Filament (any colour is fine, I chose White)

Supplies:

  1. Soldering Iron
  2. Soldering Wire
  3. Wire Strippers
  4. Electrical Wires (Male - Male)
  5. Multimeter (One that has a continuity tester on it)
  6. Precision Screwdriver Set
  7. Electrical Tape
  8. Pliers
  9. Zip-ties

Components:

  1. Flight Controller (Compatible with betaflight)
  2. DC Gear Motor
  3. ESP32 Firebeetle 2
  4. DC-DC Buck Converter 7-24V to 5V
  5. ELRS-Nano Receiver (any receiver using an ELRS protocol)

The Idea

The plan of execution for this project can be divided into two main categories:

  1. Electronics ā€“ How do we communicate with the drone to trigger the drop?
  2. 3D Design and Printing ā€“ What components can be used to facilitate the drop mechanism?

Now, to build the delivery drone, we need to follow a couple of steps, but the key question is what those steps actually are... But with all problem solving, we just need to ask ourselves a couple of questions that will guide us in the quest to turn our drone into a delivery droneāš”ļø.

Electronics

You: "How will the drone know when to drop the package?" šŸ¤”šŸ’­

Me: "Weā€™ll need to tell it when!ā˜ļøšŸ¤“"

You: "šŸ§ā€ā™‚ļø Obviously, dude. But how do we actually do that?"

Me: "Okay, so most standard drone controllers have extra buttons that arenā€™t used during flightā€”they're just lying around, doing nothing right?šŸ’”"

You: "Yeah..."

Me: "Why not assign one of those buttons to trigger the package drop?"

You: "Hmm, that's kinda smart! But how do we actually do that? šŸ«”"

Me: (chuckling) "Alright, hereā€™s the gist. The transmitter sends a signal to the receiver about the state of every channel, basically all the switches and buttons on the controller. The receiver then passes this signal to the flight controller, right?"

You: "Mm-hmm šŸ§"

Me: "What if we tap into that signal and decode it? By using a powerful microcontroller, like an ESP32, we can read all the transmitterā€™s channel values. Then, we assign one of the unused channels to trigger the drop. When that button is pressed, the ESP32 sends the command to release the package."

You: "Bingo! I think weā€™re onto something!"

3D Design and Printing

You: "Okay, but what mechanism should we use to actually drop the package? šŸ¤Ø"

Me: "šŸ«” Good question. We could use a simple string to hold the package, but then weā€™d have to deal with it swinging mid-air... not ideal."

You: "Yeah, itā€™s like weā€™d need a way to 'stick' the package to the drone until the moment it needs to drop."

Me: "Exactly. Weā€™ll need a more stable design. Iā€™ve got a few ideasā€¦ šŸ§™ā€ā™‚ļøšŸŖ„" (stares dramatically into the distance)

Let's continuešŸƒā€ā™‚ļøšŸ’Ø

Setting Up the ESP32

The ESP32 "listens in" on the communication between the receiver and the flight controller (FC) to extract the transmitter's channel values. By decoding the CRSF protocol used by the ELRS receiver, it translates this data into raw channel values. After several late nights of tinkering, I successfully implemented the decoding process.

Hereā€™s how it works: The receiver sends data packets to the FC using its TX port. These packets include the transmitter's channel values. Once the ESP32 receives a packet, it gains access to the same data as the FC. Using this information, the ESP32 can be programmed to activate a motor and release the package when a specific, unused channel is triggered by a button press.

For more technical explanation and more code refer to my GitHub, it has the entire process explained in a lot more detailāœØ

Note: In the code below, the designated channel for triggering the package drop is channel 7, as on my controller, it was an auxiliary button that was latent. If you want to use a different channel value, modify it in the code.

// Code for the ESP32 Firebeetle

#include <HardwareSerial.h>
#include <ESP32Servo.h>

#define speed_stop 90 // Stop position

#define CRSF_SERIAL_PORT Serial2 // Using Serial2 on the ESP32
#define CRSF_BAUD_RATE 420000 // CRSF baud rate (400,000 bps)
#define RX_PIN 17 // Receiver TX connected to ESP32 RX (GPIO17)

#define CRSF_MAX_PACKET_SIZE 64
#define CRSF_FRAMETYPE_RC_CHANNELS_PACKED 0x16

Servo mymotor; // Servo motor object

uint16_t rcChannels[16]; // Channel data

// Servo control debouncing variables
const int STABLE_THRESHOLD = 5; // Required consecutive stable readings
int stableCount = 0; // Counter to track stable readings
bool motorActive = false; // State of the motor

void processCRSFPacket(uint8_t *packet, uint8_t length) {
uint8_t packetType = packet[2];

if (packetType == CRSF_FRAMETYPE_RC_CHANNELS_PACKED) {
// Extract 11-bit channel data
rcChannels[0] = ((packet[3] | packet[4] << 8) & 0x07FF);
rcChannels[1] = ((packet[4] >> 3 | packet[5] << 5) & 0x07FF);
rcChannels[2] = ((packet[5] >> 6 | packet[6] << 2 | packet[7] << 10) & 0x07FF);
rcChannels[3] = ((packet[7] >> 1 | packet[8] << 7) & 0x07FF);
rcChannels[4] = ((packet[8] >> 4 | packet[9] << 4) & 0x07FF);
rcChannels[5] = ((packet[9] >> 7 | packet[10] << 1 | packet[11] << 9) & 0x07FF);
rcChannels[6] = ((packet[11] >> 2 | packet[12] << 6) & 0x07FF);
rcChannels[7] = ((packet[12] >> 5 | packet[13] << 3) & 0x07FF);

// Uncomment to print channel values for debugging
// Serial.print("Channels: ");
// for (int i = 0; i < 16; i++) {
// Serial.printf("%2d: %4d ", i, rcChannels[i]);
// }
// Serial.println();

// Debounce logic for channel 7 (Anticlockwise only)
if (rcChannels[7] >= 1000) {
if (!motorActive) {
stableCount++;
if (stableCount >= STABLE_THRESHOLD) {
mymotor.write(60); // Rotate motor anticlockwise (position 0)
motorActive = true;
stableCount = 0; // Reset counter
}
}
} else {
if (motorActive) {
stableCount++;
if (stableCount >= STABLE_THRESHOLD) {
mymotor.write(90); // Stop motor
motorActive = false;
stableCount = 0; // Reset counter
}
}
}
}
}

void setup() {
Serial.begin(115200); // Initialize serial communication
CRSF_SERIAL_PORT.begin(CRSF_BAUD_RATE, SERIAL_8N1, RX_PIN);
mymotor.attach(12); // Attach servo to GPIO12

Serial.println("CRSF Receiver Initialized.");
}

void loop() {
static uint8_t packet[CRSF_MAX_PACKET_SIZE];
static uint8_t packetIndex = 0;

while (CRSF_SERIAL_PORT.available()) {
uint8_t incomingByte = CRSF_SERIAL_PORT.read();

if (packetIndex == 0 && incomingByte != 0xEE && incomingByte != 0xC8) {
continue; // Skip invalid bytes
}

packet[packetIndex++] = incomingByte;

if (packetIndex >= 2 && packetIndex == packet[1] + 2) {
processCRSFPacket(packet, packetIndex);
packetIndex = 0; // Reset for next packet
}

if (packetIndex >= CRSF_MAX_PACKET_SIZE) {
packetIndex = 0; // Prevent buffer overflow
}
}
}


Designing the Drop Mechanism With AIšŸ¤–

Now, letā€™s dive into the design of the package-dropping components šŸ“¦.

Now stick with me here, because this is where things get exciting šŸ§. Designing these components turned out to be both a fun and challenging process, requiring multiple iterations to get just right. The main goal was to create a design thatā€™s easy to assemble, compatible with a wide range of drones, and both robust and practical.

(a few early sketches āœļø)

After finalizing a design robust enough to handle multiple drops, we can now take things to the next level by leveraging, wait for itā€¦

āœØAIāœØ

With the help of AI, we can minimize the material required to produce the parts and optimize flight performance by reducing the component weight to an absolute minimum.

Using Fusion 360ā€™s generative design feature šŸ¤–, we can tackle the weight optimization challenge efficiently.

After considering all factors, I developed the final drop mechanism, which consists of two parts:

  1. Droke: The component that attaches to the drone.
  2. Flatch: The part that drops along with the package.


The Droke

The Flatch

Optimising Using Generative AI

Now, I wouldnā€™t be surprised šŸ˜± if youā€™re wondering how generative AI can create such "organic" šŸŒ± looking components, or even how to use it in the first place to optimize a design. While a crash course in generative design is beyond the scope of this project, skipping over the optimization process entirely wouldnā€™t do it justice šŸ˜”.

Below are some diagrams outlining the process:

Original: These are the initial, clunky designs that used significantly more material than necessary while still maintaining the structural integrity of the drone.

GD Study: This marks the beginning of the optimization process. Here, you define three main geometries (or bodies):

  1. Preserve: The regions that must remain unchanged.
  2. Obstacle: Areas the AI must avoid.
  3. Starting Shape: The initial structure that the AI will refine.

Additionally, you specify the forces the optimized structure must withstand to ensure it remains structurally sound.

Final: This is the best design the AI generated after evaluating thousands of variations. It satisfies the criteria while minimizing the material required to produce the component.


The Droke



The Flatch

The Final Design

After all the prototyping and iterations, this is the final design that performed the best āœØ.

Let's Print šŸ–Øļø

Fire up your 3D printer and get ready to print šŸ”„šŸ–Øļø.

Pro Tip šŸ¤«: If you're using a 3D slicer software (like Cura, which I used for this project), enable a setting called "adaptive layer height." This will minimise layer steps on the final print, resulting in a smoother finish.

Once the components are printed, you'll need to remove the supports. If they are too hard to remove by hand, you can use a crafting knife, and a small screwdriver for the supports stuck in tight places. Be patient and careful during this process!


After prototyping and making sure that the models actually worked, I got the parts resin-printed in a cool transparent color scheme, UTR-8100 (Transparent), from Justway. The build quality came out excellentā€”the finish was smooth, durable, and highlighted the intricate details of the design. Their resin material had a sleek, futuristic look that took the final presentation to the next level, making the parts feel professional and refined.

To get the exact parts that have the cool transparent look it was a simple process:

  1. Head over to their website
  2. Add each of the STL files for the Droke, Latch, and Flatch and use this setup ā¬‡ļø:


What stood out to me during the ordering process was how user-friendly their website was. I could upload my files quickly, select my preferences, and complete the order seamlessly.

The final transparent parts looked really futuristic and cool, which I liked a lot šŸ¤–. The pricing was competitive for high-quality resin prints, and the turnaround time was impressiveā€”it didnā€™t take long to receive the finished parts.

Iā€™d highly recommend checking them out if you're looking for a place to get the transparent resin printāœØ.

Wiring the Electronics

Now that we understand how the drone operates, letā€™s dive into the exciting partā€”building it! Hereā€™s the wiring diagram for the electronics šŸ’”.

Disclaimer: Wiring diagrams for flight controllers (FCs) vary depending on the model. In the diagram below, Iā€™ve highlighted the relevant pads specific to my FC. If youā€™re using a different FC, you can find its wiring diagram on the manufacturerā€™s website. The same pads should be present, though their locations may differ.


After establishing the connections between the ESP32 and the Buck Converter, you should get something similar to this:

Stacking the Components

Before we start mounting the electronics onto the drone, hereā€™s a key piece of advice: use more electrical tape than you think youā€™ll need. If your drone frame is made of carbon fiber, proper insulation is crucial. Carbon fiber is conductive, and uninsulated connections can cause short circuitsā€”or worse, damage your components beyond repair.

Now, letā€™s get back to building šŸ‘·ā€ā™‚ļø. The next step depends on the space available on your drone. Many FPV drone frames have a relatively open section at the back, typically reserved for the receiver and the XT60 connector (battery plug).

First: Insulate the frame thoroughly using electrical tape, and then position the Buck Converter on the frame.


Next, secure the Buck Converter to the drone frame using electrical tape



Next, attach the receiver securely to the Buck Converter and the drone frame

Component Placement

After soldering the wires to the flight controller according to the wiring diagram, your setup should resemble the image below.

Next when you flip the drone over, you can position the ESP32 in the same orientation as below, ready for the Droke to be attached.

Connecting Motor and Latch to Droke

Now connect the motor and the latch together in the following orientation:

The connection to the Droke should be a simple process as below ā¬‡ļø

Droke Placement

Now place the Droke onto the frame, and have the ESP32 neatly tucked into the Droke as in the image on the right.

Also ensure that you secure the Droke to the drone frame using the zip ties. There should be gaps in the frame that you can use to slot the zip ties through.

Slotting in the Flatch

To slot in the Flatch is as simple as shown below:

  1. Slip the flatch into the rails
  2. Close the latch

Isn't the simplicity just beautiful... šŸ„¹

Loading the Cargo

Get all your cargo ready šŸ“¦. For my test flights, I used a chocolate bar, but you can really attach anything...

You'll need some string to tie it onto the flatch:

You can tie it on like this:

Flight Testing

Delivery Drone Drop Test

And we're done. Just like that you've built yourself your own delivery dronešŸ“¦.

Final Reflections

At the end of the project, I can only look back and be proud of how it came out. The journey was a long and challenging one and required lots of support from many different people who I do not take for granted.

Whether delivery drones become a reality or not depends on a variety of factors, but I hope they lead to a future that is better for humanity šŸ’«. This is a revolutionary concept that, with time, can drastically transform the way in which the world operates. But until then, I hope you enjoy it and use your drone responsibly. I'm merely a guy who liked flying his drone around and thought of a way for it to deliver stuff. So, have funā€”responsibly, and I hope you enjoyed this instructable and have fun building your own šŸ‘‹.


~Iloke