cancel
Showing results for 
Search instead for 
Did you mean: 

Speed ramp with Potentiometer

TKara.2
Associate II

"I'm trying to rotate the motor using potentiometer libraries. Do you think there are any other missing parts that I need to determine?"

 

uint16_t potMeasArray[16];

 

potentiometerHandle.LPFilterBandwidthPOW2=4;

potentiometerHandle.PotMeasArray=potMeasArray;

potentiometerHandle.PotRegConvHandle=3;

potentiometerHandle.Valid=true;

 

 

POT_Init(&potentiometerHandle);

 

speedPotentiometerHandle.Pot =potentiometerHandle ;

speedPotentiometerHandle.pMCI = pMCI[M1];

speedPotentiometerHandle.RampSlope = 0.5;

speedPotentiometerHandle.ConversionFactor =88;

speedPotentiometerHandle.SpeedAdjustmentRange = 10;

speedPotentiometerHandle.MinimumSpeed =100;

speedPotentiometerHandle.LastSpeedRefSet = 650;

 

 

 

SPDPOT_Init(&speedPotentiometerHandle);

 
 
 
3 REPLIES 3
Gael A
ST Employee

Hello TKara.2,

I think you cover all the needed seetings.

However, your ConversionFactor seems incoherent with your Motor's max speed : ConversionFactor = (65536 / (Max_Speed - Min_Speed)) = 119 (computation done given the motor's max speed in your project and the min Speed you posted)

Moreover, be aware that the RampSlope is in SPEED_UNIT / s, which means your current acceleration is 0.05 Hz/s, provided that your SPEED_UNIT is U_01HZ (default value).

Lastly, your SpeedAdjustmentRange seems a bit low too, you would need to be very confident in your potentiometer returned value for this to be reliable.

The upper remarks are not necessarily pointing mistakes, but are more interrogations considering your values.

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.

"Thank you for the response, but my engine is running at a constant speed. can u help me ?

 
 
 
 

Hello TKara.2,

I'm not sure on what I'm supposed to help here

Have you tried generating a project enabling the Potentiometer feature ? Are you facing any issue ?

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.