ModalAi ESC v2 RPM issue

  • Hello,
    I am using modalai esc v2 with voxl2. I am facing weird issue with rpm control section of program. I am unable to go beyond 10000 RPM while issuing rpm control command from program. I did calibration by following guide over here for my motor with 5800 KV and 2S battery setup. I am also attaching my parameter file which I flashed on ESC firmware and also find screenshot of final logs of calibration. I can clearly see for 100% power RPM achieved by motor was restricted to only 10000 and never going ahead of that even if I have flashed max RPM of 25000. Please help. Also is there any way to factory reset the firmware?
    Screenshot from 2023-02-15 18-19-44.png
    ESC parameters flashed :

        <param name="id"              value="127"/>  <!-- 0-7 .. 127 means use hardware ID pins to read ID-->
        <param name="dir"             value="2"/>    <!-- 0=fwd, 1=rev, 2=fwd id-based, 3=rev id-based -->
        <param name="id_map"          value="[0, 1, 2, 3, 4, 5, 6, 7]"/> <!-- reserved for future use -->
        <param name="vsense_scale"    value="6.0"/>  <!-- voltage_mv = adc_val_mv * vsense_mult / vsense_ div -->
        <param name="isense_scale"    value="18.25"/> <!-- Ima * 0.001 * 50 = Vmv, so mult is 1 / (0.001 * 50) = 20 . Note that actual gain is a bit off -->
        <param name="isense_zero_mv"  value="550"/>  <!-- voltage offset of current sensor when current is zero (0.55V by design) -->
        <param name="protocol_version" value="2"/>          <!-- reserved for future use -->
        <param name="input_mode"       value="0"/>          <!-- reserved for future use -->
        <param name="baud_rate"        value="250000"/>    <!-- communication bit rate -->
        <param name="char_timeout_ns"  value="0"/>          <!-- not used -->
        <param name="cmd_timeout_ns"   value="100000000"/>  <!-- timeout for incoming commands before ESC will stop the motor -->
        <param name="pwm_frequency"       value="48000"/>  <!-- switching freqency of PWM signal going to motors. 24Khz and 48Khz are only options for now -->
        <param name="vbat_nominal_mv"     value="7400"/>  <!-- used for sanity checking and limiting of voltage-dependent funcions -->
        <param name="num_cycles_per_rev"  value="6"/>      <!-- number of pole pairs in the motor. used for converting electrical frequency to mechanical rpm -->
        <param name="min_rpm"             value="200"/>   <!-- minimum RPM that will be attempted, otherwise capped -->
        <param name="max_rpm"             value="25000"/>  <!-- maximum RPM that will be attempted, otherwise capped -->
        <param name="min_pwm"             value="50"/>     <!-- cap for minimum power to be ever applied. max is 999 -->
        <param name="max_pwm"             value="999"/>    <!-- cap for maximum power to be ever applied. max is 999 -->
        <param name="pwm_vs_rpm_curve_a0" value="800.7716187026888"/>  <!-- this is actually motor_voltage vs rpm curve.. using legacy naming -->
        <param name="pwm_vs_rpm_curve_a1" value="-0.24654641395940405"/> <!-- Emax RS1306 3300KV with tri-blade 3x3x3 -->
        <param name="pwm_vs_rpm_curve_a2" value="7.37326332096057e-05"/>
        <param name="kp"                  value="0"/>    <!-- RPM controller proportional gain -->
        <param name="ki"                  value="0"/>     <!-- RPM controller proportional gain -->
        <param name="max_kpe"             value="300"/>    <!-- maximum proportional erorr term (max is 999) -->
        <param name="max_kie"             value="100"/>    <!-- maximum integral error term (max is 999) -->
        <param name="max_rpm_delta"       value="3000"/>    <!-- cap for maximum rpm error used in RPM controller -->
        <param name="alignment_time_ns"   value="0"/>
        <param name="spinup_power"        value="70"/>      <!-- power used to give the motor initial kick (out of 999) -->
        <param name="latch_power"         value="80"/>     <!-- power used during latching stage of spin-up (out of 999)-->
        <param name="min_num_cross_for_closed_loop" value="50"/>  <!-- exit latching mode of fixed power after this number of zero crossings -->
        <param name="brake_to_stop"       value="0"/>             <!-- apply brake when stopping motor (or not) -->
        <param name="stall_timeout_ns"    value="20000000"/>      <!-- after spin-up, if no zero crossing is not detected for this amount of time, motor is considered stalled -->
        <param name="require_reset_if_stalled"      value="0"/>   <!-- require sending an array of zero commands to reset before next spin-up, if motor stalled -->
        <param name="tone_freqs_10hz"     value="[200, 215, 225, 250]"/> <!-- 200 is 2000Hz, max 255 -->
        <param name="tone_times_ms"       value="[10, 10, 10, 10]"/>     <!-- duration of each tone in units of 10 milli-seconds. Poor naming!!! -->
        <param name="tone_powers"         value="[100, 100, 100, 100]"/> <!-- max is 255 -->
        <param name="dt_threshold_ns"       value="150000"/>      <!-- during start up, ignore inter-commutation times less than this val, probably noise -->
        <param name="max_dt_ns"             value="2500000"/>     <!-- min and max values for time between two commutations. these are used as caps -->
        <param name="min_dt_ns"             value="10000"/>
        <param name="dt_bootstrap_ns"       value="2000000"/>     <!-- filter bootstrap value for commutation dt during start up -->
        <param name="spinup_stall_dt_ns"    value="6000000"/>     <!-- during spin-up, if no zero crossing is not detected for this amount of time, motor is considered stalled -->
        <param name="spinup_stall_check_ns" value="30000000"/>    <!-- time after beginning of spinup to start checking for spinup stall -->
        <param name="timing_advance"        value="0"/>
        <param name="sense_advance"         value="0"/>
        <param name="demag_timing"          value="0"/>    <!-- unused -->

    Waiting for urgent response.

  • @Chad-Sweet If you can help out on this it would be really great.

  • Dev Team

    Hello @Aks ,

    In your calibration test, the test script applied power up to 94 (out of 100) and the 10000 RPM could not be reached. The calibration test is performed in "open loop" mode, when RPM controller is not active. The data seems to show that your motor power (or battery??) is limited and towards the end, when power changed between 90 and 94 %, there is no RPM increase, which suggests the motor is overloaded.

    If the motor cannot achieve certain RPM due to its limitations, increasing the ESC parameter limit of MAX_RPM to higher value cannot have any effect. ESC will try to output 100% power and will be limited by the motor.

    Also your battery voltage seems to drop very low for 2S at only 4Amps current, but maybe the battery was not full during the test. I would recommend calibrating when battery is around 50-75% full so that you voltage during calibration is about midpoint between minimum and maximum voltage. You can also calibrate at full battery, but keep in mind that maximum RPM is a function of battery voltage! (true for all BLDC motors).

    In general, kV value of 5800 for 2S battery is too high. In the past I have used motors of class/size 1306 with kV values ranging from 2700-4000 kV when used with 3-4 inch propeller. Usually motors with kV value of 5800 or higher are designed for 1S applications. Are you able to specify which motor you are using? If not, can you please double check the motor specifications for recommended battery voltage and expected performance (max rpm, etc is often posted in motor specifications).

  • Hello @Alex-Kushleyev
    Thanks for the detailed response. Battery was charged to around 8 Volts which was already at 90% while performing this test and voltage dropped to around 6 Volts while at 94% power.
    Here is the hglrc motor with 5800 kv which I am using with 2S battery.

    2S spec sheet isn't very clear with this motor.
    Anyways we are trying to evaluate ESC with some other motor with rated 2S battery spec.

    Please let me know your thoughts about above battery support over Modalai ESC.

  • Dev Team

    Thank you for providing the link to the motor. It makes more sense now. When I made my original comment regarding 2700-4000 kV for 2S I assumed this was a slow and efficient flyer. It seems you are building a "racing" style quadrotor.

    The kV value of the motor is 5600 and your link provides some information that can be helpful. They have test data for 7.4V with HQT3x2R propeller. At full throttle, the motor should draw 4.1A, so this is roughly what you are seeing. In your test, the battery voltage is lower than 7.4V (6.2V at the end of the test). By the way, what propeller are you using?

    The specification page does not provide the RPM at full throttle, but the current draw of 4.3A in your test is close to what spec sheet provided at 7.4V (4.1A). Since your current is higher at lower voltage, i believe your propeller must generate more resistance (larger propeller or more blades or higher pitch than in specification sheet example).

    I also saw in specification sheet that maximum current for this motor is 6.2A but only for 3 seconds! In your case, the current at the end is 4.3A, but the test is very long, it probably takes more than a minute, so i believe the motor may be overheating. When motor overheats, the internal resistance of motor windings will increase and maximum power output will decrease. That is why you see no change in rpm at the end, even though more % power is provided between 90-94%.

    In order to calibrate and prevent overheating, i would limit the maximum power for the calibration test (maybe to 80-85%) and increase the power step size from 1 to 2 or 3 or even 4. This way the test will go much faster.

    Perhaps something to consider.. instead of motor RPM, which highly depends on the propeller, you should look at the generated thrust and used power -- efficiency. In general you want to test several motors / propellers and choose one that fits your application better. Some applications require higher efficiency (longer flight, but less maximum thrust). Some applications require higher thrust (overall less efficiency). Looking at RPM does not tell you anything unless you know your thrust vs rpm data for the propeller. In your case you are not reaching 10K rpm, but you could be generating a lot of thrust. Thrust for a propeller can be measured using a thrust measurement device (not in scope of this tuning) or sometimes vendors provide thrust vs rpm data. There are also some thrust vs rpm databases online, for example :

    Regarding battery.. If the battery was fully charged before the test and by end of test the voltage dropped to 6.2V, that is not good. The voltage should not drop so much with just 4 Amps being pulled from the battery! A few thoughts..

    • check battery maximum continuous amperage. For example, a 600mAh 2S battery rated for 45C continuous discharge would allow 0.6*45 = 27A continuous (but the voltage can still drop significantly). Higher "C" rating battery can output more current but will be heavier.

    • You could also have an issue with connector or power cable if there is significant unexpected voltage drop under load

    • battery could be old and not able to output the rated current

    • You can use a power supply, set it to 7.4V and make sure it can output 8-10A and that should be enough to provide a good calibration for this motor.

    Also, you should set the min_rpm parameter to the lowest rpm at around 10% power. 200rpm will not be achievable.

  • @Alex-Kushleyev Thanks once again for complete details.

    We do have thrust bench and our focus was thrust analysis during the tests. Actually we are unable to get required thrust as per the Motors spec chart at 50% power. We suspected that RPM of motor isn't exceeding 10000 RPM which might be cause of less thrust. We were getting around 40 grams of thrust at 70% power and never improved from there on which was the concern since we needed 55 grams at 50%.

    Regarding battery we are using 3500 mah 2S lipo cells. Also we are using T3.5x2.5x3 Prop which is 3 inch in diameter and 2.5 mm pitch.

    Let me know you analysis from above data.

    Also can you tell me which motor you are talking about for 1306 series with 4000 kv in your above comment?

  • Dev Team

    Just to eliminate any issue with ModalAi ESC, are you able to run the thrust bench test with an off-the-shelf ESC?

    T3.5x2.5x3 propeller seems to be 3.5 inch, which I think is too large for this motor. The motor specification page lists propellers 2.5 inch, 3.0 inch, 3.1 inch. Additionally, your propeller is tri-blade, meaning it is harder to turn and will be a bit less efficient than a 2-blade (but smaller in diameter than equivalent 2-blade)

    The motor I have used that seems to be good quality and power : EMAX RS1306B V2 4000KV. I believe EMAX makes 11mm size as well (RS110x). RS1306B I used with 3S actually and a 3x3x3 tri-blade propeller (3 inch size, 3 inch pitch). This motor is much more powerful than your motor and i used almost the same propeller as you have, which may suggest that your motor is underpowered for your propeller.

    Emax has good quality motors and they provide good specifications, so you could try to find one that works for you and use a propeller that is listed in the motor specifications as a good starting point. Maybe look at something like this : (they have 4500kV and 5200kV and 6000kV). This Emax motor is heavier than your current motor, but it all depends on how much power you need - the more power output you need, the heavier the motor will be.

  • @Alex-Kushleyev Thank you so much for your response. We tested ESC with some other motor and found out RPM and power was exceeding 10000 RPM / 60% power and everything seems to be good with ESC. Our motor must be damaged or there is some problem.
    I will consider your feedback for motor selection as well. Thank you! 🙂

Log in to reply