LD19 - External Speed Control


I am using the ESP32 to control the speed rotation, but I using 30khz with 46% of duty cycle and the system does not change the speed, I would like to know how to control the speed and stop the motor, could you please explain to me step by step how I do that? I am using Arduino IDE environment to program the ESP32.

Plz check out our wiki.


The LD19 has a motor driver with stepless speed regulation, which supports internal speed control and external speed control. Whenthe PWM pin is grounded, the default is internal speed regulation, and the default speed is 10±0.1Hz.

For external speed control, a square wave signal needs to be connected to the PWM pin, and the start, stop and speed of the motor can be controlled through the duty cycle of the PWM signal.

Conditions for triggering external speed control:
a. Input PWM frequency 20-50K, recommended 30K;
b. Duty cycle is within (45%, 55%) interval (excluding 45% and 55%), and at least 100ms continuous input time.

After the external speed control is triggered, it is always in the external speed control state, and the internal speed control will be restored unless the power is turned off and restarted; at the same time, the speed control can be performed by adjusting the PWM duty cycle. Due to the individual differences of each product motor, the actual speed may be different when the duty cycle is set to a typical value. To accurately control the motor speed, it is necessary to perform closed-loop control according to the speed information in the received data.

When not using external speed control, the PWM pin must be grounded.

1. Trigger the external speed control function first
2. PWM pin is low, the motor stops. If high, motor full speed.
3. If you need to control the speed accurately, you need to use the feedback of the “radar speed” parameter for closed-loop control.

Thanks for your response.

Based on your recommendation, I applied the PWM pin to LOW and after I applied energy in radar. I expected the instrument not start, but the system running in normal operating.

Please, I would like a step by step the procedure for repeat the operation to have the system in standby mode, because if I achieve this I will know how I need to do for control the speed motor.

If possible you do a video with this procedure I appreciate.


Cristian Cecconello

  1. Make sure that the frequency and duty cycle of the ESP32’s PWM pin output meet the requirements (20-50K Hz , 50% duty cycle, 100ms).

You can confirm this first with an oscilloscope or LEDs or some analog platform.

  1. Set up a function to control the pin to continuously output PWM for 1 Second, and then set the pin to low, 1 Second.

  2. Connect the lidar and ESP32, and start it up. (Make sure ESP32 and lidar use the same GND)

  3. See what happens to the lidar.