Computing Kp and Ki ahead of time without having the controller search for it:
Kp = 2000 * pi * L * 8192 * 1702 * LEM / (Voltage * 2048)
Ki = (2000 * pi) * R * 8192 * 1702 * LEM / (Voltage * 2048 * 10000)
Voltage is in units of voltage. haha. LEM means current per 0.625v rise in output of sensor. The LEM Hass 300-s for example goes up 0.625v for every 300amp, so "LEM" in that case would be 300 (that's why I called that variable LEM).
The Kp and Ki that results would be the biggest I would use. it might be better to even cut both of them in half. But it would work.
Note: R above means the resistance of 1 of the phases. L either means stator inductance or "mutual inductance" or something like that. But you don't need to compute Kp using that formula. All I do is find Ki, and then Kp is about 60*Ki (50 to 100 would be OK). That's because the inductance and resistance ratio is always about the same for all motors because the more copper you wind, the bigger the inductance.
For using a potentiometer rather than hall effect throttle, you would need to populate R2 with maybe 1k? And then populate R1 with about 4.7k. The BOM calls for R2 to be empty and R1 to be 47k, but that is for the case of the hall effect throttle.
Try this: After changing those resistor values, set it to max throttle, and then type config (noting where raw throttle position is). Then, set it to min throttle and hit config. I haven't tested anything with a pot rather than hall effect, but maybe thingstodo has. I would set the throttle max and min variables based on what you see when you do that test.
|