Custom ESC/Thruster Beeps? (DShot)

Hi, I am looking to use these tones as a tool to create particular alarms/tones inbetween static periods of the motor… can you connect me to a piece of code and/or direction as to how i can do so ?
cheers, andy

Hi @andybabbage, welcome to the forum :slight_smile:

The beeps are created by the ESC vibrating the motor back and forth, and the default beep sequences and levels are described in the firmware manual (see the BasicESC technical details tab). The ESC firmware already has an option to play a beacon sound after a specified time of zero throttle (default value is 5, so it never plays). If using the beacon is sufficient for your purposes, you can configure the beacon volume and starting delay parameters with BLHeliS Suite.

If you want actual control over when and how the beeps play, it seems like that may be possible with DShot commands (instead of the default servo-style PWM control we use), which is discussed a bit in this blog post. I haven’t used DShot before, so while I’m aware there’s some support for it in ArduPilot firmwares, I’m unsure about the setup and command specifics, and you may need to customise ArduSub to fully enable it and/or provide the control you want.

Alternatively, if you want the same set of beeps to happen every time, and don’t need explicit control over them, you may be able to modify the beacon functionality in the ESC firmware so that it plays your desired beep sequence instead. That would require re-programming the ESC, but would at least avoid needing to change code you’re using to control a motor with it :slight_smile:

okay thank you, yes I definitely want custom beeps, full control over timing, pitch and frequency. so as i understand blhelis suite is a firmware upgrade>? so can i upgrade this with your blue robotics esc, there is no need to buy a new esc, and im not sure how to upgrade the esc if there is no micro sd port… hmm

thank you kindly for your response

andy

apologize ignore the previous email. im learning on the fly here, i see you are running bhheli fireware on the bluerobotics esc.
also i see you can flash the esc via an arduino uno.

also it seems like in order to utilize Dshot i must physically remove the filtering capacitor from the ESC in order to move from analogue to digital communication used by the Dshot protocol as explained in this video.

Hi @andybabbage,

The second comment chain on that video says:

I would recommend against hardware modifications where possible, so in this case I’d recommend at least trying without the modification first.

In addition, I’ve just seen in the ArduPilot docs that

Which may cause some issues elsewhere, depending on your setup (e.g. ArduSub vehicles generally use a leak sensor on AUX pin 6, and that can’t be transferred to a MAIN pin (because they’re not capable of being used as inputs), so to use 6 motors you would need to not have a leak sensor (or write some code on the Raspberry Pi that reads the leak sensor on a GPIO pin, and then sends a MAVLink message when a leak is detected, which wouldn’t trigger the leak failsafe but would at least provide some warning).

That said, I suppose you may not need sound on all 6 motors, so maybe it’s fine to convert just one to DShot and leave the rest with normal PWM control or something? As mentioned - I don’t have experience with this, so enabling it may require modifying ArduSub (or whatever your flight controller firmware is).

I’ve just seen another comment:

so you may not even need to change the ESC firmware.

Recall that my original link to our BLHeliS Suite/ESC firmware flashing notes was in the context of changing the beacon times, and was unrelated to my notes about DShot being a potential option.

From the BLHeli_S firmware manual:

The link about DShot commands in my first comment was to this part of the BLHeli_S firmware source code:

I’m unsure whether our BasicESC runs 16.6 or 16.7, so I’ve asked about it internally. In the meantime you’re welcome to try using DShot control, and if that works you can try getting sounds working.

this may not be an issue as im currently only running 1x t200 motor, future expansion (may) extend to a second t200 motor running in sync, current ROV configuration is tethered to a line descending and ascending,

1 Like

Hi there,

From my understanding ‘dshot’ is another code/firmware the bluerobotics esc is already flashed with?16.7 BLHeli_S firmware,
So all i need to do is switch my connections from pwm to a digital pin

and figure out the correct command prompts to send the arduino?

I found the following information source on dshot esc’s

and also further commands, including 5x beep patterns.

I found the following library for dshot .h and .cpp files which i believe i can import to my arduino ide?

from the same website…

i have put together some test code for the above, however I really dont know what im doing… am i on the right track here?

#include <DShot.h>

/*

redefine DSHOT_PORT if you want to change the default PORT

Defaults
UNO: PORTD, available pins 0-7 (D0-D7)
Leonardo: PORTB, available pins 4-7 (D8-D11)

e.g.
#define DSHOT_PORT PORTD
*/

DShot esc1(DShot::Mode::DSHOT300);

uint16_t throttleStop = 0;
void forwardReverse();

void setup() {
  Serial.begin(9600);

  // Notice, all pins must be connected to same PORT
  esc1.attach(24);  
  esc1.setThrottle(throttleStop);

  esc1 beep1 -m 1
  esc1 beep2 -m 1

  forwardReverse();
}

void loop() {

}

void forwardReverse(){
  dshot reverse -m 1
  esc1.setThrottle(100);

  delay(2000);

  esc1.setThrottle(throttleStop);
  dshot normal -m 1
  esc1.setThrottle(100);

  delay(2000);
  esc1.setThrottle(throttleStop);
}

DShot is a communication protocol, which is at least partially supported by our Basic ESC. As I mentioned last year the beeping part of that command was added in Rev16.7 of the BLHeli_S ESC firmware, and from our technical details it seems that our Basic ESC uses version 16.6 (which has some DShot commands, but not the beep control ones).

For the DShot commands the ESC supports, if you want to make use of them via an Arduino then the “things to do” would be

  1. Find (or write) a DShot library for Arduino
  2. Connect the ESC’s signal wire to one of the Arduino’s digital pins, and configure that pin for use with DShot as relevant
  3. Make use of your selected library’s DShot functions in an Arduino sketch to perform the desired functionality

If the functions you want are not currently supported by your ESCs then you may first need to flash a new ESC firmware that includes them.

The commands provided there are specifically for the MAVLink Shell mentioned in that documentation, which can be used to communicate with a PX4 autopilot (running on a flight controller board) to tell it to send DShot commands to a given ESC (among other things). An Arduino has no such support (unless you’ve programmed it in), and an Arduino program’s source code is not a MAVLink Shell (so cannot use commands intended to be run in a MAVLink Shell).

Those files are from within the PX4 autopilot firmware project, so they include several components and functions from/for that firmware, which would need to be removed if there’s any chance of the files being usable in a freestanding way in an Arduino program. You would likely be better off searching for a DShot Arduino library rather than trying to use integrated drivers from some other project.

I’ve reformatted your code within a code block, so it’s readable within the forum.

Some of your code seems to make sense (assuming the things being used are accessible via DShot.h), but the dshot normal -m 1 commands and such are the MAVLink Shell commands I was mentioning earlier, and are unfortunately not valid C++ code that can be run on an Arduino.

1 Like