How to Control Any Drone From Your Arduino Microcontroller Using Bluetooth
Introduction: How to Control Any Drone From Your Arduino Microcontroller Using Bluetooth
Hello Everyone!!!
In this Instructable I am going to show you how I converted my (Commercial) RC drone that uses an RC radio system into a drone that is controlled by your Arduino using Bluetooth
Why would I want to control my drone from an Arduino?
I wanted to control my drone from an Arduino because I wanted to take a step into the automation of my drone. There was the option of building a drone and using the Arduino as the Flight Controller, but then I would miss out on all of the advanced features that the more popular firmware, like Betaflight, provides. This led to me thinking, "Why not replace the receiver of the drone with an Arduino, that way you still control the drone from your Arduino and you don't have to compromise on its performance". That was the idea, so let's see how we did it.
Supplies
This is a list of all the main supplies needed for this project:
* Arduino Uno
* HC-05 Bluetooth Module
* A Drone - I built my own FPV drone. Make sure the Flight Controller supports the PPM protocol and it supports Betaflight.
* A drone battery
* PCB Board
* Arduino IDE
* Betaflight Configurator
* A phone that supports bluetooth.
* A Micro-USB for data transfer
* 10k Potentiometer (Optional but recommended)
This is a list of all of the tools needed for the project:
* A soldering iron
* Soldering wire
* Wire strippers
* Electrical Wires (Male - Male and Female - Male)
* Multimeter (One that has a continuity tester on it)
* Electrical Tape
* Precision Screwdriver Set
Step 1: The Theory and the Idea
The Theory
The theory behind this project is to use PPM signals which will be generated by the Arduino to control the drone. The Flight Controller usually receives PPM signals from the receiver which receives data from the transmitter. If we can generate the same PPM signals that the receiver sends to the Flight Controller with the data from the transmitter, we can encode our own data onto the PPM signals from the Arduino and control the drone from the Arduino. This means that a conventional transmitter and receiver is no longer required to pilot the drone and we can use any method of input to control the drone.
Well what are PPM signals?
A PPM signal (or Pulse Position Modulation) is used by most transmitters and receivers to transfer information from the transmitter to the receiver.
PPM is a single-wire signal that encodes many Pulse Width Modulated (PWM) signals. It's commonly used in radio control of hobby aircraft and drones, where a radio transmits the PPM signal, which is decoded into many PWM signals to control RC servo motors.
The signal that is sent is a series of pulses of fixed length, which are measured in microseconds . In electronics these pulses are an electrical signal of varying voltage (somewhere between +2.5V and +5V seems to be normal).Between these pulses are pauses of varying length (also measured in microseconds). 120
In electronics these pulses are somewhere between 0V and +0.5V.
The data on this type of signal is encoded as the length of a pulse plus the length of the following pause. Or in other words: the time between the start of two pulses (or end, doesn't matter since the pulse is of fixed length). This is also the reason it doesn't matter whether the pulse is high or low; you simply pick either the rising or falling edge of a signal and measure the time between two rising or falling edges.
Channels follow each other in chronological order in the signal; i.e. channel 1 comes first, channel N last. The time between the pulses is used to generate a Servo Signal (in our case this signal will not control servos, but rather the motors on the drone). Pulses are usually around 500 microseconds in length (but as you will see in our case, the length might not always be 500 microseconds), the pauses are somewhere between 500 and 1500 microseconds. When you add those together and you get channel values of 1000 to 2000 microseconds, which happens to be the same range as used in Servo Signals.
After the last channel there's an End Of Frame (or Beginning Of Frame) pause. This pause is somewhere between 5000 and 20000 microseconds in length; receivers don't seem to be very strict with this. The pause may be of varying length, this way you can set a frame to a fixed length. Bear in mind that the longer the pause, the more latency you will experience, but the shorter the pause, the more unstable the communication will be between the Arduino and the Flight Controller. 71