Arduino Micro Quadcopter
Arduino Micro Quadcopter
by Montvydas
https://www.youtube.com/watch?v=ILmSi4WMGPY&feature=youtu.be
Ma t e r i a l C ho i c e
When designing the frame there are a couple of considerations to make. The frame must be:
Light - obviously the lighter it is, the easier it will be to lift it up!
Sturdy - quadcopter tend to fall a lot and if it doesn't break after every fall - is it a huge plus.
Resistive to vibrations - otherwise it might be unstable as the motors do vibrate a lot. This also helps
to reduce accelerometer picked up noise.
In the past I saw quadcopters which frame was made from plastic, carbon bre, some sort of metal, PCB or a
combination of these. Because I wanted to learn about 3D printing too, I decided to design my own frame and then
print it using ABS plastic, however PLA should also be good. I didn't do a PCB only based quadcopter as that would
increase the overall price of the PCB printing plus if one part broke... the whole quadcopter would have to be
thrown away.
3D Des ign
Using 3D printer allowed me to design the quadcopter in any shape and form I wanted. The weight of the frame
that I designed was around 10 - 15 g however it will vary slightly depending on the printer settings and the plastic
used to print it. For the design I used a free web design tool TinkerCAD, which is super easy to use and I encourage
using it for beginners or for smaller projects. For more professional designs you could also use AutoCAD (Paid) or
Blender (Free), the latter being open source and free to use is a huge advantage in my perspective, however the
learning curve is way more gradual when compared to TinkerCAD.
I added the design les here so that you could go and print it right away yourself. However if you want to look into
the design from all angles then visit Thingiverse. Likewise, you can visit TinkerCAD to modify my previous design
the way you like it.
For a single quadcopter you only need to print Quadcopter_bottom_3.stl. Other parts are optional as they do not
add any value and are there more for the looks. Also note that the screws were printed very poorly and thus I could
not t them through the designated holes. I redesigned the bottom part so that you could stick in the top part and
then could simply use some plastic ties, wire or even electrical wire if you intended to use it - note though that each
part adds unnecessary weight.
View in 3D Download
https://www.instructables.com/ORIG/FS6/UXEB/IGL8J36O/FS6UXEBIGL8J36O.stl
…
View in 3D Download
https://www.instructables.com/ORIG/FV1/B63F/IGL8J3D1/FV1B63FIGL8J3D1.stl
…
While researching some things I noticed some very similar or otherwise very interesting projects such as this one
based on MultiWii project, Craz y ie 1.0 and Cracy ie 2.X or another hobby project. These are given here as a
reference if you wanted to nd other components which could be used for your projects or if you get stuck
somewhere. When deciding each part for my quadcopter I will include its weight, if it is larger than 1g. Otherwise I
will simply omit it as it's very insigni cant.
Mi c r o c o n t r o l l e r & C o n n e c t a b i l i t y
When I started this project initially I used a clone of Arduino Nano, which doesn't include any communication
module, thus I wanted to use HC-06 Bluetooth 2.0 slave module. However these days way better alternatives
include such as:
Bluno Nano, which has. built in CC2540 BLE chip. The cost is around £27.
BLE-Nano, which is a Chinese clone of Bluno Nano. On Aliexpress it's available for ~£4 including
delivery!
RF-Nano, which is available for ~£4 on Aliexpress including delivery.
Nano 33 BLE, which runs a lot faster than than the above processor nRF52840. The cost is around £17.
Nano 33 BLE Sense, which is very similar to the Arduino Nano 33 BLE but it additionally includes
some more sensors such as accelerometer and gyro, thus wouldn't need to add externally. The cost is
around £27.
I thought that Beetle BLE was another interesting choice, however they only have 2xPWM output, thus controlling
4 motors isn't possible without extra circuitry, thus not worth the pain in this project. I went along with BLE-Nano
for their low price and connectability to a smart phone using BLE. On top of that, these chips no longer have the
CH340 chip which was typically inside the clone boards and was used as both USB-to-Serial converter and 5V to
Arduino Nano Quadcopter: Page 3
3.3V LDO voltage regulator, which could supply up to 25mA of current without dropping the voltage. This means
there is no need to install the CH340 drivers and the used new LDO SP6205 can now supply up 500mA. They also
nally use micro-USB rather than the old fashioned Mini-USB (about time!).The weight of each chip varies barely.
Also note, that RF-Nano utilises pins 9, 10, 11, 12 and 13 for talking to the RF module, thus utilising these pins for
PWM is not possible - you will have to nd a workaround such as using an external PWM chip or using Software
based PWM.
If you do not care about the money, I would recommend going with their the Nano 33 BLE or the Nano 33 BLE
Sense (you will have to modify my code a bit..), but I wanted this to be as cheap as possible. Plus if I ever wanted I
can simply replace the Nano to a di erent one without needing to remodel the PCB - that's the beauty of using
Nanos for Quadcopters!
I think if not choosing Nanos other great choices for microcontrollers (and I think in the future I will redesign the
schematics and PCBs to work with these) would include:
Particle Xenon - based on nRF52840 with built-in BLE this is a great dev board which costs around
£11.Sadly it's being discontinued and I think you should buy a couple of them as they're great.
Adafruit Feather nRF52840 Express - this and Particle Xenon are rather interchangeable. Although
the connection pin number vary, they will behave pretty much the same.. The price however closer to
£22.
ESP32 - This is another great chip and it has many modules, most popular ones being Lolin32
variants. It has built in BLE, Bluetooth and WiFi thus making this a great choice.
ESP8266 - This chip does not support BLuetooth in any way, however it does support WiFi. It probably
can be described as a younger brother os ESP32...
The good thing about the above modules is that they are slightly wider and due to this our IMU can be easily tted
underneath thus saving a lot of space. Not only that but they already pack a battery connector (would need to nd
out the connector current rating though), battery charger, voltage level detector and many more. On top of that
they can alternatively be programmed using Microcpython (ESP), Circuitpython (nRF52840) and others, thus I think
they might be a great choice for the future. Not only that but the BLE built inside most of these support something
called HID mode, which would allow to connect them straight to pretty much all gaming controllers for phones or
PS4 thus removing the need of the phone altogether. I think they are great choices of chips.
Mo t o r s
I got two sets of motors, one being from Micro Motor Warehouse (later called MMW motors) and another was a
replacement for Hubsan X4 (later called Hubsan motors) from Ebay. Both them were 8.5mm x 20mm in size also
known as con guration 8520. The MMW set was not cheap (~£25), however the motors are supposed to be a lot
faster and have more thrust than the Hubsan ones. The weight of my quadcopter is a bit larger, thus I may need
fast motors to lift up the weight, however I will test both motors to see if Hubsan is su cient as their price is only
around ~£4 per set. If faster motors are required, there is an option from the same place as MMW - these, however
note that thrust is the same thus you won't really see much di erence. Another way is getting from TinyWhoop
shop, however the motors are smaller. When buying motor sets the most important things (from most to less
important) which you need to take a look are:
In e r t i a l Me a s ur e me n t Un i t (I M U)
Essentially IMU is used to calculate the angle between the quadcopters each axis and the ground. Normally IMU
used inside quadcopters must have at least two elements - an accelerometer and a gyroscope. Not going too much
into the details on how IMUs are made it is worth noting that:
This is why IMUs come equipped not with one but two sensors - some clever algorithms are being performed to
merge the sensor values together to acquire a smooth and reliable angle values over even very long periods of
time.
Another important factor is placement of the IMU sensor within the quadcopter surface. This is no simple maths
but its analysis you can nd here. In short though, accelerometer sensor must be place as close to the centre of
mass as possible as otherwise due to centripetal acceleration the rotation of the quadcopter will be measured as
acceleration even though the quadcopter will actually not be moving at all! Either this or additional maths would
have to be used to remove this component from the nal result. I will try to keep the accelerometer as close to the
mass of centre as possible, however I believe that in out case this will not add that much of extra inaccuracies as the
quadcopter by nature will try to keep it's rotation angle in alignment with the Earths surface while not in motion -
otherwise it would fall. Well, unless you're performing some tricks I guess! Otherwise can always place it on the
second layer of the PCB aka The Upside Down!
For the project I used a very popular and cheap MPU6050 IMU, which includes a 3-axis Gyroscope and a 3-axis
Accelerometer. One might be interested. in using MPU9250, which additionally includes a 3-axis magnetometer
(measures the magnetic eld), however indoors these do not very well due to existing magnetic interference from
Bat t eries
Choosing adequate batteries is very important as wrong batteries will not allow the motors to draw enough current
to light up the quadcopter and on top of that there will be huge voltage drops, which will keep interfering with the
electronics. There are a few important points to note when buying them:
Type - there are many battery types such as li-po, li-on and even these come in shades. Rather
recently Graphene based batteries became available, which can withstand higher currents and have
higher capacity density. Of course the downside is the price!
Capacity (measured in mAh or Wh) - will determine how much energy is stored inside the battery. The
larger the capacity, the longer the quadcopter will run on a single charge. This will be proportional
to the size and weight of the battery and will also determine how much current can be drawn from
and into the battery.
Max allowed discharge (burst) and average discharge (constant) rate (C) - the rst determines peak
currents e.g. when quadcopter starts accelerating, while the latter determines normal operation
current e.g. quadcopter is kept constant in the air. There is often a rule of thumb that multiplication
of capacity and the discharge rate will give the current that the batteries can supply. To be on the
safe side also need to add 20% of safety margin - we do not want the batteries to explode do we?
Thus for example, if you had a battery with 200 mAh and 20 C of average/constant discharge, then
200mAh * 25C * 80% = 4A. Thus on average such a battery can supply 4A without issues. However,
this is just a rule of thumb, when very high currents are involved, we want the discharge rate to be
way higher, independently to the battery capacity. For example, I Previously tried Turnigy nano-tech
650mAh 1S 15c (thus according to our calculations 7.8A of current) with absolutely no luck. They only
managed to fully power a single motor, which meant that the discharge rate was simply too small.
Weight (g) - larger capacity batteries weight more, thus need to nd some which provide enough
ying time but still provide good ying performance.
Let's calculate which batteries to choose and how long the batteries will last. In our case the motors draw hundreds
of times less current than the electronics, thus when calculating the required discharge rate we only need to care
about the motor currents. Total max load current = 2.75A * 4 = 11A. Good battery capacity should range from 150-
350mAh and I chose a battery somewhere in the middle - 260mAh (how? intuition..). To simplify calculations I will
use 0.26Ah. This means I need 11A / 0.26Ah = 42.3C of max discharge rate. From this follows that on a single charge
they should last at least for 0.26Ah * 60min / 11A = 1.4 min. Doesn't seem a lot at all does it? I tested when I
attached the quadcopter with the threads to the ground and it seems like the numbers are reasonable, I really
couldn't hold the quadcopter in the air even 2min, however this assumes that the quadcopter is attached to the
ground and thus not only has to win over the its own weight but also resist the threads. Real world numbers should
be reading at least 3min of ight. I suggest buying batteries such as Turnigy nano-tech 300mah 1S 45~90C (9g) or
even Turnigy Graphene 600mAh 1S 65C (15g) which seem to be very promising as their discharge rate really high,
but I have't tested them. If you have extra cash, buy both Graphene and normal batteries the normal ones as the
graphene are lighter when compared to alternative batteries with the same capacity and provide a lot higher
discharge rates (at least on the paper). I didn't try them myself but would be really interesting to see how they
compare in reality as I think the battery I got with 35C discharge rate is a bit smallish as well. When choosing the
battery and propellers also take a look at this video, where various battery and propeller tests are being performed!
Connec t ors
The most used connectors for quadcopter are called JST. They're confusing because there are many types and
everyone mixes them and sometimes advertises one as another, but the most popular connectors overall seem to
be:
JST PH 2.0 2-Pin, which PCB female connector are through-hole, and JST PH 2.0 2-Pin SMT RA (Right
Angle), which are surface mounted (SMD). The rst also come in a 90 degrees rotate form. These are
the most popular ones by far IMO and I found them being used for both batteries and motors. The
MMW motors come equipped with JST-PH 2.0 2-pin male connectors. Not only that but if you notice
Wemos Lolin32, all particle boards and all battery supported Adafruit boards come equipped with
the SMD variant of this. We will use there for motors and will also add one for battery. Both are
available on Farnell, ebay or Aliexpress. Make sure you buy the correct connectors as shown in the
images as they're all called very similarly and some providers even name them the same...
JST Micro-T MX 2.0 2-Pin, which PCB female connector comes in SMD package only (Haven't seen
other). This is second most common battery connector, however I haven't seen them being used for
motors before. The good thing about them is that even though the solder mask is slightly di erent,
they can still be soldered on the same mask as JST PH 2-Pin SMT RA.
JST connectors like these. They are annoying as no name is usually provided thus have to always
inspect the images. Good thing is that their spacing is 0.1 inch (2.54cm), which is the same as that of
breadboards, thus they're perfect when testing as can be plugged straight into the power line! On
top of that, two 0.1 inch spacing holes can be added to the PCB to allow connecting these without
buying any special connectors. They do slip out easier than other connectors, thus they're better for
testing as they can be pulled out in case something goes wrong. The downside is that by accident
you might plug the connector incorrectly the other way around... Thus please don't drink before
plugging it in as you might fry the chips which were not protected by the special circuitry.
BT 2.0 2-Pin - these are used on large quadcopter due to their lower resistance and thus ability to
carry larger currents. We do not need those.
Some batteries might even come with double connectors. For my quadcopter design I didn't want to go nuts and
use di erent connector for everything. For the motors I used JST PH2.0 2-Pin through hole. Battery on the other
hand could come with various connectors and that's harder to maintain. I used to cut the existing connectors and
solder the preferred ones, but that's a bit annoying too. Therefore I will add two 0.1 inch holes to support JST
connector, which will be best for testing, and then JST PH 2.0 2-Pin - the same on as for motors as I already another
one of those connectors available. Of course it would be nice to be able to support all connectors, thus I will add
the connector parts in the Optional Schematic e if you decide to use di erent batteries.
Note that connectors will have to support large currents of up to 10A, thus always good to check if they're capable
for that. Other considerations when designing the PCB will be making thicker tracks for motors with no jumper
wires/vias to not a ect the performance.
Propellers
The propellers are di erentiated by their:
The recommended propellers for MMW were 55mm ones, such as for Hubsan quadcopter. I struggled a lot with
which correct propellers to get as the quadcopter didn't want to lift so I also ordered Walkera LadyBird props,
which are also 55mm. I checked this the previously mentioned video to nd out that they actually give more thrust
than the Hubsan and depending on the battery it can be somewhere around 3g per propeller thus in total giving
additionally 12g of thrust! There are, however even better propellers such as KingKong ones, however I didn't want
to use larger propellers because they provide a lot more thrust, thus being able to lift the quadcopter easier,
however will draw more current, thus might overheat the motors, thus I wasn't sure...
Total weight 1g
N- M O S FET s (J L C P C B A s s e mb l e d )
We need 4xMOSFET transistors also known as switches. They will be used together with PWM to supply the current
to the motors in peaks. Choosing them might be tricky and there are a couple of important points when when
choosing one for out application:
Maximum drain current it can supply (Id max), which in this case should be around 3A to support the
motor which can draw around 2.75A.
The Vgs threshold voltage, which has to be low, maybe somewhere around 1V as li-po batteries
voltage might drop to 3.4V at some point. If too large threshold is chosen Arduino won't be able to
turn the MOSFETs on enough to supply the required amount of current. It is always best to also
check the drain current (Id) dependency on the threshold voltage (Vgs threshold) as each transistor
will have a di erent response.
Drain to sink resistance when MOSFET is fully turned on (Rds (on)). This is provided under certain
gate to sink bias Vgs. Normally expect this to be around 0.032Ohm, however the smaller the better. If
you choose some MOSFET with Rds (on) equal to 0.3Ohm or so, due to motors running at 3A the
voltage drop over the MOSFET will be 0.9V, thus motors will not get su cient voltage drop over
them.
Note that MOSFETs always include a freewheel (also called yback) diode in the package, it is needed there to work
and if some schematic will not be including them, they probably still exist but are simply not shown. Also these
diodes protect the MOSFET from the surge currents coming from the motor coil, which will protect the MOSFET
from frying, so double plus.
On the initial board that I made I ordered SQ2310ES from Farnell as it has Vgs threshold voltage of 0.6V and could
supply 6A! This might be a little over the board but hey - if I wanted I could power any possible brushed motor with
them without any concerns! I also made a table with other good MOSFETs and their important characteristics. Some
of these were picked from the similar quadcopters and some came from the same family of chips or I stumbled
upon them on Aliexpress or JLCPCB. All these are 3-pin SOT-23 packaged, thus compatible with the later provided
PCB:
Note that all of them had Vgs threshold very small and can supply enough current to power Hubsan motors.
However to run the faster motors I would only recommend the ones that can provide currents of over 3A and has
smallest Rds(on) as then less voltage drop will be over the MOSFET itself rather than the motor. JLCPCB basic library
had AO3400A available thus I went with it. At the time of writing most popular MOSFETs on Aliexpress out of the
suggested ones were SI2300DS, SI2314, IRLML2502 and AO3400A.
Name // Max Ids (A) // Vgs thr (min-max) (V) // Rds(on) (Vgs = 3V, T = 25C) (mOhm)
NDP6020 // 35 // 0.4 - 1 // 22
IRF3706 // 54 - 77 // 0.6 - 2.0 // 10
IRF3708 // 52 - 62 // 0.6 - 2.0 // 12
IRLB3034 // 195 // 1 - 2.5 // ???
IRLZ44 // 36 - 50 // 1 - 2 // ???
IRL540N // 26 - 36 // 1 - 2 // ???
All these come in TO-220 package, thus it will be easy to solder them and they will withstand large amounts of
currents. I would recommend the ones that have the lowest Rds(on) as then they will dissipate less power and the
motors will be able to run at higher speeds.
P - M O S FET (J L C P C B A s s e mb l e d )
Because the used batteries can deliver tremendous amounts of currents we do not want to risk connecting the
circuit the wrong way around, which does happen by accident, thus it's important to design some kind of reverse
battery protection system. This can actually be done very easily using a single P-MOSFET transistor as discussed in
here. There are two ways to approach this though:
Install such a P-MOSFET which can supply currents of over 12A. NDP6020P would t for the purpose
with its very good Vgs but if you notice it is a TO-220 package through-hole component.
Only protect the expensive electronics such as Nano, IMU and pixels. In this case we can use pretty
much any P-MOSFET available as it would only need to supply up to 300mA of current at max.
For now I though we could at least protect the main electronics, which will make life a bit easier. To achieve that we
could separate the battery into two supplies, one unprotected, which will be used to run the motors, and the other
protected, which will be used to power the rest of the electronics. N-MOSFETs and the used Zener diodes will
If we go along with this design, some of good choices of P-MOSFETs would include AO3401A, SI2301CDS, SI2301DS,
CJ2301 or IRLML6401 and many others as it needs to provide up to 300mA of current at max with optional
components added. The AO3401A and SI2301DS were available at JLCPCB basic library thus I picked randomly
between the two. What you can also do is check the N-MOSFETs list I suggested and nd their P-MOSFET
alternatives (most N-Type will be even numbered e.g. 2300 and P-Type alternative will be odd numbered, thus
2301) as all of them will have low Vgs threshold.
R e s i s t o r s (J L C P C B A s s e mb l e d )
Resistors regulate how much current can ow between two points in the circuit. The current owing through them
also gives a voltage drop proportional to the current owing through them. There is a number of resistors we will
need to use for this project for various reasons:
C a p a c i t o r s (J L C P C B A s s e mb l e d )
Capacitors (later called caps) in quadcopters are used to lter out the unwanted high frequency voltage spikes on
the power supply, which would otherwise make Arduino and other chips unhappy. The voltage spikes are mainly
caused by the motors, which on top of causing noise due to brushes also take in a lot of current (12A in total!). Thus
Arduino Nano Quadcopter: Page 12
if care is not taken, voltage would uctuate signi cantly, sometimes in the order of hundreds of millivolts. This can
a ect video quality (if video transmission is used), communication between the base and the quadcopter (noise in
the transmission signal), the MCU (the chips could constantly get reset) and the IMU readings (noise on the ADC
inside the IMU for example).
Note that caps come in di erent types based on the dielectric material with most popular being ceramic,
electrolytic and tantalum ones. I strongly recommend watching this and this videos to see what a signi cant
change can be achieved with the right placement of the caps. There is also this article which I recommend on
checking out. From this post, we will need to sort out the voltage spike issue in two ways:
On top of that, we need to choose low ESR (Equivalent Series Resistance) caps for the design as motors run on high
PWM frequencies and capacitors will act as a very low value resistor for these type of spikes and e ectively short
them to ground. Note though that all capacitors have built-in parasitics such as resistance and conductance in
series with the capacitance. Therefore in high frequencies even though the capacitance resistance (to be more
precise - impedance) is low, due to the other parasitic components the resistance can never never go below a
certain point and sometimes even starts rising with the increasing frequency - pretty craz y.
Some articles recommend using ceramic caps whenever possible as they don't have polarity and have less
parasitics, thus will have better e ciency and will also lter out the ripple better. However they usually come in
lower values thus sometimes a tantalum cap could be used in parallel with a ceramic one. Electrolytic caps are used
as a last resort. Also note that you cannot just blindly go for one type of capacitors all the time - the right choice will
depend on the application e.g. in music industry di erent types of caps are preferred, ones which may have less
noise and ESR might not be such a huge concern.
Caps have to be placed physically as close to the target area as possible to be e ective. In this project will need to
add caps to these areas:
Note that all caps have to be installed as close as possible to the desired places. They cannot simply be be all put
somewhere in the corner as in many cases the chip might not be stable or might not work at all.
Total weight 1g
D i o d e s ( J L C P C B A s s e mb l e d )
We will need to incorporate a freewheel ( yback) Schottky diodes in between the motor legs to provide with the
current path when switching the motors o , this is also called snubber diode con guration. Check this video if you do
not know the di erence between each diode type, but main di erence from normal diodes is high switching
frequency capability (which we will need if we want to drive motors at high higher frequency) and lower power
dissipation due to lower voltage barrier.
Each of the motors have built-in coils, which induced electric eld spins the motor. However the coils store energy,
which opposes the current ow. When the current is switched o using the transistors, the opposing current needs
a path to ow, otherwise huge voltage spikes will occur due to these high currents. You can read some more here.
Normally a simple and for high frequency applications a Schottky diode is placed to provide this path and all of the
quadcopter implementations I saw do speci cally that. However there seem to exist better implementations in a
form of the zener snubber, which would lower down the currents even quicker than a simple snubber diode
con guration. You can read about it here, but for now this needs to be experimented on rst to see if it was to give
any better performance.
Choosing the right diode is a bit tricky and there are many discussions like this online. It's best note down these
characteristics from the datasheet:
I would recommend using SS family Schottky diodes SS12-SS16 (riskier side), SS22-SS210 (adequate) or SS32-SS3200
(safe side), SS52-SS5200 (an overkill safe). Note that these more or less follow the format of naming S S XY, where
number X refers to the maximum average forward current, and number Y multiplied by 10 is the maximum DC
blocking voltage. Though if there are more than 2 numbers this no longer applies.. From these SS14, SS210, SS34,
SS54 were available at JLCPCB, thus I just used SS34 as it was on the safe side without change in packaging size or
price. There are some others available e.g.1N5819 (riskier side), 1N5820-1N5822 (safe side) which are available at
both SMD and through-hole packaging.
C ha r g e r
You might already have a good chargers, however in case you don't you can always get something like this. It uses
JST type connectors, thus you will have to get the connectors mentioned before. Alternatively you could get a
TP4056 chip based module and solder the connectors yourself. They even come with a USB-C connector nowadays!
This might also come in handy in later projects as the chip can become part of the whole PCB in that case. Note that
other popular chips are TP4054 and TP4057.
I really wanted to design an on-board charger using TP4057, so that the battery could be changed through the
Arduino USB, however sadly Nano design is not very friendly with that.. As I mentioned before though Particle
Xenon, Feather nRF52840 Express and ESP series modules already include battery chargers, thus they could be a
better choice for this. The rst two additionally include battery level measurement circuit which saves a bit of space
too.
Note that you do not have to solder the following components for the quadcopter to function properly. These can
be added though if you wanted to add some extra functionality such as being able to turn the quadcopter o using
a slider switch or adding some Neopixel LEDs. The circuit schematic and the PCB was designed in such a way what
would not prevent the quadcopter from functioning if these components were not installed, thus you can always
leave the components unsoldered.
Ne o p i xe l s (O p t i o n a l S o l d e r i n g )
I thought it would be cool to y this quadcopter during the night from time to time (or just make it look cooler),
thus I also added a couple of Neopixels. These are tiny RGB (Red/Green/Blue) LED pixels with integrated PWM
controller (thus can adjust the brightness) inside of them. The beauty is that they only need one or two pins
connected to Arduino, depending on the used chip type, to control pretty much any shade and brightness of any
number of pixels connected in series. The other advantage is after setting the desired combination of colours
Arduino does not need to interact with them any longer, thus processing power can be used for something e.g.
controlling the quadcopter. I thought a nice way would be to have 4 Neopixels in total - two at the bottom and two
at the top, one on each direction. In the dark this would allow to always know where the quadcopter is facing,
which would ease the control.
Many variants are available and rather largish table with their speci cations can be found here and a video about
which ones are best is here. For this project I would recommend WS2812B (RGB) or SK6812 (RGB + White) and size of
5050 (5cm x 5cm) LEDs. Size 3535 (3.5cm x 3.5cm) is also available, but is more di cult to solder (thus more easy to
damage them while soldering) and is more di cult to nd when buying. Note though that there are two types of
this size, one with pins on the outside (Mini-HS) and one with the pins on the bottom (Mini). I do not recommend
the latter if soldering by hand. The LEDs require one pin from Arduino to control all of them. From the datasheet it
would need one external 100nF decoupling cap for each of the Neopixels. Remember from the Ca pa cit o rs
section that these are used to remove the power supply ripple. In this case I believe they are here due to pixels
using a rather signi cant amount of current themselves - each pixel can draw up to 60mA of current when Red,
Green and Blue LEDs are turned on at maximum brightness. In addition to that, from the suggested guidelines we
also need to place a resistor of value 300 to 500 Ohm in between Arduino and the input of the rst neopixel, it has
to be placed close to the Neopixel. Finally, a large decoupling cap is placed next to the power supply, but we already
included one and discussed before.
On Aliexpress these neopixels can be purchased for example from here or here or many other places.
P o w e r S o f t w a r e C o n t r o l (n R F5 2 8 4 0 O n l y)
One problem with the pixels mentioned above is rather large quiescent (turned o ) current of 1mA. This is ne
without power switch, however otherwise when the power is o , we need a way of turning these o . This can be
done through adding another P-MOSFET, which by default would be o but could be turned on using code
through one of Arduino pins. This is easily achieved using pull-up con guration where gate is connected to source
through lets say 10k Ohm resistor and is also connected to the Arduino through let's say 100 Ohms resistor (reduce
surge-in currents). We could either use another P-MOSFET (one is used as reverse voltage protection) or use a chip
with dual one P-MOSFETs such as APM4953. I will still use two chips instead as then there are more option to choose
from. On top of that I will basically create two separate power sources, one powering the motors and the nRF52840
dev board and another programmable powering the rest of the sensors and the LEDs.
A l t i t ud e S e n s o r (O p t i o n a l S o l d e r i n g )
When only using IMU to control the quadcopter two tricky problems appear:
Both of these problems can be easily sorted using a so called altitude sensor. This, depending on the quadcopter
size and type, will be of di erent type:
Barometer - pressure changes with changing altitude and through certain formulas the change in
altitude can be easily calculated. However barometer are best used for drones which are used
outside due to not being super accurate. On top of that pressure changes in time (weather), but this
change is rather gradual, thus doesn't impose much issues unless long ights are used.
Ultrasound sensor - these are by far the most popular. in Arduino community, thus probably
everyone already knows them very well. They utilise ultrasound waves together with TOF (Time-of-
Flight) algorithm to e ectively measure how long did the sound travel from the sensor to the object
and after being re ected came back. I do not like these as they're bulky, su er a lot from noise and
thus have a lot of false positives, cannot measure longer distances than around 1m accurately and
on top of that, the measurement accuracy is dependent on humidity in the air.
Laser sensor - I believe this is by far the best sensor to use for indoor quadcopter. It is also based on
TOF algorithm, however instead of sound it uses light, which speed in the air is rather constant. A
very cheap sensor that I already had is VL53L0X, which modules on Aliexpress can be bought for
under £1 and they are also available on Adafruit. They're small, light, measure the distance with great
accuracy, do not su er from the side re exions and can measure range for up to 1m. It also states
that 2m range can be measured when LONG_RANGE mode is enabled, but it works best in the dark.
One disadvantage is that they cannot tell the di erence between 0 and 5cm, thus when this distance
was reached we could program to land the quadcopter down. Another similar sensor is VL6180X, but
it's used more for short distances of 0 - 20cm and it also supports gesture detection. This sensor
would be more useful for landing/lifting operation. If we combined both would be amazing but
even having one of them would allow us. to add some nice functionality.
Of course I chose the latter variant. Both chips use I2C communication and thus we we do not need to use more
pins than already are being used as MPU6050 also uses I2C. I used the VL53L0X as I already had one. Just one thing
to note, we will need a decoupling capacitor to keep the voltage more stable next to the sensor.
P o w e r S w i t c h (No t a d d e d t o s c he ma t i c b y d e f a ul t )
Sometimes it is nice to have a way of turning the chip through some sort of a slider switch or a button. The rst is
easier to implement as usually it doesn't even require any extra components. Note though that these switches do
not have a very large contact rating current. For example switch MSS3-Q-T/R only supports up to 25mA, while our
circuit might consume more even without turning on the motors!
To go around this problem we could design a very similar circuit as the one which this product is based on here.
Schematic is added as an image there. The only di erence is that we wouldn't need the extra part of controlling the
turn on using an external BJT, thus that part can be removed. I redesigned the circuit slightly and added it to a
separate project if someone wanted this functionality replace the existing circuit.
LC Filt e r
an idea of also adding an LC lter as shown in the 3rd page of the Craz y ie 2.1 schematics (Note down the sentence
Filter the power supply 73kHz.) as this should remove the power supply ripple even more, however, I've seen videos
where it disproves this and some low ESR caps seemed to work better than this, thus for now I left it on a separate
project.
This circuit is actually an active low-pass lter, however it's being implemented in a very neat way. The circuit
behaviour is very nicely explained in this video. It is a way of "increasing" the capacitance of the existing cap by
hundreds of times by adding a single resistor and a BJT, Darlington Pair or a N-MOSFET. Of course the capacitance
isn't increasing, we would simply be decreasing the current owing into the capacitor. I haven't seen anyone using
this circuit in quadcopter design, thus I don't know how well it would behave but I think it's worth a thought when
needing to provide a very stable supply voltage for powering the IMU without adding any huge caps. On top of
that, the resistor could be replaced by an inductor (look above at LC lt e r ) and thus this might be a very neat
circuit indeed!
£4 (BLE-Nano) + £3 (MPU6050) + £20 (Motors) + £3 15g (frame) + 8g (PCB) + 20g (motors) + 12g (battery)
(Motor Battery) + £2 (Propellers) + £2 (MOSFETs) + £2 + 5g (microcontroller) + 2g (MPU) + 5g (extra) = 67g
(The rest of electronics + plastic) + £1 (Connectors) +
£3 (Charger) = £40 We managed to easily t within the 80g boundaries,
thus the quadcopter should be able to y happily.
Cheap Hubsan X4 Motors:
C he a p mo t o r s
£40 - £15 = £25 Provided thrust from motors is 34g per motor, thus
136g in total. 50% of that is 68g. Total component
I would say this is a rather good price as the weight will be more or less the same, maybe can add a
competing products cost several times more! smaller battery and that should still be able to t
within the 50% thrust boundary. It might not y as
Exp e n s i v e mo t o r s good as with faster motors, but oh well, you are using
For our quadcopter to y nicely there is a rule of at least 4 times cheaper motors!
thumb that 50 % of the max thrust of motors should
When designing the PCB care must be taken as this will directly a ect the performance of the circuit. Each module
and chip has to be connected to the correct input of nano.
Mo t o r s c o n t r o l l i n g P W M
Motor controlling MOSFETs will be controlled using PWM signal. There are available 6 pins with hardware built-in
PWM on nano pins 3, 5, 6, 9, 10, 11. We will only need 4 pins for the project, however in fact - for easiest
development there are only 4 "correct" pins to go for. You see, PWM uses dedicated Timers to set the PWM
frequency and nano has 3 such Timers, which use slightly di erent default (however possible to modify)
frequencies. I strongly recommend taking a look at Timer PWM Cheatsheet as my next presumptions will be based
on it. Right so Timer 0 (Default 976Hz) is used for pins 5 and 6, Timer 1 (Default 490Hz) for pins 9 and 10 and Timer
2 (Default 490Hz) for pins 3 and 11. To get best performance PWM frequencies for all motors have to be the same
as the thrust is frequency dependent as can be seen on this video. Because Timer 0 is also used for functions delay
and millis(), we wouldn't want to change its frequency as it would a ect the two functions. We would have to adapt
the code, possibly even change the used libraries, which rely on these two functions. Thus this gives us two options:
1. Using pins 3, 5, 6 and 11, keeping the Timer 0 default frequency of 976Hz but then upscaling Timer 2
to provide us with frequency of 980Hz.
2. Using pins 3, 9, 10 and 11 and either keeping the default frequency of 490Hz or upscaling both
Timer 1 and 2 to 3921Hz.
I don't know what's the best choice here, and from some of the sources it seems that the actual value isn't really
that important, however higher frequency will give smoother response and less noise as discussed in the forums.
Arduino Nano Quadcopter: Page 19
Therefore I will choose the option two and will also upscale the frequency to 3921Hz. Another good forum which
discusses how timers a ect and how can they be modi ed to produce di erent PWM frequency.
Note though that it is also possible to use software based PWM also known as Bit Banging (can read more of this
here), however it's more complicated managing the code as care must be taken not to a ect timings - I would
strongly discourage from this if possible. However also note that if you want to use RF-Nano chip, from the
schematics we can see that pins 9, 10, 11, 12 and 13 are already utilised for talking to nRF24L01 chip, thus the only
possibility of using it in this project is by either using an external PWM chip or using Bit Banging.
IMU
The used IMU MPU6050 communicates using I2C and to keep the libraries happy I decided to stick with the default
pins A4 (SDA) and A5 (SCL). I will connect the interrupt pin in case I will need it in the future. Nano supports
interrupts on pins 2 and 3 only as can be seen here. Therefore I will use pin 2 for it as pin 3 is PWM and it could be
used for something else e.g. ashing an LED! I found another project which uses identical con gurations here.
P o w e r i n g A r d ui n o
From the BLE-Nano Schematics we can see that the best place to connect the batteries is straight into the 5V pin.
We cannot connect it to Vin as it's expecting voltages larger than 5V as otherwise the voltage drop due to the
voltage regulator would be horrible and we also cannot connect it to 3.3V, because Arduino itself is being powered
from the 5V line rather than the 3.3V line, thus then Arduino wouldn't get powered at all.
Even though the chip powering Arduino Nano (ATmega328) can work o voltages in the range 1.8 - 5.5V, there are
certain protections built-in to prevent it from running at too low voltages. The lower acceptable voltage before the
chip stops working is called brownout voltage. On Arduino this is set to 2.7V. In our project the voltages might drop
for short periods of times (milliseconds) close to this point, which might cause the Nano to restart. To prevent this
from happening I might need to set the brownout voltage to be 1.8V and this can be done as explained in this
comment.
B a t t e r y Le v e l D e t e c t o r
As previously said we will build a potential divider to measure the battery voltage. The input from the potential
divider will go into analog pin A0 and in the software we will set INTERNAL voltage reference.
Ne o p i xe l s (O p t i o n a l )
The input to the rst Neopixel will connect to Arduino pin number 5, however it could as well be connected to any
other unused pin.
I recommend ordering the PCB from JLCPCB, which can be done straight o the EasyEDA. The price is only $2 for 10
PCBs, which is really insigni cant. Right now I live in Spain and the delivery here costs around $10, thus not a bad
deal, even though I will probably only need one PCB... On top of that you could also select an option for the SMD
Arduino Nano Quadcopter: Page 21
components to be pre-soldered for you for a little bit of extra cost. I selected such components choices which were
available at the JLCPCB Assembled Basic SMT Type library, to keep this as an option. The only SMD part which was
from the extended library was the LED WS2812B, however not having one will not stop the quadcopter from ying!
You can also order them cheaply from the Aliexpress.
C o mp o n e n t S i z e
The PCB that I designed now will use SMD components of size 806. These settings are good enough to be able to
solder the PCB by hand. However you're welcome to redesign the PCB to your likings. I might even provide a PCB for
through-hole components, however tting everything becomes a lot more complicated.
None of the power wires should have vias, this is in order to reduce the wire resistance and thus
voltage drop over the wire.
The thickness of the wire has to be around 50 mil, however it will depend on which copper layer
thickness you choose. You can simply use online track width calculator to decide this.
It is a lot easier to solder all the components on an already prepared PCB. Sadly, getting an access to a machine to
make one is not always possible. We had one at the University, thus I designed a PCB using Target 3001! Software. To
open the *.T3001 le you will have to download Target 3001 software, which is sadly, only Windows compatible. I
might export the project to Eagle later. Adding Target3001, .xps, .tif and .src (export to Eagle) for those who intend
to make a PCB at home.
G r o un d S e p a r a t i o n
Note that it might be a good idea to separate the ground used by the motors and the other sensors as the noise
caused by the motors would then not a ect the sensors as discussed here. This however isn't very easy to do using
the easyEDA PCB editor as I tried and got clearance errors. Thus for now I kept this just as an idea in my head for the
future if the quadcopter fails to y...
The printed and soldered result looks as in the provided image. I added red circles showing the soldered transistors,
yellow circles showing the JST connectors for the motors, green circle marking the battery connectors, supplying
power to the motor ONLY, and blue circle marking the battery connectors, supplying the power to the rest of the
electronics (Arduino, MPU6050, etc.). As you can see, there is some xes made next to both of the power connectors.
You don't need to do that as the PCB was updated after making the rst working model. Basically, the problem was
that at rst the PCB only had a single power supply. During the testing it appeared that the Bluetooth module kept
constantly disconnecting from the phone as the battery voltage was dropping to low levels (< 3V). Not only that
but Arduino also had issues with that, which were xed by lowering brownout voltage. You can do that easily
yourself as it only required modifying a single le in the Arduino IDE, however it is more of a hack as the higher the
frequency, the higher voltage is needed. In the end, something else might break in the future or you might loose
all available power, etc. Anyway, implementing two-battery system worked nicely, especially that the battery,
powering electronics weight only around 3g.
When soldering on the motor connectors, make sure that they are soldered the correct way! On each side one of
the connector is facing one way and another another way. You have to ensure that pin 1 is always connected the
same side. I think it's best to rst place all of the connectors, then recheck them 3 times and only then solder.
Note that I market the battery connector with a plus to make sure you do not connect it the wrong way. I might add
a battery protection actually... Need to take a look into it!
Arduino Nano Quadcopter: Page 22
Fut ur e C o n s i d e r a t i o n s
In the future I might get rid o the 3D printed parts completely and will store all of the components on he PCB
itself. This will lower the weight dramatically, however it might increase turbulence and vibrations, thus care will
have to be taken to avoid these problems by lets say setting the PCB thickness to the largest available. Not only that
but will need to think of a way to attach the motors so that they stay securely on the PCB.
Download
https://www.instructables.com/ORIG/F4C/9ECX/J1MEWKEO/F4C9ECXJ1MEWKEO.xps
…
Download
https://www.instructables.com/ORIG/FLF/QTW4/J1MEWKRO/FLFQTW4J1MEWKRO.scr
…
Download
https://www.instructables.com/ORIG/F1K/JX54/J1MEWKS0/F1KJX54J1MEWKS0.t3001
…
Step 8: Software
Long time ago I wrote a library and an example program using mbed for a quadcopter which you can nd in here.
At the time though I didn't fully understand how PID worked when applied on Quadcopter theory. To develop the
Software now I took a look at existing projects such as
S e t up
Because I do not hate myself, I decided to program the Quadcopter using Visual Studio Code editor with the
R e a d i n g B a t t e r y Vo l t a g e
To perform analog measurement by default Arduino uses its power supply as a voltage reference. If we did not
change this setup when reading the battery voltage it would always be the same as our power supply will get lower
with the discharging battery. To solve this we need to use interval voltage reference. As discussed before on
Atmega328 this is equal to ±1.1V. The code for reading actual battery value and printing it into Serial port would
become:
#define BATTERY_PIN A0
void setup () {
// Set internal 1.1V voltage reference
analogReference(INTERNAL);
Serial.begin(115200);
}
void loop () {
Serial.println(analogRead(BATTERY_PIN) * REAL_BATTERY_MV_PER_LSB);
}
M P U6 0 5 0
MPU6050 library is available by Je Rowberg 2012. The provided example code MPU6050_DMP6 is used as the main
code for the project.
S t a b i l i s i n g Mo t o r s
In the control systems a PID controller is a very popular way to stabilise the system. In here we will want to stabilise
the pitch and roll of MPU6050. I used library PID_v1 for this purpose. In the code given below I will setup both
motors and PID controller. I will then add a function to stabilise the motors depending on the required speed.
//Define the aggressive and conservative Tuning Parameters<br>double consKp = 1, consKi = 0.05, consKd = 0.25;
PID pitchPID(&rollInput, &rollOutput, &rollSetpoint, consKp, consKi, consKd, DIRECT);
PID rollPID(&pitchInput, &pitchOutput, &pitchSetpoint, consKp, consKi, consKd, DIRECT);
void setup() {
//------------------------------PID----------------------------------
pitchInput = 0.0;
rollInput = 0.0;
pitchSetpoint = 0.0;
rollSetpoint = 0.0;
//turn the PID on
pitchPID.SetMode(AUTOMATIC);
rollPID.SetMode(AUTOMATIC);
pitchPID.SetOutputLimits(-20, 20);
rollPID.SetOutputLimits(-20, 20);
//-------------------------------------------------------------------
for (int i = 0; i < 4; i++) {
targetSpeed[i] = 0;
}
pinMode(FL_MOTOR, OUTPUT);
pinMode(FR_MOTOR, OUTPUT);
pinMode(BR_MOTOR, OUTPUT);
pinMode(BL_MOTOR, OUTPUT);
void loop() {
pitchPID.Compute();
rollPID.Compute();
int actSpeed[4];
stabilise (targetSpeed, actSpeed, rollOutput, pitchOutput);
// targetSpeed = actSpeed; // should this be here or not
}
void stabilise (int* currSpeed, int* actSpeed, float rollDiff, float pitchDiff) {
//actual Speed is calculated as follows +- half rollDiff +- half pitchDiff
actSpeed[0] = (int) currSpeed[0] + (rollDiff / 2) - (pitchDiff / 2);
actSpeed[1] = (int) currSpeed[1] + (rollDiff / 2) + (pitchDiff / 2);
actSpeed[2] = (int) currSpeed[2] - (rollDiff / 2) + (pitchDiff / 2);
actSpeed[3] = (int) currSpeed[3] - (rollDiff / 2) - (pitchDiff / 2);
for (int i = 0; i < 4; i ++) {
if (actSpeed[i] < 0) actSpeed[i] = 0;
}
}
void runIndividual (int* actSpeed) {
analogWrite(FL_MOTOR, actSpeed[0]);
analogWrite(FR_MOTOR, actSpeed[1]);
analogWrite(BR_MOTOR, actSpeed[2]);
analogWrite(BL_MOTOR, actSpeed[3]);
}
BLE Co n n e c t iv it y
BLE (Bluetooth Low Energy) is a completely di erent communication protocol from the old Bluetooth 2.0. Instead of
drawing a lot of power to maintain the connectivity to a host device it instead sends bursts of pulses. Each burst
might reach levels of 20-40mA, however they will be very short and will be send only a couple of times per second.
On average the energy consumption gets close to sub-mA level!
Communication from the quadcopter to the phone will be done through the BLE-Nano built-in BLE module. The
nano connects to the BLE chip using the built in Serial on pins TX and RX. Of course this slightly makes it more
di cult if you want to talk to the PC instead, however I will rarely need a connection to the PC anyway. An example
on how to receive an integer through BLE UART service and echo it back is given below:
Adding Bit s To g e t he r
As for the whole code, I am always working on it, so I decided not to add it ALL here. You can nd the latest version
of code in GitHub. I will notify in this Instructable when the code is nished. At the moment I need to setup correct
PID constants etc...
Ne o p i xe l s (O p t i o n a l )
A couple of libraries are available:
Adafruit
WS2812B
FastLED - it was designed to control di erent types of RGB LED strip, thus if in the future di erent
one was used this library would allow changing everything very easily. The downside is increased
memory use.
Sir what app did you used and if there was still no app how did you used the bluetooth terminal to
control the drone
And why is there nothing showing on the terminal?
Code compiles. Make sure you download all the correct libraries and drag and drop them into a
folder you create called 'libraries'
Hey,this is exactly the drone I want to make,but some of my components are a little different,i.e.
my Bluetooth module is a HM10,so please help me out with my build,I want the drone to work with
blynk smartphone app via Bluetooth with the complete code for putting together all these
components:
Coreless DC motors
Arduino Nano Atmega328P
MPU-6050 Gyro sensor
HC-SR04 Ultrasonic sensor
HM10 Bluetooth module
That's it,so please help me out on this,and make it simple,with the complete diagram and
components to build from like resistors/Voltage Regulators etc
Hmm...as long as i know that should not matter...as working of any buletooth module is the same
Hey,please give a complete list of all the components for the build,by the way can I use a different
sized frame for the build
Hey,add a ultrasonic sensor to the drone to avoid obstacles as a safety measure
Is the code ready? Is the code thats in github is working? Have you flown the copter? What the app
to controll the copter
Hi dear!
Can i use arduino lilypad as a microcontroller for this project??
Should be fine for as long as full code can fit in it. I can see that it has twice less memory (16KB as
opposed to 32KB)
apps?
hello, what is the mosfet you used? Will Irml2502 suit the motors?
And how did you get the thrusts of the motors?
Pls reply quickly...
If you still need it, yes Irml2502 should be fine. I added some example mosfets myself. I looked into
documentation for the thrust.
where do you buy that transistor?
can i powerup my arduino nano with 3.7v battery? it requires 5v regulated or 5v to 12v
unregulated.is it possible to use 3.7v on nano?
sorry, but I did not try that. Probably there is one from e.g. https://micro-motor-warehouse.com/
website depending on where are you living they might have something in stock.
Wow!!
Just what i was looking for, thanks for sharing. Keep up the great work...
How to make tranmister
I wouldn't recommend these mosfets as they have very high gate threshold voltage (2-4V) and as
mentioned before, we have batteries of 3V (dis-charged) 4.2V (fully-charged), thus in the case of a
bad luck we might not be able to fully turn the transistor on. Anyway, any resistor 1k, 10k, etc. will
be ok. (have a look, I modified slightly as to use 10k resistors in the instructable)...
can I use IRF530 mosfet transistors or TIP120 transistors?? because i will be using breadboard
instead of PCB board.
IRF530 have gate-source threshold voltage of 2V (Min) up to 4V (Max), so Arduino might not be
able to turn the transistor completely on. You may find that it works because you get good
transistors. You see, Li-po batteries only have 3-4.2V, thus they might not work, you would have to
install a voltage converter from 3.7-to-5V. TIP120 might work, but make sure you use correct
connections, also you may want to have a look into similar projects for driving motors such as
https://www.instructables.com/id/Use-Arduino-with-TIP120-transistor-to-control-moto/.
That's GREAT project, and I have all the parts at hand right now, except the motors...
But, I would like to explore the possibility of a custom made small transmitter/controller, utilizing a
small arduino board and a corresponding BT module (master) with 2 thumb joystick modules as
inputs.
Any ideas at to how could that be realized?
Any libraries or modules already exist?
There is too many options in here. What exact communication do you want? You might want to
explore Nodics... https://www.rapidonline.com/Seeed-113990011-nRF24L01-Module-2-4GHz-RF-
Transceiver-75-0422?IncVat=1&pdg=kwd-307993934394:cmp-757438067:adg-42338105440:crv-
i love it. I might need a bit of advice while building this. Instead of ordering gyro board I'm using
wiimote circuit. Same connections I assume?
Mhm, can you give me some more insight about how do you want to connect it? The whole
wiimote circuit or just the gyro?
Hi, I have a same build with an arduino nano, but i don't know how to share the same battery for
arduino and motor, could you tell me how to do that ?
Thank a lot
Right, so hopefully you have a 3.7V Li-Po Battery. Arduino nano works fine with this voltage when
it is connected directly to Vin pin (look into pinout schematic to identify which pin it is
http://christianto.tjahyadi.com/wp-content/uploads...
Now motors use lots of power which is due to high currents. This will drop the voltage on the
battery thus you needs some high value Cap (>20uF) to be placed in parallel to 3.7V and ground to
hold the voltage constant for the Arduino nano cause otherwise if the voltage drops too much
Arduino will reset.
So from that you can now know that to achieve this you need to connect 3.7V pin to Vin & to the
motor (well, a combination of motor and mosfet). Then add a cap in parallel close to the Arduino
nano.