Current sense / expected behavior

Hello everyone,
I’d like to start by saying I’m very new to FOC.
I’m currently running a SimpleFOCShield v2.0.4 which is driving a GM3506 gimbal motor, with an STM32 L476RG. I’m able to get inline current sensing working, but the target current does not match the quadrature current I’m observing. For a constant torque, once the angular velocity reaches a constant value, shouldn’t Iq be nearly equal to target current? For example, when I command to 1A my Iq looks like this: (Iq is blue, Id is orange)

where the y axis is in Amps. My understanding is that I should be seeing 1A move through the 0.01ohm sense resistor (10mV drop), then multiply this by 50 (op amp gain) to get 0.5V, then convert this back to see my current which should be ~1A. When I use the commander to apply 1A, Iq spikes to 1A for a very short period of time, then drops back to 0 as my motor reaches constant velocity. The motor spins very smoothly, so I’m not concerned with choppiness.

Is there something I am overlooking?

Hi @ZaWr ,

I think it’s working as expected. If you have current sensing working, then the Iq current will increase as the motor is loaded, up to the current limit set. One way to test this is to set the code to use torque control, and set the target in motor.move to something like 0.5. If working properly, the motor should spin fast (limited by your power supply voltage), and the measured Iq should be pretty low. If you then apply a load to the motor, the current should ramp up, and if you hold the motor fixed, the Iq should match your target of 0.5 amps.