ESC Ref design issue


(Arun Ravindran) #1

Hi,

We are trying to make a ref design from Orel ESC and have to use a different device (INA240) current sensing.

This has a different gain (20V/V) and the sense resister is also different (0.0002ohm).
Where is the firmware i have the option of tuning these values?

regards
Arun


(Pavel Kirienko) #2

The shunt resistance is deduced from the state of the hardware ID pins. You need to use a different HW ID configuration and add an appropriate support here: https://github.com/PX4/sapog/blob/b1354f4e169930515701f0d162df08f3027bef87/firmware/src/board/board.cpp#L153-L172

The current sensing gain is hard-coded at 10x: https://github.com/PX4/sapog/blob/b1354f4e169930515701f0d162df08f3027bef87/firmware/src/motor/realtime/motor_adc.c#L248-L255

Perhaps you should modify the first function to return the overall current/voltage gain including the amplification factor rather than just the resistance of the shunt. A pull request with that change would be welcome.