esp version of DShotRMT
Go to file
Wastl Kraus 314e888a38
Merge pull request #6 from derdoktor667/dev
...Pause duration configuration
2025-07-19 13:28:26 +02:00
.github/workflows ...Pause duration configuration 2025-07-19 13:26:54 +02:00
examples/dshot300 ...Pause duration configuration 2025-07-19 13:26:54 +02:00
img Update README.md 2025-07-18 09:31:44 +02:00
.gitattributes Initial commit 2021-06-29 19:55:37 +02:00
.gitignore ...updated class to optimize configuration 2023-03-26 16:19:54 +02:00
DShotRMT.code-workspace More updates 2023-03-26 17:58:24 +02:00
DShotRMT.cpp ...Pause duration configuration 2025-07-19 13:26:54 +02:00
DShotRMT.h ...Pause duration configuration 2025-07-19 13:26:54 +02:00
LICENSE Initial commit 2021-06-29 19:55:37 +02:00
README.md ...Pause duration configuration 2025-07-19 13:26:54 +02:00
dshot_commands.h ...add dshot_commands Header File 2025-06-18 18:40:16 +02:00
library.properties ...Pause duration configuration 2025-07-19 13:26:54 +02:00

README.md

Arduino CI

DShotRMT - ESP32 Library (Rewrite for ESP-IDF 5)

This is a complete rewrite of the original DShotRMT library to support the new ESP-IDF 5 RMT encoder API (rmt_tx.h / rmt_rx.h).
The library sends continuous DShot frames with a pause between them and supports all standard DShot modes (150, 300, 600).

Now with BiDirectional DShot Support!!!

The old Version without encoding (rmt.h) is still available by using "oldAPI" Branch.


The DShot Protocol

The DShot protocol transmits 16-bit packets to brushless ESCs:

  • 11-bit throttle value
  • 1-bit telemetry request
  • 4-bit checksum

Data is transmitted MSB-first. Pulse timing depends on the selected DShot mode.

DSHOT Bitrate TH1 TH0 Bit Time (µs) Frame Time (µs)
150 150 kbit/s 5.00 2.50 6.67 ~106.72
300 300 kbit/s 2.50 1.25 3.33 ~53.28
600 600 kbit/s 1.25 0.625 1.67 ~26.72

Each frame is followed by a pause. This helps ESCs detect separate frames.

DShotRMT


Checksum Calculation

The checksum is calculated over the first 12 bits (throttle + bit):

crc = (value ^ (value >> 4) ^ (value >> 8)) & 0x0F;

Bidirectional DSHOT

Bidirectional DSHOT is also known as inverted DSHOT, because the signal level is inverted, so 1 is low and a 0 is high. This is done in order to let the ESC know, that we are operating in bidirectional mode and that it should be sending back telemetry packages.

Calculating the Bidirectional CRC

The calculation of the checksum is basically the same as before, but the inverted:

crc = (~(value ^ (value >> 4) ^ (value >> 8))) & 0x0F;

...biDirectional DShot is experimental. Further Hardware testing needed.

RMT on the ESP32

The RMT (Remote Control) is a peripheral designed to generate accurate and stable signals to control external devices such as LEDs, motors, and other peripherals. It is well suited for generating the DShot signals in a high-performance and accurate way on the ESP32 platform.

Advantages:

  • Hardware-timed pulses
  • CPU-independent signal generation
  • Loop mode with inter-frame pause
  • Reliable under system load

About This Library

This C++ library provides a simple class to generate DShot signals using any RMT-capable GPIO.
It uses a copy_encoder to continuously send a prebuilt symbol buffer. New throttle values are applied only when they change.

Supported Modes (optional BiDirectional):

  • DSHOT150
  • DSHOT300 (default)
  • DSHOT600

Frame Structure:

  • 16-bit DShot data
  • 21-bit times worth of pause

References


License

MIT License see LICENSE


Author

Wastl Kraus
GitHub: @derdoktor667
Website: wir-sind-die-matrix.de