Jashan Bhoora | blog
With a long summer holiday ahead, I decided I wanted to put it the 3D printer to good use.After bouncing a few ideas around, I settled on a project for the holiday: a quadcopter.
More specifically, I wanted to design, print, build, program and fly a quadcopter, a full "product design" process. This was going to have quite a learning curve to it, since I had never really worked with RC models before, and of course, things didn't go quite to plan. Nevertheless, research started, and just before I left to go home for summer I had the bulk of the parts delivered:
- NTM 800KV Motors
- 11x4.7 propellers and adapters
- Turnigy Plush 25A ESCs (devices that convert a PWM signal from the controller to the sequenced pulses needed to drive the motors at a given speed)
- Zippy Compact 4s 5800mah LiPo battery and charger
Now knowing exactly what needed to be on the copter for it to fly, I set about designing the frame. By the time I ordered the components I had decided on a "motor-to-motor" length of 430mm, since this was the maximum length that the printer would be able to accommodate. This would result in a sizable copter, which caused me to lean towards a design that would use this characteristic and enable it to lift heavier payloads, hence the large propellers, and higher torque - lower speed motors (although at the cost of stability in the air...)
I used Autodesk Inventor to design the frame. Soon, things were starting to take form. But again due to my lack of experience of what a good frame needed, the designs were hardly that good.
Through a process of iterative improvements, occasionally printing a part to get an idea of its strength etc. and taking ideas from existing frames, things slowly improved, the flow of which you can see below.
My initial idea was to create a hollow container that would encase the electronics. This resulted in the boxy/octagonal cases below. However a failed printed of the last octangonal case instantly showed that the design would not be sturdy enough.
I Googled "quadcopter frame" in search of some inspiration, and was shown a wealth of frames of all sizes for varying applications. One particular recurring style makes use of two plates in the centre of the body to hold the arms together, and this is the design I adopted.
The result is the last picture shown here. The arms followed a similar procedure.
In the end, the frame required only 3 different pieces to assemble: the centre plates, the arms, and 2 brackets to hold the battery underneath the centre plate. You can see the drastic difference between the 2 designs...
With the frame design nearing completion, printing started in earnest. Any major problems that were found were fixed and saved for a future round of printing.
Whilst this was happening, the power harness (the system that distributes power from the battery to all components that need it) needed to be made. I went with a wire harness (as opposed to a PCB distribution board), which I made by cutting 14awg wire to length, then soldering it together along with Deans Connectors and bullet connectors in the desired configuation. In the same vein, bullet connectors were also soldered to the ESCs to connect them to the harness.
The only thing missing was the electronics to coordinate the hardware. For this, I decided I would use an Arduino Uno as the Flight Controller (or FC). For a quadcopter to balance it needs a set of sensors to constantly monitor its orientation and movements and calculate adjustments. I bought a GY80, a low cost 10DOF sensor module from eBay for this task. (Most crucially, it contains an accelerometer and a gyroscope).
To connect all of these different components to the Arduino, I created by own shield using stripboard. This is good because it also gives me space to add more features later.
With that, all the hardware required for the quadcopter to fly was gathered. The frame was assembled using M2.5 bolts (three for each arm), and 4 M3 bolts for the bracket. The first assembly is shown below, and future revisions are similar.
With the hardware more or less sorted, it was time to move on to software...which is where things got a little harder...My original plan was to program the the quadcopter from scratch, and following this path I was making progress. I had written my own drivers for the required sensors on the GY80, as well as code to control the motors via the ESCs.Unfortunately, a lack of experience in control theory made it quite difficult to implement logic to convert sensor data into motor balancing and control signals. Progress slowed as I continued to read into and test the complementary filters and PID loops I was trying to implement.
For the sake of progress (after spending a considerable amount of time on these problems), I decided to use open-source firmware instead. I'll leave the challenge of implementing my own firmware for another project, blog post and holiday...
MultiWii is the open-source software I chose to implement. It's a general purpose multicopter firmware capable of using the sensors in a Wii Remote and Nunchuck to support a wide range of configurations (e.g. tricopters, quadcopters, hexacopters etc.). It also made a good fit for the hardware I'd already chosen, since it primarily runs on an Arduino Pro Mini (functionally equivalent to an Uno).
After rewiring the shield where it was needed, and connecting everything together, I also added a receiver to control it. This fulfilled the hardware requirements.
Battling through a couple more problems, including the transmitter not seeming to respond to anything, it was ready for a round of test flights. An attempt is shown below.
I was trying to keep it level and balanced, but as you can see it was quite unstable. A design change I made soon after was to widen the base of the battery bracket, so that it could stand without pivoting on the ground. I also changed the orientation of the battery so that it was aligned forwards.
To tackle the instability, tuning and calibration started. The objective is two-fold: to reduce all vibration in the frame from the motors by balancing the motors and propellers, and to adjust the PID coefficients to give optimal performance.
Proportional Integral Differential loops are the feedback mechanism used here that determine what signal to send to a motor based on the current position of the quadcopter, and how far away it is from where it wants to be. e.g. if the quadcopter is tilting forward 10 degrees, and needs to return back to level, it will send an "increase speed" signal to the front motor, whilst sending a "decrease speed" to the back. These speeds will gradually return to the same level over time as the quadcopter returns to level.
Tuning these coefficients consisted of observing the copters flight, and making minute adjustments to the numbers based on how much it was oscillating or drifting. There are some excellent guides on doing this on Youtube. I was pointed to this one, which I found most useful in identifying problems. There are also articles and forum threads that explain in great depth exact how PID tuning works: Quadcopter PID Explained and Tuning.
Balancing the motors consists of using an accelerometer to measure the vibration of each motor, then adding weight to the motor to reduce the vibration.
After attempting these, I ran into the even bigger problem of two motors ceasing to spin. This turned out to be a fault with the motors themselves, and the supplier replaced them.
Another round of balancing on the new motors yields the final result.
It was a bit windy during filming, which as mentioned before due to the large propellers causes greater instability. Some tuning is still needed, but overall, its flying!The final, full spec is a follows:
- Custom ABS 3D Printed Frame
- x4 NTM Prop Drive 800KV Motors
- x4 11x4.7 Propellers and adapters
- x4 Turnigy Plush 25A ESCs
- Zippy Compact 4S 5800mAh LiPo
- Spektrum AR610 Receiver
- Spektrum DX5e Transmitter
- Arduino Uno FC with MultiWii 2.3, using a GY80 sensor module, mounted on a custom shield
- Custom (14awg) Wire Harness
The frame alone comes to around 110g, which I think is pretty good, though it admittedly does have slightly more flex than conventional frames. (In the end, the arms were printed with 100% infill, since they were breaking a little too easily when test flights went awry early on. This doesn't seem to have had any negative effects.) The whole thing comes to around 1.3Kg, the battery accounting for around half of the total.
I've yet to time how long a full battery lasts in continuous flight, so I'll update this when I find out.
12/10/14 - Went for a first full length test flight in one of the playing fields around the University today. On a full charge it seems like I can get around 25 minutes of flight time, which is far better than what I was expecting. I will be testing this again just to double check.
This turned out to be a much lengthier and time consuming project that anticipated. Starting from zero knowledge didn't make things any easier. Finally though, its finished, and seeing something you designed and built yourself fly is more than rewarding enough to have made it worth the frustrations.
Similarly to the 3D printer, I hope to use it as a platform for future projects. Autonomy and control by phone are just a couple that come to mind. I also may strap a camera on it at some point, and try my hand at aerial filming and FPV...