Skip to main content
Associate III
Nov 6, 2026 10:53 AM UTC
Question

Torque calculation in Motor Control

Hello everyone, I’m using the STM32G464RE core and the IHM 08M1.

I’m trying to work out how to calculate/measure the torque, but I don’t have a dynamometer. The load is a peristaltic pump, so it varies depending on the two rollers that the motor drives.

-----------------------------------------------------------------------METHOD 2: using the firmware-------------------------------------------------------------------------------------------

In the code, I’ve written:

currentRef_float_read = MCI_GetIqdref_F(pMCI[M1]);
iq_ref_A = currentRef_float_read.q;

current_float_read = MCI_GetIqd_F(pMCI[M1]);
iq_A = current_float_read.q;



//I’m converting the motor’s Kt (expressed in [Nm/Arms]) to [Nm/Apk] because I’m going to multiply it by Iq (which is not rms)
#define KT_NM_PER_APEAK (KT_NM_PER_ARMS / SQRT2_F)

torque_calc_Nm = KT_NM_PER_APEAK * iq_A;
torque_ref_calc_Nm = KT_NM_PER_APEAK * iq_ref_A;

//I think this is the "overall" stator current, and I don’t think it should be used to calculate torque, but I’ll plot it anyway
phase_current_ampl_s16a = MCI_GetPhaseCurrentAmplitude(pMCI[M1]);
phase_current_A = ((float)phase_current_ampl_s16a * 3.3f) / (65536.0f * 0.01f * 5.18f);

When I plot the variable, I usually get a pattern like this:

 

-----------------------------------------------------------------------METHOD :  using the oscilloscope--------------------------------------------------------------------------------------

I put the amperometric probe around one of the motor’s three phases and read the RMS, maximum and minimum values ((see the example in the photo below):

I calculate the torque quite simply using the motor’s Kt and the current reading from the oscilloscope probe:

Torque = Kt [Nm/Arms] * Iphase [Ams]

 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Which of the two is correct?

I’m getting different results.

 

4 replies

GMA
ST Technical Moderator
Nov 9, 2026 4:47 PM UTC

Hello ​@luke514,

The first method mentioned is correct.
What difference do you see?

If you agree with the answer, please accept it by clicking on 'Best answer'.Best regards.GMA
luke514Author
Associate III
Nov 10, 2026 8:20 AM UTC

I’ve carried out four tests in the table, so there are three rows  in the table below.

In red on the left: min, max and RMS current values from probe multiplied by Kt [Nm/Arms] → “manual” measurement, using KEYSIGHT 1146B probe.

In green on the right: min and max values of Iq (read in CubeMonitor) multiplied by Kt [Nm/Apk] → “firmware” measurement. Here, however, I’m using pk, not rms…

 

 

To be honest, I don’t understand this difference between the results. I think the torque calculated via firmware should be the same as that calculated manually using the current probe.

  1. Is my conversion in the code from Kt [Nm/Arms] to Kt [Nm/Apk] correct?
  2. If so, I see different results in the table. Perhaps I should calculate the RMS IQ? Because via the firmware I only have the maximum and minimum values (it fluctuates)
  3. Sorry, when you say ‘the first method is correct’… do you mean the first one I wrote in the main post? (i.e. the one using the firmware)… or the one at the bottom? Because I’ve just realised that I’ve renamed the first one I wrote ‘METHOD 2’ and the second one ‘METHOD’…