Long Range Dropping System for Drones With Arduino and HC-12
by austiwawa in Circuits > Remote Control
32205 Views, 233 Favorites, 0 Comments
Long Range Dropping System for Drones With Arduino and HC-12
https://www.youtube.com/watch?v=vJqRWh3A0cQ
In this Instructable I will be showing you step-by-step how to make this long range item dropping system that I will be strapping onto my friends DJI Phantom 3 Professional. I came up with this idea while reading Tom Heylen's Instructable on "Arduino to Arduino wireless communication with the HC-12". Tom did a terrific job explaining how to use the HC-12 wireless serial port communication modules to communicate between two Arduinos wirelessly over a long distance up to 1.8km in open air. If you would like to learn more about the HC-12 modules I highly recommend checking out Tom's Instructable (https://www.instructables.com/id/Long-Range-18km-Ar...). It didn't take me long to learn everything there is to know about these awesome little devices.
The dropping system consists of a handheld remote and a dropper, each containing an HC-12 module and an Arduino nano. When the button on the remote is pressed a signal is sent to the dropper and a servo opens up the latch dropping any item that is attached. The biggest struggle with the project was trying to make the device as light weight as possible but still very strong. I also wanted to design it in a way so that the camera and proximity censors on the bottom of the drone did not get covered up, and that is why the device is mounted on the side of the drone.
This thing is a ton of fun and you don't just have to strap it onto a drone.. you can easily strap it onto anything that you like! I have posted a video above which shows us dropping all sorts of awesome things with the dropping system, so make sure to check it out! Now let's get started with the build.
Parts List and Tools
Parts:
- Arduino Nano (x 2) http://www.banggood.com/ATmega328P-Nano-V3-Control...
- HC-12 433 SI4463 Wireless Serial Module Remote 1000M With Antenna (x 2) http://www.banggood.com/HC-12-433-SI4463-Wireless-...
- TowerPro MG90D 13g Metal Gear Digital Servo http://www.banggood.com/TowerPro-MG90D-13g-Metal-G...
- 4 x AA Battery Holder with Leads
- 9V Battery Clip with Leads (x 2)
- PCB Printed Circuit Board
- RP-SMA Dual Band + 2 8in 20cm U.fl IPEX Cable Antenna https://www.amazon.ca/gp/product/B00MFT98AC/ref=oh...
- Slide Switch (x 2)
- Blue LED (x 2)
- Red LED (x 1)
- 100 Ohm Resistor (x 3)
- 10k Ohm Resistor
- Push Button
- Project Box (Length: 17cm, Height: 8.5cm, Width: 3.5cm)
- Project Box (Length: 5cm, Height: 10cm, Width: 2.5cm)
- 9V Battery (x 2)
- AAA or AA Battery (x 4)
- 1/8" Steel Rod
- 2 1/2" L-Bracket Corner Brace
- 4" Mending Plate
- Hardware
- Wire
- Velcro
- Breadboard
- Heat Shrink
Tools:
- Drill
- Pliers
- Hot Glue
- Hack Saw
- Soldering Iron
- Vice
- Philips Screw Driver
Breadboarding the Circuits
Before soldering together circuits when using Arduino, it is always a good idea to assemble them on onto breadboards. Doing this allows you to easily make changes if needed and it allows you to be sure that everything is functioning properly before doing any soldering.
I have made some circuit diagrams for you to follow. As you can see there is a ``sender`` circuit which is the circuit for the remote, and there is also a ``receiver`` circuit which is the circuit for the dropper. At this point you can go ahead and assemble the circuits onto a breadboard using the above pictures as your guide. Once completed we will upload the codes onto the Arduino`s and get the circuit working.
Uploading the Code
If this is your first time ever using an Arduino board you will need to download the Arduino software to your computer. You can do so by clicking on the following link: https://www.arduino.cc/en/Main/Software
I have posted the codes for the sender and the receiver below. Upload the "sender" code to the Arduino that is hooked up to the "sender" (remote) circuit, and upload the "receiver" code to the Arduino that is hooked up to the "receiver" (dropper) circuit.
Let's start with the sender. To do this simply open up the Arduino software and copy and paste the "sender" code that is posted below into your Arduino sketch. Now under the tools menu on the top click on "Board" and then select "Arduino Nano w/ ATmega328".
Now connect the Arduino nano to your computer with a Mini-B USB cable and hit the "upload" button on the top left. The Arduino will then begin blinking for a few seconds and then stop. If no errors appear on the screen it means the code was successfully uploaded to the Arduino.
Once you have finished uploading the code for the sender you can close your Arduino software and then do the same thing for the receiver.
Sender Code:
//DJI Phantom Care Package System - Sender //By: austiwawa #include <SoftwareSerial.h> SoftwareSerial mySerial(2, 3); //RX, TX const int buttonPin = 8; int buttonPushCounter = 0; // counter for the number of button presses int buttonState = 0; // current state of the button int lastButtonState = 0; // previous state of the button void setup() { pinMode(buttonPin, INPUT); pinMode(13, OUTPUT); pinMode(12, OUTPUT); mySerial.begin(9600); } void loop() { digitalWrite(13, HIGH); int buttonState = digitalRead(buttonPin);//read button state // compare the buttonState to its previous state if (buttonState != lastButtonState) { // if the state has changed, increment the counter if (buttonState == HIGH) { // if the current state is HIGH then the button // wend from off to on: buttonPushCounter++; Serial.println("on"); Serial.print("number of button pushes: "); Serial.println(buttonPushCounter); } else { // if the current state is LOW then the button // wend from on to off: Serial.println("off"); } // Delay a little bit to avoid bouncing delay(50); } // save the current state as the last state, //for next time through the loop lastButtonState = buttonState; if (buttonPushCounter % 2 == 0) { mySerial.println(1111);//send unique code to the receiver to turn on. In this case 1111 digitalWrite(12, LOW); } else { mySerial.println(0000); digitalWrite(12, HIGH); } delay(20);//delay little for better serial communication }
Receiver Code:
//DJI Phantom Care Package System - Receiver //By: austiwawa #include <SoftwareSerial.h> #include <Servo.h> SoftwareSerial mySerial(2, 3); // RX, TX int servopin = 9; int pos = 170; Servo servo1; void setup() { mySerial.begin(9600); pinMode(servopin, OUTPUT); pinMode(13, OUTPUT); servo1.attach(9); } void loop() { digitalWrite(13, HIGH); if(mySerial.available() > 1){ int input = mySerial.parseInt();//read serial input and convert to integer (-32,768 to 32,767) if(input == 1111){//if on code is received servo1.write(170); } if(input == 0000){ servo1.write(0); } mySerial.flush();//clear the serial buffer for unwanted inputs delay(50);//delay little for better serial communication } }
Testing the Circuits
Now that the circuits are both assembled and the codes have been uploaded to the Arduino's you can test out the circuits and make sure everything is working. At this point you will want to make sure that both Arduinos are plugged into your computer so they have power. You will also need to make sure your battery pack for the servo has batteries in it.
You will notice right away that the two blue LED's are turned on. These LED's are simply there to show if the devices are turned on or off. Now if you go ahead and give the push button a push you will see that the servo arm moves 170 degrees. You will also see that the red LED on the remote circuit is now lit up indicating the the item has been dropped. Now if you press the button again the red LED will turn off and the servo will move back to it's original position.
If everything is working fine you can go ahead on move onto the next step! If you are having any problems make sure to triple check your wiring and make sure you have uploaded the correct code to the correct Arduino. If you are still having problems you can post it in the comments section below and I will try my best to help you out.
Modifying the Servo Arm
We are going to need to modify the servo arm for the Tower Pro MG90D digital servo so that a piece of 1/8" steel rod will be able to fit through it. For this you could use wood, plastic, or any material you would like. I will be using a chunk out of a polyethylene cutting board that I had leftover from my airsoft machine gun project.
As you can see in the pictures above all that I did was cut out a small rectangle from the cutting board (about 1.5cm wide and 1cm high) and made some notches on the one side using a file for the servo arm to sit flush into.
I then stuck the servo arm into place with some super glue and left it overnight to dry. After it was dry I drilled a small hole through the middle of the servo arm where the servo screw goes just big enough for the threads to fit into. After that I drilled about 3/4 way though the same hole with a larger drill bit big enough for the head of the screw to fit into. Now the modified servo arm will be able to be properly fastened to the servo.
But before that, a 1/8" hole needs to be drilled about 0.6cm away from the fastening hole and then the edges can be sanded smooth.
You will see why this needed to be done shortly.
Preparing the Project Boxes
As you can see, both circuits contain parts that will need to be fastened outside of the project boxes. So we will need to drill some holes and make some cuts for the antenna's, the LED's, the push button, the switches, and the servo.
Let's start with the small box which will be used for the remote. A small rectangle will need to be cut out of the box for the switch about 3cm down the left side. I did this with first by drilling a couple of holes and then shaping the rest with a small file. I also cut out the fastener that the screw goes into from the bottom left corner inside of the box in order to make room for the 9V battery.
After that I drilled a hole in the top of the box for the antenna as well as drilled two small holes in the top left of the box to fit the LED's. The last hole was drilled in the center about 3cm down the front side of the remote for the push button.
Now for the larger project box, a hole will need to be cut out one of the long sides for the servo to fit into. When making this hole make sure that the pivot point on the servo is lined up with the center of the box. After this a hole can get made in the middle of one of the short sides for the switch, and a hole can get drilled into the middle of the other short side for the antenna. Now looking at the box with the servo hole on the bottom side, a hole can get drilled onto the front left corner of the box above the switch just big enough to fit the LED.
Once I was finished with all of that I painted the project boxes using white plastic paint to give a nice finish and to match the color of the DJI Phantom 3 drone.
Soldering
So now that we have our working circuits and prepared project boxes it is a good time to start soldering everything together. When soldering the circuit for the remote make sure to leave your wires short, because there wont be much free space inside of the project box!
Also, at this point we need to add the 9V battery clips as well as the slide switches to the circuits. On both of the Arduino's the red lead on the battery clip can be soldered to the "VIN" pin and the black lead can be soldered to "GND". The slide switch can then be soldered into the middle of either wires.
If you are wondering where I got my push button from well.. I desoldered it from a broken LED controller that my friend was throwing out because I knew that it would work perfectly for this project! Also, as you can see I have glued some wood onto the controllers PCB. I did this so that I can easily mount the pushbutton in the perfect position just by adding hot glue to the wood and sticking it to the inside of the project box.
Making the Droppers Arm/Mount
Making the Bracket:
At this point we are getting close to the finished product. We just need to make a quite simple dropping arm/mount and then assemble everything together. For this we will first need our L-bracket.
The first thing that I did was tighten the L-bracket in the vice and then cut 1 cm off of one end. After that I drilled a hole centered 5 mm away from the cut edge using a 9/64" drill bit. I then bent that same end down 90 degrees, making the bend 2 cm from the cut edge.
Once that was finished I cut the mending plate so that it was 6.5 cm in length. After that I once again drilled a hole centered 5 mm away from the cut edge, this time using a 3/16" drill bit. I then bent that same end down 90 degrees, making the bend 2.2 cm from the cut edge.
The two pieces were then fasted together with a couple of nuts and bolts as show in the pictures.
Making the Arm:
The droppers arm will be made out of the 1/8" steel rod. Simply cut a piece of the steel rod to 7 cm in length and file down both ends until they are rounded. After that bend one end down 90 degrees, making the bend 1 cm away from the end of the rod.
Adding the Velcro Straps
It took my a while to think about how I was going to mount the dropper to the DJI Phantom 3. One reason being that it isn't my drone and I did not want to scratch it up or fasten anything permanent to it, and the other being that I wanted to keep it as light weight as possible and easy to take on and off. Which is why I decided to use velcro.
To start, simply cut four pieces of the "looped" side of the velcro to 5.5 cm in length and four pieces to 2.5 cm in length.
After this you can use my pictures as a guide and use hot glue to stick them on to the project box. The four larger pieces can go onto each corner of the cover and the four smaller pieces can go on the sides.
Next, four pieces of the "hooked" side of the velcro need to be cut to 11 cm in length. Each piece can then be fasted to the small 2.5 cm pieces with a screw and washer.
The velcro straps keep the receiver attached to the drone by strapping around the drones base. You will see in the next step that the reveivers latching system also helps keep the receiver attached to the drone. If you want to use this drop system with a different drone, you can just add the velcro straps in a way that works best with it!
Final Steps!
It is finally time to start mounting all of the electronics into the project boxes! For the remote I stuck the LED's, the switch, and the PCB into place with hot glue. All of the components for the remote will be a tight squeeze, but it will all fit! The piece of cardboard between the Arduino and the 9V battery is just there to prevent the Arduinos terminals from touching the side of the battery. The antenna can be fastened in its place and be connected to the HC-12.
The receivers project box is a lot easier to work with because it has more room. So all of the electronics should fit in quite nicely.
At this point the servo arms mount needs to get fastened to the project boxes cover. All that you need to do it make sure that it keeps the servo arm nice and level and that it allows the servo arm to move smoothly when the servo moves. Two small nuts and bolts are all that is needed to keep it in place. Any loose components inside can be kept in place with a dab of hot glue.
And that's it! The project boxes can be screwed shut and the drop system is complete!
Things to Know
The drop system is now complete and is ready to be used! But first there are some things that you should know.
1. When attaching the receiver to the DJI Phantom it can be put on in a way so that the receivers weight rests on the drones base. When strapping it on just make sure that the bottom of the drone goes inbeteen the servo arm and the mount.
2. AA batteries are heavy. I originally wanted to order a special battery to use for the servo but that will have to wait for version 2. In the mean time you can fit AAA batteries into the battery holder. I know its quite crude.. but the micro servo works just fine with AAA's and it reduces the weight a significant amount.
3. To use it just switch on the the remote and the receiver and use the button to open and close the latch.
4. Be safe and have FUN! Don't drop anything that you shouldn't be dropping, especially in busy areas.
Thank you all very much for reading this Instructable to the end. I hope that you all enjoyed it! Don't for get to follow me here on Instructables and to Subscribe to my YouTube channel! Thanks for reading and watching :)