logo-mobile

ROHM

ROHM
Menu
  • Arduino –
  • Raspberry Pi –
  • Trending –
  • Others –
  • About –
  • Contact –

Arduino

DIY Drone Instructable: How To Deliver a Payload

DevicePlus Editorial Team
Published by DevicePlus Editorial Team at March 18, 2019
Categories
  • Arduino
Tags
payload delivery system for drones

Overview

These instructions guide you to build a DIY payload delivery drone system that can be mounted on your drone/quadcopter and used to deliver a package to any address. The smart, low-cost delivery solution uses GPS to find its destination and then employs an ultrasonic sensor to measure the ground clearance. Depending on your drone capabilities, this payload system can lift up to 2kg freight. A servo motor is used to release the payload at the desired location. This guide also provides a solution to the sensor integration problem. You can integrate GPS, servo, and ultrasonic sensors without any serial interference.


DIY payload delivery drone system

Components

  1. Breadboard
  2. Arduino Mega/Uno
  3. Servo motor SG90
  4. Ultrasonic sensor HC-SR04
  5. GPS module NEO-6M-001
  6. Connecting wires
  7. A bottle cap
  8. Glue/Tape
  9. Hair pin
DIY payload delivery drone breadboard component
Breadboard
DIY payload delivery drone arduino component
Arduino Mega/Uno
DIY payload delivery drone micro servo motor component
Servo motor SG90
DIY payload delivery drone ultrasonic sensor component
Ultrasonic sensor HC-SR04
DIY payload delivery drone gps module component
GPS module NEO-6M-001
DIY payload delivery drone connecting wires component
connecting wires
DIY payload delivery drone connecting wires component
bottle cap
DIY payload delivery drone hairpin component
hair pin

Step 1: Connecting the Ultrasonic Sensor

Take the breadboard and affix the Arduino to its one side, as shown in the picture. Now, take the HC-SR04 ultrasonic sensor and attach it to the lower side of the breadboard.

DIY payload delivery drone Step 1 connecting Arduino to breadboard
DIY payload delivery drone Step 1 connecting ultrasonic sensor to board

Make the connections as shown in Figure 1. Connect the pins as follows:

  • Vcc (Ultrasonic) -> 5V (Arduino)
  • GND (Ultrasonic) -> GND (Arduino)
  • Trig pin (Ultrasonic) -> pin 8 (Arduino)
  • Echo pin (Ultrasonic) -> pin 9 (Arduino)
DIY payload delivery drone Step 1 Figure 1

Run the following code to check if the ultrasonic sensor is functional.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* DIY Drone Instructable that Delivers a Payload
*/
const int trigPin = 8; //declare pin number for trig pin
const int echoPin = 9; //declare pin number for echo pin
long duration;
int dis;
void setup() {
pinMode(trigPin, OUTPUT); // declaring trigPin as output
pinMode(echoPin, INPUT); // declaring echoPin as input
Serial.begin(9600); // serial communication at 9600 baud rate
}
void loop() {
digitalWrite(trigPin, LOW); //intializing trigPin
delayMicroseconds(2);
// setting trigPin high
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// reading the echoPin
duration = pulseIn(echoPin, HIGH);
// calculating distance
dis= duration*0.034/2;
// displaying distance on Serial Monitor
Serial.print("Distance: ");
Serial.print(dis);
Serial.println(" cm");
}

The Serial Monitor will show the following output:

DIY payload delivery drone Step 1 Serial Monitor Output

Step 2: Connecting the GPS Module

Take the NEO-6M GPS module and insert its pins into the breadboard.

DIY payload delivery drone Step 2 connecting GPS module

Make connections as shown in Figure 2. Don’t forget to download TinyGPS++ library if missing. Connect the pins as follows:

  • Vcc (GPS module) -> 3.3V (Arduino)2
  • GND (GPS module) -> GND (Arduino)
  • RX pin (GPS module) -> pin 1 (Arduino)
  • TX pin (GPS module) -> pin 0 (Arduino)
DIY payload delivery drone Step 2 Figure 2
Figure 2

Run the following code and check if the GPS sensor is functional. DON’T FORGET to remove the TX pin of GPS module from pin 0 of Arduino; otherwise, your code won’t upload. Once the code is uploaded, first open Serial Monitor; then, connect the TX pin of GPS to pin 0 to view the current location of drone, time, and date.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* DIY Drone Instructable that Delivers a Payload
*/
#include <TinyGPS++.h>
static const int RXPin = 0, TXPin = 1; //defining RX and TX pins
static const uint32_t GPSBaud = 9600; //defining GPS baud rate
TinyGPSPlus gps;
void setup(){
  Serial.begin(9600); //baud rate
  Serial.begin(GPSBaud);
}
void loop(){
  while (Serial.available() > 0){
gps.encode(Serial.read());
if (gps.location.isUpdated()){
  
   // Displaying latitude (degrees)
   Serial.print("Latitude= ");
   Serial.print(gps.location.lat(), 6);  
   // Longitude in degrees (double)
   Serial.print(" Longitude= ");
   Serial.println(gps.location.lng(), 6);
   // displaying the date
   Serial.print("Day (DD/MM/YYYY) = ");
   Serial.print(gps.date.day());
   Serial.print("/");
   Serial.print(gps.date.month());
   Serial.print("/");
   Serial.println(gps.date.year());
   // Displaying the time
   Serial.print("Time (HH:MM:SS) = ");
   Serial.print(gps.time.hour());
   Serial.print(":");
   Serial.print(gps.time.minute());
   Serial.print(":");
   Serial.print(gps.time.second());
   Serial.println(" UTC");
  
      Serial.println("----------------------------------------");
   delay(1000);
}
  }
}

The Serial Monitor will show output:

DIY payload delivery drone Step 2 Serial Monitor Output

Step 3: Connecting the Bottle Cap

Now, take a bottle cap to prepare the payload-releasing mechanism. The mechanism itself is simple. You hook the payload on the hairpin inside the bottle cap, and when the servo moves it pulls off the hairpin from the bottle cap, resulting the payload to drop.

Make holes on both sides of the cap. Attach the cap on the lower side of the breadboard, as shown in the pictures.

DIY payload delivery drone Step 3 connecting bottle cap
placing the bottlecap

Step 4: Connecting the Servo

First, take a hair pin and connect it to the limb of the servo using a staple, as shown in the picture.

DIY payload delivery drone Step 4 connecting the servo

Take the servo and attach it under the breadboard such that the hair pin passes through both the holes of the bottle cap.

adding servo
adding servo

Connect the Servo with Arduino in the following way, as shown in Figure 3.

  • PWM Pin (Servo) -> Pin 14 (Arduino)
  • Vcc Pin (Servo) -> 5V (Arduino)
  • GND Pin (Servo) -> GND (Arduino)
DIY payload delivery drone Step 4 figure 3
Figure 3

It will look like this when you attach the whole system to your drone.

Run the following code to check if the servo is functional.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* DIY Drone Instructable that Delivers a Payload
*/
#include <Servo.h>
Servo servo;
int angle=10;
void setup() {
  servo.attach(14); //attach PWM pin of sg90 to pin 2 of Arduino
  servo.write(angle);
}
void loop(){
  for(angle = 180; angle > 10; angle--)
  {                            
servo.write(angle);      
delay(25);
  }
}

Step 5: Putting it All Together

Make sure you make all the connections as shown in Figure 4. You’ll integrate the sensors without using SoftwareSerial library. Employing hardware serial ports of your Arduino will minimize serial interference between libraries; hence, eliminating the servo vibration.

DIY payload delivery drone Step 5 figure 4
Figure 4

Open the Arduino window and paste the following code. In the code, set the desired GPS coordinates (latitude, longitude) where you need to drop off the basket. Once the desired location is added, click Upload. Again, don’t forget to remove the TX pin of GPS from pin 0 before uploading the code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/* DIY Drone Instructable that Delivers a Payload
*/
#include <TinyGPS++.h>
#include<Servo.h>
//define TX and RX pins for GPS
static const int RXPin = 0, TXPin = 1; //defining RX and TX pins of Arduino
static const uint32_t GPSBaud = 9600; //defining GPS baud rate
TinyGPSPlus gps;
//destination to drop payload
int des_lat= 33;
int des_lng= 73;
//declaring pins for ultrasonic sensor
const int trigPin = 8; //declare pin number for trig pin
const int echoPin = 9; //declare pin number for echo pin
long duration;
int dis;
Servo servoMain; // defining Servo
void setup(){
  Serial.begin(9600); //baud rate
  Serial.begin(GPSBaud); //GPS receiving values at Serial0
  Serial1.begin(9600);  //Ultrasonic receiving values at Serial1
  pinMode(trigPin, OUTPUT); // declaring trigPin as output
  pinMode(echoPin, INPUT); // declaring echoPin as input
  servoMain.attach(14); // attach servo's PWM to Arduino's digital pin 14
  servoMain.write (180); //initializing servo
}
void loop(){
  while (Serial.available() > 0){
gps.encode(Serial.read());
if (gps.location.isUpdated()){
  
   // Displaying latitude (degrees)
   Serial.print("Latitude= ");
   Serial.print(gps.location.lat(), 6);  
   // Longitude in degrees (double)
   Serial.print(" Longitude= ");
   Serial.println(gps.location.lng(), 6);
   // displaying the date
   Serial.print("Day (DD/MM/YYYY) = ");
   Serial.print(gps.date.day());
   Serial.print("/");
   Serial.print(gps.date.month());
   Serial.print("/");
   Serial.println(gps.date.year());
   // Displaying the time
   Serial.print("Time (HH:MM:SS) = ");
   Serial.print(gps.time.hour());
   Serial.print(":");
   Serial.print(gps.time.minute());
   Serial.print(":");
   Serial.print(gps.time.second());
   Serial.println(" UTC");
  
   digitalWrite(trigPin, LOW); //intializing trigPin
      delayMicroseconds(2);
  
   // setting trigPin high
   digitalWrite(trigPin, HIGH);
   delayMicroseconds(10);
   digitalWrite(trigPin, LOW);
  
   // reading the echoPin
   duration = pulseIn(echoPin, HIGH);
  
   // calculating distance
   dis= duration*0.034/2;
  
   // displaying distance on Serial Monitor
   Serial.print("Ground Clearance: ");
   Serial.print(dis);
   Serial.println(" cm");
  
   //dropping off payload at desired destination
   if (gps.location.rawLat().deg== des_lat && gps.location.rawLng().deg==des_lng && dis<=15)
   {
     Serial.println("Reached desired location");
     Serial.print("Package delivered to: Latitude=");
     Serial.print(gps.location.lat(), 6);
     Serial.print(" , Longitude=");
     Serial.print(gps.location.lng(), 6);
     Serial.print(" at time:");
     Serial.print(gps.time.hour());
     Serial.print(":");
     Serial.print(gps.time.minute());
     Serial.print(":");
     Serial.print(gps.time.second());
     Serial.println(" UTC");
    
     servoMain.write(20); // Turn Servo Right to 180 degrees
   }
  
   else if (dis>=15)
   {
     servoMain.write(180); // Turn Servo Right to 180 degrees
   }
  
      Serial.println("----------------------------------------------------------------------------------------");
   delay(1000);
}
  }
}

Upload the code on your Arduino and click the Serial Monitor icon in the top right corner. You’ll see the current GPS coordinates of your drone. Let your drone fly to the desired location.

DIY payload delivery drone Step 5 output

When your drone reaches the desired address, bring it closer to the ground. The ultrasonic sensor will calculate the ground clearance. When it’s about 15 cm, the servo releases the payload. The serial monitor prompts you when the package is delivered, and records the time as well.

DIY payload delivery drone Step 5 final output

After dropping the payload, fly your drone back to its initial point.

Precaution
DO NOT put more than 2 kg load in the basket otherwise it will damage the assembly. Also be sure to check the spec of your drone so you will know how much weight that drone can handle.

DevicePlus Editorial Team
DevicePlus Editorial Team

Check us out on Social Media

  • Facebook
  • Twitter

Recommended Posts

  • Servo-Controlled DIY Camera Gimbal with ArduinoServo-Controlled DIY Camera Gimbal with Arduino
  • An Intro to: CMUcam5 Pixy Vision Camera SensorAn Intro to: CMUcam5 Pixy Vision Camera Sensor
  • Make a Laser Arduino Robot Using Parallax Laser Sensor – Part 2Make a Laser Arduino Robot Using Parallax Laser Sensor – Part 2
  • Servo Motor Controlled Wireless Light SwitchServo Motor Controlled Wireless Light Switch
  • How To Make Your Own RobotHow To Make Your Own Robot
  • Intro to CMUcam5 Pixy Vision Camera Sensor Part 2 – Creating a Ball Balance BeamIntro to CMUcam5 Pixy Vision Camera Sensor Part 2 – Creating a Ball Balance Beam
Receive update on new postsPrivacy Policy

Recommended Tutorials

  • How to integrate an RFID module with Raspberry Pi How to integrate an RFID module with Raspberry Pi
  • How to Use the NRF24l01+ Module with Arduino How to Use the NRF24l01+ Module with Arduino
  • How to Run Arduino Sketches on Raspberry Pi How to Run Arduino Sketches on Raspberry Pi
  • Setting Up Raspberry Pi as a Home Media Server Setting Up Raspberry Pi as a Home Media Server

Recommended Trends

  • SewBot Is Revolutionizing the Clothing Manufacturing Industry SewBot Is Revolutionizing the Clothing Manufacturing Industry
  • All About The Sumo Robot Competition And Technology All About The Sumo Robot Competition And Technology
  • 5 Interesting Tips to Calculating the Forward Kinematics of a Robot 5 Interesting Tips to Calculating the Forward Kinematics of a Robot
  • Go Inside the Drones That Are Changing Food Delivery Go Inside the Drones That Are Changing Food Delivery
Menu
  • Arduino –
    Arduino Beginner’s Guide
  • Raspberry Pi –
    Raspberry Pi Beginner's Guide
  • Trending –
    Updates on New Technologies
  • Others –
    Interviews / Events / Others

Check us out on Social Media

  • Facebook
  • Twitter
  • About
  • Company
  • Privacy Policy
  • Terms of Service
  • Contact
  • Japanese
  • 简体中文
  • 繁體中文
Don’t Forget to Follow Us!
© Copyright 2016-2022. Device Plus - Powered by ROHM
© 2022 Device Plus. All Rights Reserved. Muffin group

istanbul escort istanbul escort istanbul escort