DIY Drones need to go Digital

Sahaj Sarup
|

In this blog I’d like to cover what is the current situation of the DIY Drone ecosystem. What I like and don’t like about it and how we can improve it.

Digital Technology Stuck In A Analogue Ecosystem

The current setup with a bog standard “DIY Drone Kit” is something along the lines of:

  • The user’s equipment:
    • A 8-16 channel 2.4GHz “Radio” Transmitter
  • On the drone:
    • A 8-16 channel receiver
    • 1 ESC Per Motor
      • ESC’s usually use a stm32f4 or similar 32bit MCU
    • Power Source, usually a multi-cell LiPo
      • The balance-change lead is connected to an alarm that sounds a loud and obnoxious alarm if any of the cells are below a certain threshold.

The control flow:

  • Transmitter:
    • Each stick, knob or button on the transmitter has a dedicated channel(s) on the 2.4GHz radio. So if there are 8 different controls, the transmitter would have 8 channels.
    • The position of the stick determines the PWM signal that is sent over its dedicated channel(s).
  • Receiver:
    • Also tuned at 2.4GHz and has the same number of channels as the transmitter.
    • Converts radio signal back to PWM.
  • ESC:
    • The ESC has ONLY ONE INPUT, and that is the PWM signal that comes out of the receiver.
    • The ESC does one of three things with the PWM
      • Goes into startup: This is sort of a motor priming step, any changes in the signal from here on will result in the motor spinning up. This is usually at the lowest throttle position during startup, 1ms PWM.
      • Actually spins up the motors: This is post priming, the ESC drives the motor depending upon the PWM input it receives. Ranges from 1ms being 0% RPM to 2ms being 100% RPM.
      • Setup Mode: This is usually to enter a mode where you can sync the transmitter’s min and max PWM signals to the ESC to make sure that the throttle response is accurate. This is the highest throttle position during startup, 2ms PWM.
      • Makes Beeping noise: ESCs vibrate the motors in order to make beeping noise, this is the ONLY output of the ESC.

The Actual Flying bit:

  • ESC calibrate: (First flight only)
    • The controller is set to its highest position.
    • The receiver is switched on.
    • An individual ESC is switched on, till it beeps a tune to indicate that it is in calibration mode.
    • Move the throttle to its lowest position and wait for the beep.
    • Move the throttle to its highest position and wait for the beep.
    • Power off the ESC.
    • Repeat the steps for all the other ESCs.
  • Flying:
    • Turn on the transmitter and the receiver.
    • Set the throttle to the lowest point.
    • Turn on an individual ESC, wait for the “Primed” tone.
    • Repeat for all ESCs one at a time.
    • At this point you can start flying the drone.

So, as you just read, even though the ESC itself is a 32bit Micro, the way it functions and the limitations it possesses are all affected by the fact that everything is controlled over a single PWM signal.



The Problems and Limitations.

Is PWM Communication Analog or Digital?

In my opinion, PWM Communication is an analog interface that is meant to be used with digital logic. It is the closest analog signal that can be natively generated by a digital system without using auxiliary circuitry like a ADC and DAC.

Why is it not digital? It doesn’t transmit data in bits… 0s & 1s. The transmissions relies on the amount of time the signal is held high during a cycle. in a 2ms wide cycle, 0ms is 0% pwm, 1ms is 50% pwm and 2ms is 100% pwm… and everything in between. Whereas in a digital communication standard, the data is transmitted in bits and each word can be represented as a set decimal or hex value.

Why is it closer to analogue? Sample rate doesn’t matter… as much. If the sample rate of the transmitter is 100HZ and the receiver is polling at 1KHZ, it can still interpret the PWM signal perfectly. It is a bit less lenient if the receiver is polling at a lower frequency, but as long as it’s not too far off, say 90Hz in this example. The receiver can still interpret accurately. Whereas in a digital communication standard, data transmitted at 9600 baud cannot be read by the receiver at 115200 baud and if the receiver is set to 9120 baud, it still won’t be able to read it.


Now that we have cleared up PWM, lets talk about how it is limiting the ESC.

  • My main concern starts with digitizing and fully automating the drone, making it smarter by removing the dumb receiver and adding in a MCU with a bunch of sensors. The obvious solution seems to be for the controller MCU to generate PWM signals for the ESC, but since the ESC outputs status and error codes only as beeps, how do you input that back into the controller so that it knows that the ESC is primed or there as been some error in one of the motor.

  • The second is the accuracy and asynchronous nature of PWM. Generating PWM pulses is highly dependant on the PWM IP in the MCU, the timer accuracy etc. The same goes for reading PWM signal. At some point the need for a faster update rate will result is extremely short pulses that will require specialized MCU to generate and read them, driving up the cost of the ESCs.

  • Limited ESC configuration options: with a single PWM pin being the only way to configure the ESC, most just have calibration as the config option. This leaves much to be desired from the Cortex-M4 based SoC powering the ESC.

  • There is also the potential for drone hijacking as the radio communication between the transmitter and receiver isn’t encrypted and can easily be interfered with.



Going All In On Digital

The How:

Modern MCUs (TBH even decade old MCUs) provide a bunch of full and half-duplex IO:

  • one-wire
  • I2C
  • UART
  • SPI etc

Any one of them can be used to provide high speed IO to and from the ESC.

This will allow us to create register based communication so we can write target RPM value to a register, say over i2c, and the ESC adjusts the throttle accordingly.


Advantages:

Here’s a few things I can thing about that can happen if we go digital:

  • Automated ESC Startup Sequence
    • The main controller asks the ESC to prepare for startup:
    • The ESC starts initialization:
      • Spins the motor at a low, pre-defined RPM
      • Uses a hall-effect sensor to read actual RPM
      • If the RPM matches, returns a success code to the main controller
      • If not, then depending upon the RPM sends a specific error code.
  • In-Flight Motor Status
    • The ESC can report back status like:
      • Actual RPM
      • Current Draw
      • Motor Temps
    • These in flight status will allow the main controller to decide if it can over-drive the motors or if it should limit the stress and under-drive them, and do this dynamically in real time.
    • In case of active ESC and Motor cooling, the main controller will be able to regulate that as well.
    • This will further help set different flight profiles, similar to that of a modern day sports car:
      • Long Range mode will under-drive the motors so that they don’t waste too much energy on heat.
      • Balanced mode: as it says a nice balance between range and performance.
      • Race mode: Pushes the motors to their absolute limits and disregards flight time.
      • And everything in between.
  • Motor spin up curve:
    • Using the digital interface between our main controller and the ESC we can create a motor spin-up map.
    • We can program it for:
      • Soft takeoffs and landing
      • Hard takeoff and soft landing
      • Damp or hard acceleration, etc.
  • Some other things like:
    • Firmware-less ESC: where the ESC firmware is loaded by the main controller during boot.
    • Encrypted Transceivers: where the commutation channel between the hand held controller and the drone can be encrypted.

Difficulties:

  • Cost: Everything from the transmitter to the on-board receiver will need to be re-engineered. The cost is not the matter of BOM, MCUs are extremely cheap. Its a matter of introducing an entirely new methodology into a well established ecosystem, thereby being at a risk of selling in lower quantities. The all digital drone dream would need to be very price competitive from the beginning.

  • Video Transmission: All FPV drones today use analogue video as it offers near-zero latency, albeit at craptastic quality. This is something that requires serious engineering and dough to achieve. It will not only help in streaming high quality footage but also help with in-flight visual inference.



In Conclusion

The Idea of a fully digital interface drone came about when I was building out my first drone, I was looking at the ESCs and thought to myself that a stm32 part on something as simple as a ESC is probably way too overkill and since then I was always under the impression that the ESC was able to do a lot more. And of course I was disappointed, when I finally started building the drone and was face to face with the limited functionality of the ESC.

Since then, I’ve had this idea of a Drone ESC Mezzanine that would provide a much smarter ESC which would in-turn enable us too make a fully automated and pilot-less drones for close the price of a FPV Drone. The 96Boards Drone project is a step in this direction, it has allowed me to analyse the current situation of DIY drones and provides a platform to carry out various tests and work towards a fully PWM free Drone.

There are some efforts along similar lines, most notable ArduPilot and PX4, but even they rely on PWM based ESCs.



This article is Part 2 in a 3-Part Series.

comments powered by Disqus