Closed loop RPM with PWM and scale

Info and Discussion about the ESC32 hardware and software

Closed loop RPM with PWM and scale

Postby tuloski » Wed Apr 15, 2015 11:08 am

Hi guys,
I have another question.
I'm controlling in closed loop RPM but sending PWM signals.
As far as I understood the pwm is scaled using PWM_MIN and PWM_MAX and PWM_RPM_SCALE.
In the code I found only this (in run.c) related to how the pwm is scaled to a target RPM, but I still don't have it clear:

Code: Select all
else if (runMode == CLOSED_LOOP_RPM) {
       // target RPM
       target = p[PWM_RPM_SCALE] * val * (1.0f / ((1<<16)-1));

       // limit to configured maximum
       targetRpm = (target > p[PWM_RPM_SCALE]) ? p[PWM_RPM_SCALE] : target;
   }


Can someoint point me the formula to convert the pwm to target RPM with the ESC parameters on PWM and RPM?
Actually I'm using this to generate PWM based on my desired RPM, but it seems there is an offset:

PWM = (TARGET_RPM-MIN_RPM)*(PWM_HI_VALUE-PWM_LO_VALUE)/(PWM_RPM_SCALE-MIN_RPM)+PWM_LO_VALUE

in which MIN_RPM is zero or any value for the minimum RPM as target.
Can someone tell me how target RPM is calculatet given the parameters and the input PWM?
Thanks
tuloski
 
Posts: 10
Joined: Wed Nov 05, 2014 3:02 pm

Return to ESC32

Who is online

Users browsing this forum: No registered users and 8 guests

cron