Taking the DShot, or how to use Betaflight DShot commands (from Drone April 2018)

In this piece for Drone, I took some of the knowledge that I had learned from doing a YouTube review on the Diatone GTR-90.  A lovely design of micro quad, but one that didn’t allow room for a beeper, and so I looked into how to use the DShot commands in order to give me an alternative.

 

Whilst updating the BLHeli_S firmware to the necessary level, I figured it would be useful to talk about turtle mode as well.  Although I’ve never been a huge fan of it for my flying, as it’s all too easy for HD cameras to come off in a crash and then you lose the position of where it might have come off.  For some flying though, it’s very useful and undeniably cool to play with.

One slight difference here, aside from my title of “How to use Betaflight DShot commands” changing to the snappier “Taking the DShot”, this article uses a few stock images I sent over to the magazine which fill space and break up the words.  These are just some quite random quads on the workbench, or in a field – but I haven’t included them in the blog version.

The other thing to not is that there were 3 “box out” sections in the magazine piece, which I’ve put at the end of the blog piece and coloured them with a blue background.


 

DShot is not just a super-fast digital ESC protocol. Recent updates Betaflight allow us to use specific DShot commands for some exciting new features.  Wayne Andrews explains how to configure your quad to take advantage of them.

Betaflight 3.2 was major software upgrade and brought with it some both exciting and potentially useful new features that went hand in hand with DShot ESC protocol.  The most headline grabbing feature was a new mode called “Flip over after crash”, although it’s better known as “Turtle Mode”

The concept of turtle mode is that in crash, if you end up on the ground upside down, then by reversing two of the motors and only powering those ones, you will generate enough thrust to flip you back to upright – where you can take off and fly as normal.

The slightly less well-known feature, but no less exciting is the ability to use the motors to act as a beeper.  If you are familiar with that little motor twitch accompanied with some startup tones when you plug in your battery – that’s the result of the ESCs rapidly energising and reenergising some of the windings in the motors at a specific frequency.

Whilst the actual setup of either of the features aren’t difficult, they do have their own list of pre-requisite levels of hardware and software support, and may require some firmware flashing on your part.  Happily enough, because most flight controllers have the ability to act as a pass-through device to your ESCs, this can all be done via one USB connection into your flight controller and a few pieces of readily available software.

 

Hardware considerations

Before we get started, there are a few things to check on the hardware side of things.  Firstly check whether you ESCs both support DShot and run the BLHeli_S firmware.  This information should be readily available from the manufacturers or vendors website.  Sometimes it’s even written on the ESC itself.

Another consideration is the flight controller itself.  Although, most modern flight controllers support DShot, there are a few that won’t without modification.  The Pico Blx is one such flight controller which is used in several of the popular King Kong Micro RTF quads.

If you can’t find out whether DShot should be supported on your setup, or if your ESCs run BLHeli_S then it’s possible to find out via the use of Betaflight and BLHeli Suite.

 

Checking Compatibility

Not sure if you can run DShot ?  We can check that by simply trying it.  We’ll need to connect up a battery and run the motors during the test, so before getting started, be sure to remove all the props from your quad to keep things safe.

To test if DShot works, goto the configuration tab and examine the ESC/Motor protocol drop down in the ESC/Motor Features box.  If DShot is already selected, then you know it works – but if not, select DShot600 and then click on the “Save and Reboot” icon.

Once rebooted, go to the motor tab, activate the “I understand the risks, propellers are removed – Enable motor control and arming” option and then move the Master slider gently upwards.  You should find that all motors spin up smoothly and perfectly in-sync.  Motors beeping, stalling and some of them not responding at all will indicate that DShot in not supported.

If you’ve got DShot enabled, then great – we’ll be back to revisit Betaflight for the setup in a little bit, but first we need to check we are running BLHeli_S, and it’s on the right version.

 

BLHeli_S support

To check our BLHeli_S version, we’ll need a copy of the BLHeli_S configurator.  If you’ve built your own quad, you may well already be familiar with it in the case you needed to reverse the direction of one or more of your motors.  If you’ve bought an RTF quad, you are less likely to have come across it – it’s basically the software that’ll let you upgrade the version of the BLHeli firmware and change some ESC settings.

You will need to start the software and once again plug a battery into your quad (keep those props off) so the ECSs are powered and can communicate with the software.  Once connected, click on “Read Setup”.  You should see a list of your 4 ESCs with a few details of each one.  Don’t be surprised if you see one or more of them set to reverse – rather than swap two motor wires on the ESC connection to reverse the motor, it can be done here instead, making for neater wiring.

These ESCs are running version 16.6 and need an upgrade

 

In the configurator, after each ESC it will list the firmware it’s running and the version number.  BLHeli_S uses particular naming convention for the various ESC firmware and this is the easiest way to determine if you are running BLHeli_S.

For BLHeli_S the naming convention is A-G (the type of Microcontroller on the ESC) followed by a dash, then L or H (depending on the MCU clock speed), followed by another dash and finally a number to denote the MOSFET switching dead time.  This is followed by the version of the BLHeli_S firmware it’s running.

In the example pictured, my ESCs were running the G-H-15 firmware, version 16.6.  The older BLHeli (without the _S) used naming conventions that made it pretty clear which ESC it was written for, for example “DYS_SN20A” was the firmware name, perhaps unsurprisingly, for a DYS SN20A ESC.

 

Let’s get flashing

Ok, so if we’ve got the necessary hardware to support DShot and BLHeli_S then next thing to do is make sure we are on the recent enough versions of Betaflight and BLHeli_S to support the DShot commands we want to use.

In BLHeli_S terms, you need at least 16.67 version of the firmware.  If your ESCs are at an earlier level, it’s not difficult to upgrade them.  You can do it directly from the BLHeli configurator.  Simply click on the Flash All button.  The software will ask what version you want to flash on each ESC.  In most cases it’s best to choose the latest version.  All the other settings should be retained automatically, but it’s best to make sure you keep a note of these (see Backing up)

After clicking on “Flash All”, select the latest firmware level and flash each of the ESCs

 

With the ESCs flashed to the correct version of BLHeli_S you’ll also need to make sure that you are running at least Betaflight 3.2.0.  Once again, the latest version is recommended.

If you have never updated your firmware before, don’t be concerned, it’s generally a pretty straight forward affair.  First, check which version of firmware you are actually currently running by going to the CLI tab and typing version.  Make sure you have your settings stored away (see backing up) Then click on “disconnect”, and then from the firmware flasher tab, find the firmware in the first drop down box that matches what the version command told you. Click on the latest version of the firmware – it should have “stable” in brackets to denote it’s not a beta/experimental version.

We’re ready to flash the latest Betaflight firmware onto the flight controller

 

Click on “Load Firmware [Online]” which will pull the relevant firmware down from the Internet and finally click on “Flash Firmware”.  After a minute or two you should be done, and you can restore your old settings and put in the extra configuration.

 

Configuring a DShot Beeper

If you’ve got a regular beeper, it’s not really worth adding a DShot version.  Where the DSHot beeper comes into it’s own is with very tight builds where there’s just not enough space to add one.

With no room for a traditional beeper on this micro, the DShot beeper was a perfect alternative

 

In order to do so, add the beeper mode as normal on the modes tab and setup a switch on your radio to activate it.  Ensure that RX_SET is enabled in the Beeper configuration section of the configuration tab. 

The final task is to go into the cli tab and modify the beeper_dshot_beacon_tone value.  You can check what this currently is by simply typing set beeper_dshot_beacon_tone

It will probably be set to 0, it’s default, which means it won’t sound at all.  The allowed range is 0 – 5.  Try it at 3 to start with  using the command set beeper_dshost_beacon_tone=3 and then type save to commit these changes.

Use the CLI screen to verify your flight controllers version and to activate the DShot beeper

 

You can now check the beep tone out, but powering up the quad and using your desired switch to make it beep.  A word of warning here, because we are putting a current through the motor without any cooling, it’s not recommended to either beep for long periods of time, or to set the beeper_dshot_beacon_tone too high.  Try the beeps out for a few seconds at a time, and feel your motors to check they aren’t getting hot.  If they are, try setting the beacon tone lower, or if they are cool but the beep isn’t loud enough you can try a higher value.  Just make sure you continue to check your motors at each stage to make they are staying cool.

One point to note is that whilst you can configure e DShot beeper using a mode switch, in a failsafe situation – where the default action is to disarm the motors and beep –  currently isn’t supported using a DShot beeper, but it is due to go into the Betaflight code base from version 3.3.

 

Configuring Turtle mode

So lets go ahead and learn how to flip our quad over when it crashes upside down.  First off you need to set a switch up on an AUX channel and add the range into the Betaflight modes tab.

Here we’re in the process of adding the Turtle and Beeper modes to a typical setup

 

It’s important to realise that this won’t get you back in the air under all circumstances.  For it to work at it’s best you need the right combination of quad and the environment you’ve landed in.  If you are down in long grass, then the props are likely to foul this grass and you’ll not get out.  What you don’t want to do in these circumstances is keep trying when it’s not working.  Give it a try, and if it doesn’t come good after a few goes, then walk over and retrieve your quad over the old fashioned way. 

Also remember that if you suspect anything has fallen off your quad, such as an HD camera, turning back over and flying away will lose your reference point to where it’s likely to be – so make sure that you are happy that aside from the quad being upside down, everything else feels right.

Having the right sort of quad makes thing easier as well.  Having a tall stack, or a GoPro sticking up at the top of the frame can actually help you when you are upside down.  The quad will tend to lean over one way or the other leaving 2 of the props able to spin fairly freely.

Try it out visually first, set you quad upside down as it might end up after a crash and see if you can turn it over using turtle mode.  There’s a specific sequence to go through in order to use it.

The perfect crash for flipping back over, with one side of the props free to spin

 

First disarm the quad, and turn your switch to activate turtle mode.  Next rearm the quad.  At this stage you can use the roll stick left or right in order to reverse spin the props on the side in question to try and flip back over (no throttle is require).  The props won’t have as much thrust running backwards, so it might take a little more stick that you might think.  Once you have your quad flipped over, disarm, disable turtle mode, and then rearm and fly away.  Once you are happy doing this visually, try it with your goggles on and make sure you can do it reliably before going out and trying it for real.

 


The Digital Solution

In the beginning, in order to communicate with your ESCs the flight controller would use the PWM protocol.  It was the standard, and at the time everyone was happy enough.  That is until a new protocol was developed called Oneshot125, it could run 8 times faster than regular PWM, and with the ESCs getting faster and more regular commands it made for smoother flights.  Whilst Oneshot125 should be considered the bare minimum for a mini quad today, the development didn’t stop there. 

Oneshot42 appeared  which ran up to 3 times faster than Oneshot125 and then Multishot; running up to 10 times faster than Oneshot125.  All these protocols, although fast, are analogue though.  The signals are susceptible to corruption from electrical noise and potential differences in clock speeds between the flight controller and ESC can result in the electrical pulse length being misread.

As DShot is digital protocol, it doesn’t work on pulse lengths and is more resistant to electrical noise.  DShot600 is very fast (multi shot is just slightly faster though) but, aside from the speed and reliability, the fact it allows these extra commands and means you no longer have to calibrate your ESCs make DShot very much worth using.


Backing up

Whilst performing the BLHeli_S firmware upgrade should keep your settings intact, it’s always a good idea to know what they are just in case.  There’s not a huge amount of info on screen here, and a simple screen shot will be enough to be able to restore any settings.

Betaflight is a different beast, upgrading your firmware can wipe out your current settings, and whilst you can save your info in a few different ways, exactly what you upgraded from and to have an impact on how well this will restore.

There is a backup/restore button on the setup tab, but this has had some issues in it on 3.2 levels, and doesn’t backup CLI changes, so whilst you can use it, don’t rely on it.  A better method is to type dump on the CLI tab, and then click on the “Save to File” button.  After upgrading you can paste this text file back in to the CLI prompt restore your settings (don’t forget to type ‘save’ after this)

However, depending on what changed in Betaflight, it’s possible that some settings you had used may have disappeared, or changed in the way they are set, so this still isn’t a guaranteed way of restoring.  The method I use, is to take a backup, run the dump command, and then take a screenshot of each of the tabs, so I have a quick visual reference and can check that everything has restored the way it should.


Chrome Finished

Both Betaflight and BLHeli configurator used to be available from the Chrome app store and ran under the Chrome browser.  It was a useful way of releasing a single version of software which would work on all platforms that could run Chrome.

With google removing apps from the store (although the apps can still be found via a google search) the development teams have now released stand-alone apps for Windows/MacOS and Linux available from these locations.

Betaflight – https://github.com/betaflight/betaflight-configurator/releases

BLHeli Configurator – https://github.com/blheli-configurator/blheli-configurator/releases/

2 thoughts to “Taking the DShot, or how to use Betaflight DShot commands (from Drone April 2018)”

  1. Is there any dshot command that can tell the ESC to reverse directly? I.e. I have an arduino communicating to a BLheli_s ESC via dshot that I want to rapidly drive forward then reverse then forward…. but I don’t see how to reverse the motor live. Any suggestions?

Leave a Reply

Your email address will not be published. Required fields are marked *