English
Español
yt_link
insta_link
fb_link
twitter_link
ADVERTISERS
Anet A8
DS203




AFFILATE
Gearbest Anycubic I3 MEGA Full Metal Frame FDM 3D Printer
Anycubic I3 MEGA Full Metal Frame FDM 3D Printer only $379.99 with coupon "Anycubici3ch"
Gearbest Anet A8 Desktop 3D Printer
Anet A8 Desktop 3D Printer only $145.99 with coupon "A8KIDA"


Gearbest Tronxy X3S Aluminum Frame LCD Screen  3D Printer DIY Kit
Tronxy X3S Aluminum Frame LCD Screen 3D Printer DIY Kit only $259.99 with coupon "GBX3S"


Gearbest Min DS202 Oscilloscope 113€
Min DS202 Oscilloscope 113€


Gearbest UTD2052CL DIGITAL 2-ch Oscilloscope 275€
UTD2052CL DIGITAL 2-ch Oscilloscope 275€


Gearbest UT139C True RMS Digital Multimeter 29€
UT139C True RMS Digital Multimeter 29€


Gearbest SBK8586 Soldering station Hot Air + Iron 63€
SBK8586 Soldering station Hot Air + Iron 63€


Gearbest BAYANGTOYS X21 Brushless RC Quadcopter
BAYANGTOYS X21 Brushless RC Quadcopter 153€


Arduino Drone V2.0


This tutorial is divided in a few parts:
3d printed drone arduino STL
Drone construction
arduino drone PID
Receiver PWM read
arduino PWM drone
IMU + PID control
arduino drone ESC pwm
ESCs PWM write






0.0 Intro

This is the second version of the previous Arduino based DRONE. In that tutorial we've build the transmitter, receiver and flight controller. The problem is that the flight controller code was a platform named MultiWIi. Now I want to create my own code for the flight controller of the Arduino drone and make it compatible with any commercial radio transmitter/receiver that uses PWM signals. Also compatible with any size, ESCs or brushless motors.



To make it more easy, I've divided the tutorial in a few parts. In the first part I want to show you how to read the PWM signal form a commercial radio receiver and transform that data into microseconds values in range from 1000us to 2000us. Next we will read the IMU data, create the PID and finnaly create the interruption that will write the PWM signal to each ESC.















1.0 Drone construction

The drone is 3D printed. The STL files are below ready to download. I’ve used PLA material to print the drone with a 20% infill and 2 perimeters. My Anet E10 printer have done a very good job. You will also need a radio transmitter and PWM receiver. 4 brushless motors. This are 18 mm diameter brushless motors. For a 250 size drone, are perfect. I’ve used 12 ampers electronic speed controllers, one Arduino NANO, the MPU6050 IMU and the AT10 radio controller with the R12DS receiver. You could use any other PWM output radio controller. You also need a LiPo battery, propellers, wires and maybe a switch.

Download the STL files here:




1.1 Part list

If you don't have a drone body, and you will use the 3D files above, I've made a list with all the components that you will need. Go to the link below for the full part list. I've selected the lowest prices for each part. Be aware that the drone that I'm building is a 250 one (250mm diagonal) so the motors are small, LiPo battery as well.

See the full part list here:




1.2 Schematic

Ok, in this project we won't use the NRF24 modules for the radio connection as in the past tutorial. Now we will use a commercial radio transmitter and reeiver. The one that I've used is an AT 10 version 2 from Radiolink. The receiver is the R12DS with PWM output. So the schematic of the drone is the one below. Make all the connections and then we start withthe code.

arduino drone schematic





Ok, now that we have the body let's begin with the code.