what is the ESC signal to control the motor?

  • Hello,

    Does anyone know what is the ESC input signal which can control the RPM of the Motor? is it the 50Hz PWM(1000us, this corresponds to minimum throttle-2000us, this corresponds to maximum throttle) signal as shown below?

    or it is the oneShot or Dshot Signal as shown in herepx4-esc

    Also, does anyone know how to log ESC signal? I tried to use "logger on" and "logger off" command to log all the UORB topics, and do you know whether the following two topics includes the ESC signals?


    Any comments and suggestions are welcome!

  • Dev Team


    Are you asking about ModalAI ESC? You can find information at https://docs.modalai.com/modal-escs/ and https://docs.modalai.com/modal-esc-v2-manual/. Please see information about V2 (V1 is obsolete). To answer your question about communication, the ModalAI ESC accepts control input via UART. The interface is implemented in PX4, you can find more information here https://docs.modalai.com/modal-esc-px4-user-guide/ and https://github.com/modalai/px4-firmware/tree/modalai-1.12-dev/src/drivers/uart_esc/modalai_esc.

    Actuator Controls should be available to log via PX4 which would the the commanded RPM sent out the motors.

    What Drone platform are you using and can you confirm that you have the ModalAi ESC V2?

    Please review the documentation and let us know if you have other questions.


  • Thank you for your reply and it's very helpful.

    The platform that I am using is the ModalAI M500, and the ESCs attached in this drone are HolyBro BLHeli 20A ESC For S500 V2.ESC.

    The following is my questions:

    Q1: Do you have a datasheet for HolyBro BLHeli 20A ESC? I want to know is this a one-way or two-way ESC? and what kind of control signal need to send to this ESC?

    Q2:I have used an oscilloscope to find out what is the control signal of ESC. According to my experiments(plots are attached), it seems the control signal is PWM signal(The period is 1.8 us and the pulse width ranges between 0.6us for zero power and 1.2 us for the full power)? is this correct?

    zero-power pulse width:
    full-power pulse width:

    Q3:I have collected acturator_control and acturator_outputs. For acturator_control, do you know what's the difference between control[0] and control[7]? As you said, the data in acturator_control is the commanded RPM, But the values of those data seems pretty small which doesn't make sense since those data are collected when quadcopter is hovering.



  • Dev Team

    Hi @DarkKnightCH ,

    Nice o-scope, I have the same 😉

    a] The ESC is one way, and can be setup via PX4 to use PWM or DSHot. We started shipping with DShot to avoid ESC PWM calibration needs. We don't offer a datasheet for that, but get it from Holybro. There's various docs online.

    b] if you are using PWM, the signal is bound to 0-2000us pulse width modulated signals out with our default params. When you power the vehicle on, if an airframe type is selected, you'll get a 900us signal that just lets the ESCs know theres a signal, but it won't spin motors.

    There's a bunch of params that can be adjusted: https://docs.px4.io/v1.12/en/advanced_config/parameter_reference.html#pwm-outputs

    PWM_MIN of 1060 means, when armed, there will be a 1060us "wide" signal. If you set thrust to max, you'd get a 2000us wide signal, specified by PWM_MAX.

    c] these are the 8 channels, 0-7, values of -1.0 to 1.0 ya? This is basically the 'percentage' of full scale from what I gather. So 1.0 would be 2000us, 0 would be 0, if I'm not mistaken.

  • Dev Team

    It seems like Dshot is used if signals around 1us are observed. Regular PWM would have been 1000-2000us range!

  • @modaltb hey, thanks for the reply and it's really helpful!

    For c), Yes. the data that I have collected is bounded by [-1,1]. if 1 is full power, 0 is zero power, what does the value between [-1,0) means? rotate in an opposite direction, but each motor is not suppose to rotate in two-ways, right?

    Do you know what does the component of 'acturator_outputs' means?

  • Dev Team

    Negative command typically does mean the command in opposite direction. negative actuator_controls simply means the control is in the opposite direction.

    actuator_controls is an array of 4 normalized (to -1..1) values (pitch,roll,yaw,thrust). actuator_outputs are outputs that are coming from the mixer. The mixer converts pitch,rol,yaw,thrust to four motor commands. The units of the motor commands are dependent on where they are sent to (PWM driver or whatever).

    You can see some more info here : https://discuss.px4.io/t/how-mixer-work/3886/5

    Also, motor direction can be sometimes controlled in software (as well as switching motor wiring). It depends on implementation of the ESC. Sometimes it is easier to wire all motors to ESCs the same way (without switching wires) and then use the direction in software in order to control the spin direction.

  • Hi, Alex,

    Thanks for you help and it is very helpful. As you said, actuator_controls is an array of 4 normalized (to -1..1) values (pitch,roll,yaw,thrust). actuator_outputs are outputs that are coming from the mixer. The mixer converts pitch,rol,yaw,thrust to four motor commands. I assume the ModalAI mixer file is the your own defined mixer file instead of the default mixer file? if yes, where can I find such mixer file?

    Observing my current acturator_outputs data , the value of output[0]-output[3] seems reach 1000 when quadcopter is hovering, and according to my oscilloscope observation, the ESC signal value should be between [0.6-1.2] us. Therefore, I guess the control structure is as follows:

    High-lever Controllers ------(commanded roll, pitch,yaw, thrust, which are represented by acturator_controls)---> Mixer -----(scaled ESC signal for each motor, which are represented by acturator_outputs)----> Scaler -----(Scale the acturator_outputs into Dshot ESC signal)---->ESCs and Motors.

    But right now how can I find such scaler? or How can I find the mapping between acturator_outputs and Dshot ESC signal? I believe the mixer file should have a definition of such mapping.

  • Dev Team

    For standard motors using DShot, I believe a standard mixer is used. Perhaps this page will be useful : https://docs.px4.io/v1.12/en/concept/mixing.html#mixer-loading . You should be able to use a debug console to check which mixer is being used? Maybe @modaltb knows?

  • Dev Team

    There's mixer commands from the command line you can invoke, I believe it will spit out the file being used.


    It also shows on bootup, but that can't be caught unless you are connected to the debug UART on J2.

    That said, I know very little about mixers myself! So likely not a help here beyond locating files.😂

  • @Alex-Kushleyev @modaltb
    Hi, Thanks for your help. The following is my update:
    (1) The ModalAI is using DShoot600 ESC protocal. This can be verified by DSHOT_CONFIG parameter in QGC. Also, by checking the Dshot.h source code, I can find the following information.

    /** Dshot PWM frequency, Hz */
    static constexpr unsigned int DSHOT150  =  150000u;
    static constexpr unsigned int DSHOT300  =  300000u;
    static constexpr unsigned int DSHOT600  =  600000u;
    static constexpr unsigned int DSHOT1200 = 1200000u;
    static constexpr int DSHOT_DISARM_VALUE = 0;
    static constexpr int DSHOT_MIN_THROTTLE = 1;
    static constexpr int DSHOT_MAX_THROTTLE = 1999;

    The Dshot frequency is f= 6*10^5Hz, so the time period is 1/f=1.6 us, and 1.6 us matches the time period of signal which is form my oscilloscope. Again, this verifies the Dshot600 is the right one.

    For the the logged data from acturator_outputs, the value is around 800-1000 when quadcopter is hovering, which is makes sense to me since I guess the value range for acturator_outputs is [1,1999] according to DSHOT_MIN_THROTTLE = 1 and DSHOT_MAX_THROTTLE = 1999. According to acturator_outputs commands, right now I can verify my own thrust models.

    Although right now I didn't fully understand how mixer works, however there are a few things that I can make sure is: The modalAI airframe type is quadcopter x, the vehicle is generic Quadcopter, therefore I go there https://github.com/modalai/px4-firmware/tree/1.11.3/ROMFS/px4fmu_common/init.d/airframes and trying to find the airframe source file, but I didn't find a file named xxxx_generic_quadcopter. I found this file which is called: 4001_quad_x, https://github.com/modalai/px4-firmware/blob/1.11.3/ROMFS/px4fmu_common/init.d/airframes/4001_quad_x, is this the airframe file that ModalAI using?

    I assume it is, since it mentioned that @name Generic Quadcopter @type Quadrotor x, which matches the airframe type in QGC.

    # @name Generic Quadcopter
    # @type Quadrotor x
    # @class Copter
    # @output MAIN1 motor 1
    # @output MAIN2 motor 2
    # @output MAIN3 motor 3
    # @output MAIN4 motor 4
    # @output MAIN5 feed-through of RC AUX1 channel
    # @output MAIN6 feed-through of RC AUX2 channel
    # @output AUX1 feed-through of RC AUX1 channel
    # @output AUX2 feed-through of RC AUX2 channel
    # @output AUX3 feed-through of RC AUX3 channel
    # @output AUX4 feed-through of RC FLAPS channel
    # @maintainer Lorenz Meier <lorenz@px4.io>
    . ${R}etc/init.d/rc.mc_defaults
    set MIXER quad_x
    set PWM_OUT 1234

    In above file, it set MIXER =quad_x, so I go there https://github.com/modalai/px4-firmware/tree/1.11.3/ROMFS/px4fmu_common, and find quad_x.main.mix(https://github.com/modalai/px4-firmware/blob/1.11.3/ROMFS/px4fmu_common/mixers/quad_x.main.mix). According to the mixer file, is there anyone who can help to explain it?(I tried to syntax of mixer file in https://docs.px4.io/master/en/concept/mixing.html, but it is still confusing.) And also why it is only defines the AUX1 and AUX2 mixer instead of Main mixer?

    R: 4x
    AUX1 Passthrough
    M: 1
    S: 3 5  10000  10000      0 -10000  10000
    AUX2 Passthrough
    M: 1
    S: 3 6  10000  10000      0 -10000  10000
    Failsafe outputs
    The following outputs are set to their disarmed value
    during normal operation and to their failsafe falue in case
    of flight termination.

    Will keep update once I know more about mixer~

  • Dev Team

    Hello @DarkKnightCH , the mixer file does not only define the AUX1 and AUX2. Please note this line, which specify the configuration of a quadrotor in X orientation : https://github.com/modalai/px4-firmware/blob/1.11.3/ROMFS/px4fmu_common/mixers/quad_x.main.mix#L1 , specifically R: 4x

Log in to reply