esp version of DShotRMT
Go to file
Wastl Kraus 5c976e2cc9 Add note about unofficial bidirectional DShot support
Updated GEMINI.md to include a note under project-specific conventions, clarifying that bidirectional DShot mode is implemented but not officially supported due to instability and external hardware requirements. This serves as a reminder for the AI assistant when working on the project.

Add note about unofficial bidirectional DShot support

Added a comment to all example sketches to clarify that bidirectional DShot is currently not officially supported due to instability and external hardware requirements.

docs(README): Clarify unofficial support for bidirectional DShot

Updated README.md to reflect that bidirectional DShot is no longer officially supported due to instability and external hardware requirements.

Also, modified DShotRMT.h to default the is_bidirectional parameter to false in constructors and added comments to clarify its unofficial support.
2025-09-24 00:30:37 +02:00
.github/workflows feat(library): Add percent throttle, improve usability & fix bugs 2025-09-20 17:24:31 +02:00
examples Add note about unofficial bidirectional DShot support 2025-09-24 00:30:37 +02:00
img ...compare signals 2025-08-03 22:18:19 +02:00
src Add note about unofficial bidirectional DShot support 2025-09-24 00:30:37 +02:00
.gitattributes Initial commit 2021-06-29 19:55:37 +02:00
.gitignore Add note about unofficial bidirectional DShot support 2025-09-24 00:30:37 +02:00
DShotRMT.code-workspace More updates 2023-03-26 17:58:24 +02:00
DShotRMT.h Add Web Server 2025-09-10 15:32:01 +02:00
LICENSE Initial commit 2021-06-29 19:55:37 +02:00
README.md Add note about unofficial bidirectional DShot support 2025-09-24 00:30:37 +02:00
keywords.txt ...release 0.7.0 2025-09-04 14:41:05 +02:00
library.properties Add note about unofficial bidirectional DShot support 2025-09-24 00:30:37 +02:00

README.md

DShotRMT - ESP32 RMT DShot Driver

Arduino CI

A C++ library for generating DShot signals on ESP32 microcontrollers using the RMT (Remote Control) peripheral. It's designed for both Arduino and ESP-IDF projects, providing a simple and efficient way to control brushless motors.

This library is a rewrite using the modern ESP-IDF 5 RMT encoder API (rmt_tx.h / rmt_rx.h) for improved performance and flexibility. The legacy version using the old rmt.h API is available in the oldAPI branch.

🚀 Core Features

  • Multiple DShot Modes: Supports DSHOT150, DSHOT300, DSHOT600, and DSHOT1200.
  • Bidirectional DShot: Implemented, but currently not officially supported due to instability and external hardware requirements.
  • Hardware-Timed Signals: Precise signal generation using the ESP32 RMT peripheral, ensuring stable and reliable motor control.
  • Simple API: Easy-to-use C++ class with intuitive methods like sendThrottlePercent().
  • Efficient and Lightweight: The core library has no external dependencies.
  • Arduino and ESP-IDF Compatible: Can be used in both Arduino and ESP-IDF projects.

📦 Installation

Arduino IDE

  1. Open the Arduino Library Manager (Sketch > Include Library > Manage Libraries...).
  2. Search for "DShotRMT" and click "Install".
  3. Alternatively, you can clone this repository or download it as a ZIP file and place it in your Arduino libraries folder (~/Arduino/libraries/DShotRMT/).

PlatformIO

Add the following to your platformio.ini file:

lib_deps = 
    https://github.com/derdoktor667/DShotRMT.git

Quick Start

Here's a basic example of how to use the DShotRMT library to control a motor:

#include <Arduino.h>
#include <DShotRMT.h>

// Define the GPIO pin connected to the motor ESC
const gpio_num_t MOTOR_PIN = GPIO_NUM_27;

// Create a DShotRMT instance for DSHOT300
DShotRMT motor(MOTOR_PIN, DSHOT300);

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

  // Initialize the DShot motor
  motor.begin();

  Serial.println("Motor initialized. Ramping up to 25% throttle...");
  
  // Ramp up to 25% throttle over 2.5 seconds
  for (int i = 0; i <= 25; i++) {
    motor.sendThrottlePercent(i);
    delay(100);
  }
  
  Serial.println("Stopping motor.");
  motor.sendThrottlePercent(0);
}

void loop() {
  // Your main code here
}

🎮 Examples

The examples folder contains more advanced examples:

  • throttle_percent: A focused example showing how to control motor speed using percentage values (0-100) via the serial monitor.
  • dshot300: A more advanced example demonstrating how to send raw DShot commands and receive telemetry via the serial monitor.
  • web_control: A full-featured web application for controlling a motor from a web browser. It creates a WiFi access point and serves a web page with a throttle slider and arming switch.
  • web_client: A variation of the web_control example that connects to an existing WiFi network instead of creating its own access point.

Dependencies for Web Examples

The web_control and web_client examples require the following additional libraries:

You can install these libraries using the Arduino Library Manager or by adding them to your platformio.ini file:

lib_deps = 
    https://github.com/derdoktor667/DShotRMT.git
    https://github.com/bblanchon/ArduinoJson
    https://github.com/ESP32Async/ESPAsyncWebServer
    https://github.com/ESP32Async/AsyncTCP

📚 API Reference

The main class is DShotRMT. Here are the most important methods:

  • DShotRMT(gpio_num_t gpio, dshot_mode_t mode, bool is_bidirectional = false): Constructor to create a new DShotRMT instance. (Note: Bidirectional DShot is currently not officially supported.)
  • begin(): Initializes the RMT peripheral and the DShot encoder.
  • sendThrottlePercent(float percent): Sends a throttle value as a percentage (0.0-100.0).
  • sendThrottle(uint16_t throttle): Sends a raw throttle value (48-2047) to the motor.
  • sendCommand(uint16_t command): Sends a DShot command (0-47) to the motor.
  • getTelemetry(uint16_t magnet_count): Receives and parses telemetry data from the motor (for bidirectional DShot, which is currently not officially supported).

For more details, please refer to the DShotRMT.h header file.

🤝 Contributing

Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.