Building a low cost beginners Quad – Multirotor


What’s the idea – Introduction

Multiwii quadTo build a reasonably good DIY beginners multirotor for a reasonable price.

This will provide a pretty good Quad multirotor for about NZ $250 with these key features:

  • Reasonably simple for a DIY Multiwii (open source) Quad.
  • Small enough to be a bit robust
  • Large enough to carry a Mobius or similar camera and/or FPV
  • Full set of sensors (including barometric altimeter, magnetometer and GPS)
  • Capable of altitude and position hold
  • Capable of return to launch
  • Configuration and adjustment using Bluetooth and Android App.

DON’T PANIC – IT’S NOT AS COMPLICATED AS IT LOOKS

This is not a high precision or high performance racing quad. It was built using readily available hobby parts, is low cost and easy to fly.

It can maintain altitude and/or position, and even come back to you when you loose orientation. It’s steady and docile enough to be easy to hover and fly, but also fast enough to keep up with many RC planes.

Flight time is easily 5-6 minutes on a standard 3-cell 2200mAh LiPo.

You will need a transmitter with at least 5 channels (6-8 is better) and one or two 3-position switches. I’m using a Turnigy 9X with ER-9X firmware.

The Bluetooth and Android App makes setup and tuning quite painless; very convenient.

Build time was about 3 hours assembly and 2 hours setup of the flight controller and radio (mostly the radio, Turnigy 9X with ER-9X). The FPV install took another 2-3 hours.

It flew first time with a bit of wobble but easily controllable and no unnerving tendencies.

So – What’s the catch

You have to use a PC or Laptop to configure and upload the flight controller firmware.

This is not complicated once you have a overall picture of how it works. It can be a bit frustrating getting it working the first time; considering USB drivers and cables. Before building the flight controller into the quad, connect the GPS and plug the USB into your computer. The USB port will power the controller and USB and you can experiment with the configuration and get it setup. Later on if need be you can plug the USB back in and reload the firmware (takes about 2min).

What is Multiwii? – The brains of the operation

Multiwii GUI configurationMultiwii is an open source firmware project that can control various multirotor or aircraft configurations. Open source means the programming code that makes it work is freely available for anyone to use or modify. There is a huge community of users and developers who have evolved it to this point and beyond. This project does not use the latest and greatest version as we need to keep the complexity and work involved within reason.

There is a free GUI program available (java) that runs on Windows, Mac and Linux that helps with setup and tuning. Shown here.

The Android App via Bluetooth does pretty much the same thing and doesn’t require a PC or USB cable.

You could connect the computer GUI via Bluetooth, but I’ve had no need.

An alternative to Multiwii (MWC) is Megapirate (MP); although I suspect MP has now been left behind by MWC and the newer 32-bit controllers.

Why not a KK2 or Naze32 board

The KK2 board is cheap and convenient due to the on-board LCD and setup buttons. The disadvantage is that it’s just a basic stability controller. It has limited sensors (no barometer or compass) and it can’t connect GPS or Bluetooth modules (no position hold or return to launch).

The Naze32 is a nice board with a higher powered controller; great for a high performance sport model. I believe it can use GPS and Bluetooth (requires the delux version board), but as it’s mostly a sports machine it seems more common in a minimal setup (acro version board). There are several control firmware branches for the Naze32, a similar learning curve and the boards are probably now easier to get.

Newer controllers – Update February 2016

In recent times the 32-bit controller prices have dropped and there are more choices of boards. Controller Firmware to look at may be Cleanflight and Baseflight. I hear the the Open Pilot CC3D has stopped development. There will no doubt be others and development will continue.

If I was doing this project again, I would look for a controller board like the Crius AIO (hardware features) but with a STM32 micro-controller. An improvement would be to separate the USB port from the UART so that the Bluetooth module does not have to be unplugged to connect via USB.

8-bit vs 32-bit

The original Multiwii and APM firmware runs on a 8-bit micro-controller. The newer boards like the Pixhawk and Naxe32 run a 32-bit micro-controller. The 8-bit chips handle the basic job of flight control OK. But as features are added and quicker responses are required for racing etc. they are running out of memory and processing performance. A 32 bit high performance chip does not cost more than a older, slower 8-bit chip.

The 32-bit micros have three advantages over the 8-bit chips:

  • faster – the 32-bit chips execute instructions faster. They also have a better instruction set making the firmware much more efficient.
  • more memory – as the feature list grows, more memory is required for the main program (flash memory) and the data that has to be stored during operation (ram memory) and the configuration data (eeprom).
  • better on-chip hardware features – this means more hardware timers, uarts and connection ports for sensors.

Parts Required and Cost

Most parts are from Hobbyking. Other than the ESCs, the flight controller and other electronics are better sourced from Ebay sellers. Hobbyking Hextronic branded copies of most of these are often early versions, lacking parts, features, quality, instructions and support.

  • Frame : $8.99 x2 = $18.00
  • Motors : $13.95 x4 = $56.00
  • Propellers : $2.79 x6 = $17.00
  • ESCs : $12.97 x4 = $52.00
  • Battery : $7.89 x2 = $16.00
  • Flight Controller : $36.00
  • GPS Module : $14.00
  • Bluetooth Module : $5.00
  • FTDI adaptor : $5.00
  • Total (exc. shipping) : US$219.00

Note: this list includes two frames and 6 sets of propellers; for spare parts. Get 2 colours of propeller sets so that you can have front and back clearly seen when flying.

You will also need a RC transmitter with 6 channels minimum and receiver. The RC should be capable of fail-safe setup if you want it tome return to launch upon loss of signal.

Computer – PC or Laptop – Android Phone or Tablet

You will need a computer for loading the firmware into the flight controller and configuring the bluetooth module. The Arduino programming IDE is pretty simple to use and runs on Windows, Mac and Linux. I’m using Linux.

The Android device is needed to run the APP. This provides some setup (configuration), tuning and monitoring. Don’t skip the Android APP – It’s about the most useful part.

Any cheap ($150) dual-core phone or Tablet will do, provided it has Bluetooth (they all should have). GPS is an added bonus and comes with most phones, but few of the cheap tablets.

quad frame 330Frame

  • Hobbyking: F330 Glass Fiber Mini Quadcopter Frame 330mm

This frame was chosen based on price, availability and size. The plastic arms are a bit flexible which is bad for stability and tuning but good for minor crash survivability. That said, it easy to fly and still quite stable; stable enough to mount a camera on.

The flex makes it difficult (near impossible) to tune out the last little bit of wobble, but we are not building a super-stable movie camera platform. When you have a bit of flight experience and break this frame, you may like to get (or build) a more rigid frame and transfer the electronics over.

quad motor 2209-980kvMotors and Propellers

  • Hobbyking: Turnigy Multistar 2209-980Kv 14Pole Multi-Rotor Outrunner
  • Hobbyking: red : 8045 SF Props 2pc CW 2 pc CCW Rotation
  • Hobbyking: yellow : 8045 SF Props 2pc CW 2 pc CCW Rotation

These are quite nice motor. The leads are flexible silicon wire with bullet connectors already fitted. The motor is supplied with a prop-mount.

I did find that some of the 2mm prop mount screws (3 per motor) broke. The heads fell off, very easily, without being tightened.

Spare prop mount screws – Hobbyking – M2x6 Hex screw, pkt of 20 for US$2.

quad propeller setquad propeller setThese propellers are 8″ x 4.5″. These work well enough but I will also get some 8″ x 5″ at some stage. These will provide a bit more lifting power with the same motors etc.

Buying two sets allows a colour mix to clearly indicate front/back orientation in flight. Also provides a spare set.

With motors under 1000KV or so, you can use higher pitch propellers.

Within reason, you won’t overload the motors or speed controllers in hover because the power required to hover is still roughly the same.

Afro 20A ESCESCs and Battery

  • Hobbyking ESC: Afro ESC 20Amp Multi-rotor Motor Speed Controller (SimonK Firmware)
  • Hobbyking Battery: Turnigy 2200mAh 3S 20C Lipo Pack

The Afro ESCs come ready flashed with the SimonK firmware. SimonK is a open source replacement firmware that provides rapid response control of motors for multirotors.

In this case I’m using standard 3-cell 2200mAh 20-30C Hobbyking blue Lipos. These provide 5-6 minutes of flight in this configuration (weight, motors, props); typical of this type of setup.

Crius AIO V2 flight controllerFlight Controller

Some may consider this flight controller overkill or outdated for a small quad. I chose it because it is low-cost, fully loaded and runs the well used Multiwii open-source firmware with a good feature set.

An alternative would be the Naze32. It is smaller and has a much faster processor, allowing faster more precise response. It’s cheap enough but often difficult to get, and doesn’t have the feature connections this board has.

GPS module

GPS

GPS and Bluetooth modules

This is just a standard low-cost GPS module.

Almost any GPS module will work when the serial comms settings match the settings in the flight controller. You probably won’t have to configure the GPS. Typically the baud rate defaults to 38400 baud. Just set the Multiwii firmware to match this on the GPS serial port (UART).

bluetooth moduleThis is another standard module. There are several slightly different models readily available.

I suggest don’t get the Hobbyking (Hextronic) Bluetooth module for use with the Crius AIO flight controller.

Here’s why.

The Hextronic board has a 3.3V serial connection that should not be connected directly to the 5V port on the flight controller. The board shown has level conversion built in and can be connected to any flight controller without risk of failure.

Assembly and Wiring

quad build assemblyCompared to a plane or helicopter, a multirotor is just less structure and a bit more wiring.

Be sure to vibration isolate the flight controller from the frame. There should not be much movement between the controller and frame but a layer of foam will reduce high frequency vibrations from the motors.

I have cut back some of the ESC  heatshrink to allow the power wiring to be changed. A small square of foam provides some padding between the ESC and frame with a cable tie holding it all in place.

The biggest part of the wiring assembly is connecting the speed controllers and power distribution. For this build I removed the ESC power wires and changed to 0.5mm stranded copper wire because it is lighter and easier to work with than the supplied wires that are too short. Volt drop is not a problem with this size machine (less than 30mV to each ESC at hover).

The ESC power wiring can be soldered directly to the battery connector. For this build I used a small board (my design) that monitors current and voltage and provides solder points for the ESC power wires. The current and voltage info is connected to the flight controller and appears on the FPV On-Screen-Display.

The battery sits on some stick on rubber bumpers to stop it sliding about and is held by a velcro strap.

The radio receiver can be in any convenient location that does not upset balance. The 2.4GHz RC antennas should be at right angles to each other and not obstructed by the battery or a clump of wiring. I have used short off-cuts of plastic tube and hot-glue.

quad build assemblyquad build assemblyThe flight controller is in the blue plastic enclosure on the bottom level, mounted with four 5mm thick double sided sticky soft foam pads. Wiring will also transfer vibration if you wedge it between the quad frame and the flight controller.

quad build assemblyquad build assemblyThe motors are simply screwed to the arms using the supplied screws. No Loctite as the plastic keeps the screws from coming loose.

Motor wiring to the ESC can use the supplied bullet connectors as shown, or the motor wires can be soldered directly to the ESC. But this requires removing the ESC heatshrink and some careful soldering.

The propeller mounts are screwed to the motors with the screws provided and Loctite.

Configuration

All configuration is done using the Arduino interface running on a computer (PC or Laptop).

IMPORTANT: unplug the Bluetooth module from the flight controller whenever connecting the USB. They share a port (UART) :IMPORTANT

What is Arduino?

arduino ide multiwiiArduino is a micro-controller programming language and environment. A simplified version of “C” programming for hobbyists. The Arduino IDE (Integrated Development Environment) is a Java program that runs on Windows, Mac and Linux. There are download and install instructions on the arduino.cc web site.

Aux Channel and Transmitter Setup

There are 4 Aux channel inputs on the Crius AIO controller board. One or two are needed to control the current flight mode. Each Aux channel recognizes 3 states, low-med-high. Typically this will be set up on your transmitter to be switches, 2 or 3 position. It depends on your transmitter.

I am using a Turnigy 9X with ER-9X firmware, one 3-position switch and two 2-position switches.

Switch1 1 2 3
3-pos.

Horizon

Manual flight

Will only arm in this state/mode

Horizon+baro+mag

Manual flight

Will maintain altitude and heading

Horizon+baro+mag+headfree

Manual flight (2 + headfree)

.

2-pos. #1 3-pos switch applies

Horizon+baro+mag+GPS-Hold

Auto position and altitude hold

Overrides the 3-pos switch

n.a.
2-pos. #2 3-pos switch applies

Horizon+baro+mag+GPS-Home

Auto altitude hold and return to launch

Overrides the other switches

n.a.

Flight Controller Setup – Arduino and Upload

The flight controller has a USB port on-board and just plugs in to the computer. The FTDI adaptor (or equivalent) connects the bluetooth, GPS and OSD modules to the computer for configuration if needed.

Arduino refers to the program that is Multiwii as “Sketch”. This is what you download and un-zip to a folder under your sketchbook folder. The sketch folder must have the same name and the main sketch file or it won’t work. The default should be OK.

Open the sketch from the “file” “shetchbook” drop down menu. This opens all the files making up the Multiwii project. The file called “config.h” is the one to look at, that determines the quad configuration and the type of flight controller board being used. In this case, Quad-X and the Crius AIO board.

To upload, you must select the correct processor and comm port from the “tools” drop-down menu and have the flight controller plugged in.

GPS Setup

It’s unlikely you will have to, but depending on the GPS module you have, it may be necessary to reconfigure the data rate (baud rate) of the serial interface. It is likely already operating at 38400 baud which is fast enough. You can set up the flight controller to work with this.

Bluetooth Setup

The bluetooth data rate is likely set to 9600 baud, which is too slow. You need to increase this to 115200 baud. This is done by connecting the bluetooth module to the computer using the FTDI adaptor and using the serial monitor in the Arduino IDE to send it a command to change it’s baud rate. It will remember the new setting.

Notes – References

Crius SE V2.0 intro and setup Youtube Video – here.

Before Attempting a First Flight

  • With propellers OFF
  • Ensure everything works and motor directions are correct
  • .Ensure that your transmitters is bound and correctly configured for the quad
  • Familiarize yourself with arming, disarming and have Horizon mode active by default
  • Calibrate the accelerometers (using the Android App)
  • If outside, calibrate the magnetometer (using the Android App)
  • If outside wait for a good GPS location fix (the Android App will tell you GPS status)

Multiwii Tuning

It should hover and fly with the default settings. Tuning is required to achieve the smoothest hover and/or flight. This involves adjusting the values of P, I and D. It is quite easy to adjust-test-repeat many times quite quickly using the Android App. 

Before trying to tune the flight controller, balance the propellers. The sensors inside the flight controller don’t like high frequency vibration. It will fly with some vibration, but you won’t be able to tune for the smoothest hover or flight.

Be careful of the propellers – they can do a lot of damage. The flight controller is in command of the motors. If you set it up to do something silly, it probably will.

What is PID – A PID Loop ?

PID stands for Proportional, Integral, Derivative. This is a feedback control loop used widely in industrial controls. It calculates the error and applies a proportional correction to maintain or achieve a target. The flight controller runs multiple PID loops to maintain stable flight.

  • P: the corrective force applied based on the current position error; more error = more corrective force applied
  • I: correction based on error and duration of the position error; slower to correct = more correction applied
  • D: effectively dampens the correction applied to reduce overshoot; .

In Multiwii version ?? setup the higher the values of P,I,D the greater the effect.

term range default using
P 0-20 3.3  
I 0-0.250 0.032  
D 0-100 23  

txt

Step-1 : initial setup

You should find that it hovers controlably with the default settings.

  • Start with the default PID settings
  • Run the accelerometer calibration on a flat stable surface before tuning anything
  • Hold the quad level firmly in one hand so that you can spin it up
  • Increase to hover power (when it gets light), keep holding firmly
  • Tilting it by hand you should feel it push back
  • Increase the pitch P bit-at-a-time until it begins to oscillate then back it off slightly
  • Do the same for the roll P
  • It’s now ready for flight testing and more precise tuning

Step-2 : in flight tuning

This is just hovering, landing and adjusting, then repeat; adjusting I,D and P as required. If you can’t smooth it out, you may have too much vibration. Reduce the vibration by balancing propellers and possibly motors. You may also need better vibration damping (foam) between the frame and flight controller.

Always land and disarm before changing the PID settings and uploading to the quad. It will not fly and update at the same time.

The type of flying you plan to do with have some affect on your setup; acrobatic or stable for video.

  • Increasing P towards oscillation, then reduce P or increase D
  • If you have to reduce P and increase D for stable flight, you possibly have too much motor/prop vibration

Advance Stuff

There are some advanced features, like auto-level tuning, but I wouldn’t worry about those until you have some flight experience.

Other tuning info/links

  • Tuning guide by Shikra on RCGroups: Here.

Before Every Flight – Important

  • Check all transmitter switches are correct (off/back) and power on the transmitter. Is the correct model selected?
  • Plug in the quad battery with the quad on a level surface and wait for the calibration (10-15 seconds)
  • Is the flight battery fully charged ?
  • Connect the Android App Bluetooth with the quad (can take a few shots – Bluetooth sucks)
  • Calibrate the accelerometers (using the Android App)
  • If outside, calibrate the magnetometer (using the Android App), well clear of large metal things (cars etc.)
  • If outside wait for a good GPS location fix (the Android App will tell you GPS status)
  • App dashboard-1 provides clear indication of what’s happening with the quad
  • Arm the quad on a level surface (this is the home position)
  • Fly…..

.

Extras

Low battery alarm

Strobe Light

Lost Model Tracker

FPV

.

Open Source Firmware (code)

I’ve commented before about open source, but here’s a repeat or a few new thoughts.

Closed source or proprietary means that the inner workings are a secret held by the designer or company that makes/sells it. Open source makes the code available so that anyone who wants to can look at and modify the code. Very few actually do. Popular or well supported open source projects like Multiwii tend to evolve quickly and identified problems are usually addressed quickly. Many minds contributing with one or two deciding what gets included and  when.

Closed source does only what the manufacturer allows and it often takes some time for bugs to be identified and resolved. Often models and features are code variations at different price points.

What’s wrong with Open Source

IMO: it’s often poorly documented, which can be a problem as it’s often more capable and therefore more complicated than the closed source version. Information is usually fragmented and spread all over the internet. To start out it’s very difficult to know what is good information. It’s sometimes difficult to simply find out what a project is, what it can do and where to get it. The people presenting and documenting these projects are technical wizards who would rather be working on version 2 than explaining how version 1 works.

Finding Information

My process involves beginning with Youtube for short introduction videos, then looking for more detail using Youtube, Wikipedia and then Google. Web sites that require reading and digesting are left until all else has failed. The best wb sites for useful information are often private blog sites, like this one 🙂

.