Sunday, December 7, 2014

Sunday, September 14, 2014

Aerial Video from DIY Quadcopter Using DroidX Smartphone Camera

In my earlier post, I described how I built my quadcopter from scratch. After experimenting with different hardware and configuration options, I now have improved its controllability. I also attached my old DroidX smartphone and took aerial videos. Ultimately, I would like to use a sports action cam with better resolution and greater viewing angle. In this post I will discuss the changes I did to make the quadcopter more controllable.

First, the video I captured using the DroidX smartphone:

Changes for flight stability improvements

Although I was able to fly my quadcopter, it was not easily controllable. My primary concerns were oscillations and poor response during altitude and direction changes.  

I tried different configuration parameters for the MultiWii flight controller. The open source MultiWii project provides a user interface, which enables users to update configuration parameters including the PID (Proportional/Integral/Derivative) coefficients of the controller (see MultiWii Configuration Reference). 

My starting configuration parameters were somewhat ad hoc. After unsuccessfull attempts to optimize flight behavior by adjusting the parameters, I settled on the default parameter combination (reset to default by using the smartphone application). Using the default parameters improved controllability. Any changes beyond the default parameters did not lead to noticeable improvements. Please also note that, resetting parameters require recalibration of the sensors, re-trimming the auto-level mode and re-configuring modes of flight controlled by the transmitter.

I also recalibrated the ESC's which did seem to improve stability. With these settings, I trimmed the transmitter and the auto-level mode, which reduced drift. Also, after more flights, I noticed that the oscillations were somewhat predictable and I was able to control the quadcopter better by not overreacting to changes, and also by using the altitude hold mode rather than trying to maintain altitude using the throttle.

In addition, the barometer on the flight controller was exposed to outside and was prone to be affected by the propellers. I covered it with a piece of plastic while allowing air to pass through. 

Although not related to flight stability directly, I enabled the failsafe in the flight controller which slows down and shuts down the motors in case the quadcopter gets out of range of the transmitter.

Attempts that did not lead to improvements

Initially, I tried the following hardware changes but did not see noticeable improvements, so I decided to keep my original hardware.

I have been using Slow Flyer propellers which are somewhat flexible. In case these propellers would wobble at high speeds causing unpredictable and random changes in flight behavior, more rigid GWS style propellers intended for higher speeds could perform better. I tried GWS style propellers but they did not lead to any improvement.

The discharge rate on my battery, and the motor / propeller combination should be and probably are sufficient based on the motor data available (please see Motor Calculations). Also, I am able to take off and hover easily. I still wanted to rule out the possibility that I may need a higher discharge rate to handle peak current consumption, i.e. higher rate of acceleration during direction and altitude changes. I tried a higher-discharge-rate battery, but it did not lead to any improvement.
More powerful motors can be another option to try. However, based on the motor calculations, and the fact that I am able to take off and hover, the amount of thrust should be sufficient. Also, using more powerful motors would reduce flight time. So I decided not to try different motors at the moment. I may revisit this option in a future new iteration with possibly a different weight class.

Crash during tests

I had one crash during test flights and replaced the frame and a damaged ESC and motor. This happened at high altitude and from a distance the crash appeared to be due to a motor failure as one of the motors was physically damaged. However, in other test flights at low altitude, where I was able to see the motors in the air, I observed one motor shutting down during normal flight. Therefore, I am not able to distinguish whether a physical failure of a motor caused the crash, or an electronic motor shut down caused the crash and damaged the motor in the process.

Currently I suspect the crash was caused by a motor shut down due to a software and/or configuration error, and may be directly or indirectly related to specific flight modes as they appeared to be correlated. I need to research this further. I will at some point re-download the most recent firmware and try the firmware with minimal changes (see MultiWii Configuration Reference). I also came across this FAQ entry calling out ESC settings as a possible cause for motor shut down and will try the proposed solution of re-configuring the ESCs later. This may also improve the quadcopter response during flight. [Update 12/07/2014: Adjusting the ESC configuration eliminated the motor shutdown problem.]


I was able to get initial aerial video. After I have more flying experience and possibly trying a fresh install of the firmware with minimal changes, and troubleshooting possible motor shut down, I will try aerial video with a sports action cam.

I was able to make improvements by:
  1. Restoring default PID (and other configurable) settings.
  2. Calibrating ESCs.
  3. Trimming the transmitter.
  4. Trimming auto-level mode.
I also covered the barometer to prevent any affect from the propellers. Furthermore, I am now able to use the altitude hold feature more effectively rather than trying to maintain altitude manually.

The different propeller type and higher-discharge-rate battery did not help much in my attempts to make the quadcopter more controllable.


a) MultiWii Configuration Reference

If you are interested in the MultiWii flight controller firmware, the project home page, wiki and FAQ may be good starting points. Also, please refer to the links for Roll, Pitch and Yaw PID tuning and auto-level trimming. 

Trimming the transmitter is adjusting the throttle, yaw, roll and pitch trim buttons repeatedly in the opposite direction of undesired movement. For example, if during flight, the quadcopter is drifting to the right, you need to pull the roll trim button to left until the drift is eliminated. This needs to be done in acro mode, i.e. basic mode without the auto-level enabled. I performed this procedure by repeatedly taking off and landing while observing the drift. Once transmitter is trimmed, you can move on to auto-level trimming. 

Initially, for each configuration change, I needed to connect the controller to a USB port on my computer, update the parameters, disconnect and go outside and fly to test the changes. In order to streamline testing different flight controller parameters I attached a bluetooth adapter to the flight controller. This setup enabled me to update the flight controller parameters using an application (MultiWii EZ-GUI) running on my smartphone, testing changes much more quickly.

In addition to the configuration changes that can be made to the flight controller with the firmware already uploaded on to the microcontroller, there are some initial changes that can and need to be made in the firmware before uploading it to the microcontroller.

b) Motor Calculations

NTM-350 750 kV motors with 10x4.5 SlowFlyer propellers should be able generate over 2200g of thrust using a 3S (11.1V) battery, approximated from data on This should be sufficient for my quadcopter which weighs around 1200g. My calculation is approximate as the voltages and the specific types of propellers I am using are different than the data available, but it should be in the ballpark. 

Also, with the current setup I am able to fly around 8.5 minutes, measured in multiple flights. On a 2200 mAH battery, this corresponds to 15.5 A current draw for 4 motors, 3.9 A per motor. This calculation is also approximate but is a good sanity check against the FlyBrushless data which reports GWS HD 10x6 propellers/7.9V/3.95A with 326g thrust (approximately per-motor thrust that would be needed for hovering).

Friday, July 25, 2014

Building a Quadcopter From Scratch

In this post I will describe a quadcopter I recently built. A quadcopter is a multirotor aircraft where lift is generated by four rotors. Two rotors spin clockwise and the other two counterclockwise. The motors are connected to a flight controller, which continuously adjusts the speed of the motors individually through the electronic speed controllers (ESCs) based on input from (i) a remote control receiver and (ii) sensors located on the controller.

Here is how it flies:

This work is currently in progress. I am able to fly this build but I need to spend more time learning how to control it better, and tune and configure it further. It may still be necessary to change some of its components.

Parts and Putting It Together

The final weight of the quadcopter is about 1200 g (~2.6 lb) including the battery. The distance between the two adjacent motor centers is about 11".
Frame and parts of DIY quadcopter built from scratch (frame, motors, propellers, battery, infrastructure components)

Parts of DIY quadcopter built from scratch (receiver, Multiwii 328P flight controller, electronic speed controllers, infrastructure components)

Disclaimer: This post contains affiliate links which means that if you buy products through clicking some of these links, I may earn an affiliate commission.
At the high level the build consists of the following components:
  • Two clockwise and two counter-clockwise propellers are attached to four motors.
  • Each motor is connected to an electronic speed controller (ESC).
  • Each ESC is connected to (i) the flight controller, and (ii) the battery.
  • The radio receiver is connected to the flight controller.
  • All of this setup is mounted on a frame.
I built the frame using 1/2" aluminum square tubes. I used 1/2x3” mending plates cut in half to connect the tubes. These mending plates are relatively light pieces, ~5 g as a whole and ~0.8 mm thickness, as opposed to thicker and heavier general purpose ones. I used 6-32 and 8-32 machine screws and nuts, and washers as necessary. I applied threadlocker to all screws and nuts to prevent loosening due to vibration.
The landing gear is made from 1/2” CPVC tubes. In order to mount the CPVC tubes to the frame I used matching tube end-caps directly attached to the frame using a single screw each. In some cases, the tubes fell from the end-caps so I should probably put a layer of tape to keep them in place.
I used 1/8” birch plywood for mounting the ESCs. I mounted the flight controller and the receiver on 1/8” acrylic sheet (red-colored sheet on the images).
The flight controller (MultiWii 328P, which runs the open source MultiWii multirotor flight controller firmware) is attached to the acrylic plate by foam tape. I used cable ties to mount various pieces and tidy up the cables. The battery is held in place by Velcro strips attached to the plywood.
The motors (NTM 28-30A 750kv, accessory pack) are mounted on the square tube directly using 6mm M3-0.5 machine screws. I only used the prop adapter from the accessory pack. I did not use the included cross-mount. I used 10X4.5” Slow Flyer Propellers (counter-clockwise, clockwise and counter-clockwise set) with the motors.
The ESCs (Turnigy Multistar 30 Amp ESC) are connected to the battery (Turnigy 3S 20C 2200 mAH Li-Po) using a breakout cable. This specific breakout cable has six pairs of cables to support hexacopters. Two of the pairs are not used in this build. Also, I replaced the HXT connector with an XT-60 connector to accommodate the battery.

Next Steps

In this post I have not covered details of a number of subjects such as integrating the transmitter, connector layout on the flight controller and its software configuration and any details on cutting/drilling of the building materials. I may cover some of these areas in the future.
Now I have the quadcopter flying, I would like to make it fly better. This will require more practice controlling it, configuring the controller software further and trying different components if necessary.  

Monday, July 21, 2014

Many Resources are Available Today for Building

Hi! I'm a software developer. I like technology and building things. I started this blog as a space to share my personal projects and thoughts on these subjects.

The resources available to today's hobbyist (maker, geek, hacker, builder) are very exciting. There are microcontroller platforms such as Arduino and its clones combining additional functionality into various form-factors. Single-board computers such as Raspberry Pi and BeagleBone Black are used to control the outside world in complex ways. There are diverse sets of sensors, motors and connectivity modules that can be integrated with these units. It is possible to have your own or open source circuit PCB designs manufactured in small quantities through various companies. 3D printing and laser-cutting are used to make custom parts. Purchasing rare parts and getting DIY instructions and product literature online are easier than ever, if not trivial.

Of course, hobbyists have been building robots, R/C vehicles and electronics projects for a long time. However, the new development platforms and processes are becoming very easy to use, affordable and ubiquitous. Easier access to these resources is lowering the threshold for entry, and increasing the sophistication level of what is available to build with. There are many smart, creative and inspiring hardware projects using these resources, many of which bring the hardware and software worlds closer.I am hoping to explore these resources over time. 

In my next post, I will write about a quadcopter I built recently.

Welcome to my blog and thanks for reading!