Introduction: Autonomous Miniquad (assembly)
The friendly folks at banggood.com sent me a mini Ardupilot and GPS so I decided to make my miniquad autonomous.
Mini quads / racing quads are a great way to get into multirotors. They are cheap and extremely robust. Most people use them for FPV racing, and it’s easy to invest thousands of dollars in the best components and hand craft a high-performance racing machine. However, as they become more and more popular, many pre-built aircraft like the Walkera Runner are appearing all over on websites like banggood and hobbyking.
This instructable describes my process with my ZMR 250 miniquad, but should give a pretty good idea how to make any miniquad autonomous.
The aircraft will then be controllable by any windows or android device and can perform missions like:
- follow me - following around the GPS location of your phone
- structure scanner - spirals upward around a structure taking photos that can be stitched into a 3D model
- Dronie - A selfie with a drone, where it starts a video at body height, then flies away to zoom out and show an amazing aerial scene
- Any mission that you command based on waypoints with lat, long and alt coordinates.
N.B. the ardupilot flight controller is not made for racing. It only has an 8-bit processor and does not support oneshot, so it won’t give the kind of incredible precision and performance of a racing flight controller. It will, however, perform perfectly well if you’re not whizzing around millimetres away from obstacles at 100km/h.
N.N.B. the steps listed here are in the order that, in hindsight, you should do them, not the order I did them, so ignore any discrepancies in the photos.
N.N.B. This instructable covers the process of physically installing the APM in the aircraft. Configuring the software is described in my other instructable.
Step 1: Shopping List
To make our miniquad autonomous, we are going to need to
change over the:
- flight controller http://bit.ly/1P87oTl
- power distribution board http://bit.ly/1roQpFl
and install a:
- GPS. Choose the second option “MINIAP GPS” http://bit.ly/1QdUdxL
- telemetry radio http://bit.ly/1OJZE65
- GPS stand to increase accuracy http://bit.ly/21sjMkx
You will also need a 4x2 header pin rack, and a small piece of heat shrink tube that just barely fits over it.
Optional: you will need a USB OTG cable if you want to connect with your android device.
N.B. The components I used are slightly different models from the ones I have listed here so they will look different in the photos, but they do the same thing.
Step 2: Tools
We will need:
- soldering iron
- side cutters
- scalpel / x-acto knife
- M2.5 & M3 Allen keys / hex screwdriver
- Windows computer
- ESC programmer like this http://bit.ly/1T5PSOY
If you are lucky enough to have BLHeli ESCs with the BLHeli bootloader and a Naze32, you can programme them through that. My ESCs have the SimonK bootloader, so I will describe that method in this instructable, but the settings you want are the same as those listed here regardless.
Step 3: Remove Existing Boards
- Remove the top plate of the miniquad. Since I won’t be racing with this aircraft anymore, I removed the FPV camera to proved more space and save weight. Live video will come from the action cam on top. The video output will be fine, but has a 0.2sec lag, so is not suitable for racing.
- Remove the flight controller (in this case, a Naze32).
- Unsolder all ESCs and LEDs, and remove the power distribution board.
Step 4: Soldering to the PDB
At this point I prepared the AV cord to connect the video-out port of my Mobius action cam to the video transmitter. I cut the yellow wire of the Mobius cable from its servo plug and soldered it to the yellow wire of the video TX plug. Leave the Mobius power plug alone if you want to power it off the flight battery.
- Attach the power distribution board (PDB) to the quadcopter frame.
- Solder on the battery lead to B+ (red) and B- (black) and the ESCs to the pads on the side.
- If you’re using a 3S flight battery, the side pads will be running 12v so you can put your LEDs and video Tx anywhere. If you’re running 4S or more, there is a dedicated 12v output at the top that you can solder them to.
Solder the lonely ground wire from the Mobius cable (you cut its yellow companion) to any ground (-) pad on the PDB.
Step 5: Attaching the Flight Controller
I removed the case of the Ardupilot to mount it on the existing centre stack screws. You can choose to remove the case or find another way to mount it. If you do remove the case, you have to hot glue some open-cell foam over the barometer so it is not affected by the prop wash.
Screw on nylon spacers and place the Ardupilot flight controller above the PDB with the arrow facing towards the front of the aircraft.
Step 6: Connecting the ESCs
Unpack the other 10-position cable from the mini Ardupilot bag. You can use a scalpel / x-acto knife to lift up the tabs on the white plug and remove the four wires farthest from the black wire, or you could cut them off with side cutters.
You have three choices of how to power your Mobius / GoPro from the flight battery. One option is described in this step, and alternatives are described in on the following two steps. This step is permanent and involves cutting wires. The two alternatives are non-destructive and reversible.
If you choose this method, cut the red wires of the Mobius cable and the 10 positions plug, and solder them together.
If you do not choose this method, remove the red wire.
For some reason, the wire harness has all female plugs despite the fact that all ESCs also have female plugs. So we’re going cut off all the ends and make them into a combined 4-pin connector.
Break your header pin rack so you have a 4x2 block.
Hold the black wire aside. Cut the other 4 wires about 5cm long. Solder the ends to the short side of the top row of header pins. Hold the wires with pliers while you strip the insulation, otherwise you will pull it out if the plug. If this happens, it probably damaged the metal connector, so replace it with one of the other wires you removed.
Cut the black wire 1cm longer than you cut the other wires. Strip 1cm of insulation from the end and solder it along the bottom row of header pins so it connects them all together.
Heat shrink or electrical tape the solder joints.
Mark which row is ground and which row is signal. I you forget, you can use a multimeter to test. Set the multimeter to continuity (the one that beeps when the probes touch) and whichever row beeps when two of its pins are touched is the ground row.
The ESCs most likely have only two wires in a three-position servo plug, with the middle position empty. If they have a red wire in the middle position, remove it.
This won’t plug into your 4x2 header plug so you have two choices.
- NOT RECOMMENDED: You can move the black wire (using the scalpel / x-acto knife to lift the tabs) to the middle position. This is NOT RECOMMENDED, as the ground wires are now in the standard power position. If you move these ESCs to another machine and forget to move the wire back, it will short our and blow something up.
- RECOMMENDED: Use the scalpel / x-acto knife to lift the tabs and remove the single plugs from all those wires you just cut off. Remove the plugs from the ends of the ESCs and put on the single plugs.
If you have OneShot or active braking (damped light) enabled, do not plug the ESCs in yet. Instructions on how to disable OneShot and Damped Light are described in the next step. Unfortunately Ardupilot does not support OneShot or Damped Light. If this means nothing to you, try to find out if your ESCs have BLHeli firmware on them. If so, read the next step. If not, skip this step and hope for the best!
Step 7: Disabling OneShot and Damped Light
To make your autonomous mini quad (AMQ – I like that.) fly properly, unfortunately we need to disable OneShot and Damped Light. This is why I said in the into that it won’t be optimal for FPV racing.
If you have ESCs that run BLHeli, download BLHeli Suite from here https://blhelisuite.wordpress.com/
Plug your ESCs into the programmer and plug it into your computer. Open up BLHeliSuite.exe
Ensuring propellers are not attached, power up the quadcopter so the ESCs have power.
Select the right COM port, select Baud rate of 9600 and click ‘Connect’
Click ‘Read Setup’
The important settings are:
Motor Gain: x 0.75 (The screenshot shows x 1.00 but it should by x 0.75)
PWM Frequency / Damped: Low (This disables active breaking)
Enable PWM Input: On (This disables OneShot)
Motor Timing: Medium (You can play around with this if your motors desync)
Click ‘write setup’
Unplug the quadcopter battery
Repeat for the other three ESCs, unplugging and plugging quadcopter battery each time
Read each ESC setup and manually change the values rather than blindly writing the same settings to each, as the motor direction might be different.
You can now plug the ESCs into the header pins we soldered last step.
Step 8: Connecting a PPM Receiver
If your receiver is a PPM receiver (there are only 3 wires going to the flight controller – 1 signal, 1 power and 1 ground) follow this paragraph. If you have a PWM receiver (each channel is delivered to the FC through its own wire) skip to the next step
Unpack the other 10-position cable from the mini Ardupilot bag. You can use a scalpel / x-acto knife to lift up the tabs on the white plug; pull out both yellow wires and everything between them.
Or you can cut them off with the side cutters. All you need are the black and red wires, and the first three wires on the opposite side of the plug.
Short the 2nd and 3rd wire together. If you’re ok with it being permanent, the best way to do this is to cut the wires pretty short, (~4cm), and solder them together. Don’t forget to insulate the solder joint with heat shrink or electrical tape. This tells the Ardupilot to listen for a PPM signal on wire 1.
Plug the PPM signal, 5v and ground wires into your PPM receiver.
If you have spare power and ground pins on your receiver, you can plug in the Mobius / GoPro power plug here to power it from the flight battery.
Step 9: Connecting a PWM Receiver
If your receiver is a PWM receiver (Each channel is delivered to the flight controller individually) follow this step. If you are using a PPM receiver (all channels are combined in a single wire) go back to the previous step and skip this one when you’re finished.
Unpack the other 10-position cable from the mini Ardupilot bag. You can use a scalpel / x-acto knife to lift up the tab of the plug on the wire closest to the red wire and pull the plug away from the metal wire end. See the pictures. Slide the wire into the spare slot in the Mobius power plug if you have one.
Now plug all the wires into the receiver. The plug coming from the Mobius is channel 8, the red wire can go into any power pin (centre row), and the black wire into any ground pin (bottom row). Work your way back from the red wire, and plug in each wire along the top (signal) row in descending order. The wire farthest from the red wire is channel 1.
Step 10: Putting Everything Together
You can now plug everything into the flight controller according to this diagram, and find somewhere to stick everything. Plug the PDB into the Ardupilot, the GPS, Telemetry, ESCs and RC Receiver.
Attach the GPS stand stick the GPS on top. You can use double-sided tape or Velcro. You may choose not to use a stand, but if your aircraft makes wide circles (called ‘toilet-bowling) when it supposed to by holding position, this is an indication that the compass is incurring interference from the ESCs. I found mine performed ok without the stand - it drifted about 5 or 6 meters to either side in loiter (50cm accuracy is quoted for a well-tuned aircraft, 2m is not unreasonable), but why put up with subpar?
The telemetry aerial must be protruding from the carbon fibre frame, as CF will block its signal. Therefore, out the back is the safest place to put it. I find it loses link with the computer when sitting on the ground (that’s how radio waves work) but as soon as it takes off to >1m, connection is re-established.
Now you’re ready to configure the Ardupilot! See my other instructable to find out how.