Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start-up Motor with High Load #121

Open
radoof opened this issue Jan 12, 2017 · 1 comment
Open

Start-up Motor with High Load #121

radoof opened this issue Jan 12, 2017 · 1 comment

Comments

@radoof
Copy link

radoof commented Jan 12, 2017

Hi! I am a MSc. student in Systems and Control, and I am working on a motor controller as part of some coursework. The motor has a very high load on it (it has to spin up a rather big mass) and it is difficult to start up.

I have already managed to operate the motor using an off-the-shelf ESC, with a modified version of the SimonK firmware already flashed on it, however, on the custom ESC that I have made, the motor does not work anymore with the firmware I have downloaded from this repository.
I have been trying to modify the firmware myself in the hopes that I would get the motor to run, but I had no success, mostly because I do not fully understand the parameters that I am changing. Would it be possible to explain what each of these parameters does, and how I could modify them for my motor to run?

These are the parameters that I am modifying:

.if !defined(MIN_DUTY)
.equ MIN_DUTY = 56 * CPU_MHZ / 16
.endif

; Number of PWM steps (too high and PWM frequency drops into audible range)
.if !defined(POWER_RANGE)
.equ POWER_RANGE = 800 * CPU_MHZ / 16 + MIN_DUTY
.endif

.equ MAX_POWER = (POWER_RANGE-1)
.equ PWR_COOL_START = (POWER_RANGE/24) ; Power limit while starting to reduce heating
.equ PWR_MIN_START = (POWER_RANGE/6) ; Power limit while starting (to start)
.equ PWR_MAX_START = (POWER_RANGE/4) ; Power limit while starting (if still not running)
.equ PWR_MAX_RPM1 = (POWER_RANGE/4) ; Power limit when running slower than TIMING_RANGE1
.equ PWR_MAX_RPM2 = (POWER_RANGE/2) ; Power limit when running slower than TIMING_RANGE2

.equ BRAKE_POWER = MAX_POWER2/3 ; Brake force is exponential, so start fairly high
.equ BRAKE_SPEED = 3 ; Speed to reach MAX_POWER, 0 (slowest) - 8 (fastest)
.equ LOW_BRAKE_POWER = MAX_POWER
2/3
.equ LOW_BRAKE_SPEED = 5

.equ TIMING_MIN = 0x8000 ; 8192us per commutation
.equ TIMING_RANGE1 = 0x4000 ; 4096us per commutation
.equ TIMING_RANGE2 = 0x2000 ; 2048us per commutation
.equ TIMING_RANGE3 = 0x1000 ; 1024us per commutation
.equ TIMING_MAX = 0x0080 ; 32us per commutation (312,500eRPM)

.equ TIMEOUT_START = 48000 ; Timeout per commutation for ZC during starting
.if !defined(START_DELAY_US)
.equ START_DELAY_US = 0 ; Initial post-commutation wait during starting
.endif
.equ START_DSTEP_US = 8 ; Microseconds per start delay step
.equ START_DELAY_INC = 15 ; Wait step count increase (wraps in a byte)
.equ START_MOD_INC = 4 ; Start power modulation step count increase (wraps in a byte)
.equ START_MOD_LIMIT = 48 ; Value at which power is reduced to avoid overheating
.equ START_FAIL_INC = 16 ; start_tries step count increase (wraps in a byte, upon which we disarm)

.equ ENOUGH_GOODIES = 12 ; This many start cycles without timeout will transition to running mode
.equ ZC_CHECK_FAST = 12 ; Number of ZC check loops under which PWM noise should not matter
.equ ZC_CHECK_MAX = POWER_RANGE / 32 ; Limit ZC checking to about 1/2 PWM interval
.equ ZC_CHECK_MIN = 3

Thank you!
Radu

@sim-
Copy link
Owner

sim- commented Jan 13, 2017

Hello!

Starting a large mass might be helped by significantly lengthening the TIMEOUT_START. It can actually be set to any 24-bit value in microseconds (stored in ticks, so the value set * CPU_MHZ). Setting it to 1000000, for example, will make it 1 second before timing out a commutation phase and trying to move on to the next. Some perturbing will be needed in some instances (depending on magnet spacing, cogging, etc.), and in some instances it will help to tune the dividers and/or reduce the amount of DC bias in the sense inputs / comparator offset, since the back-EMF will be so low, but often it can get some assistance from the inductive properties and (ahem) sort of rely on the PWM as means of measuring absolute position.

Particularly with non-atmega8 MCUs, the comparator can be a bit slow after an ACME change, and it may help to increase START_DELAY_US (e.g., try 100). If not, some super old versions back with PWM-aligned sampling during starting may have better luck.

Lowering the PWM frequency (set POWER_RANGE to 2000, for example) helps to start hard drive motors, but it already does that automatically during starting for that reason. You could try 4kHz, etc. (POWER_RANGE ~4000), if your motor (and ears) are OK with that.

Changing the power and the modulation timing might give it some help depending on really how long it takes to get ENOUGH_GOODIES successful commutations.

Complementary PWM (COMP_PWM) can also help to significantly change back-EMF sensing and clean up the current collapse periods, which may also help starting.

I'm not sure any other knobs will really improve starting. I can't really see what you've changed other than the braking, which has nothing to do with starting.

When you say "does not work anymore"...Do you mean it does still if you put back an older version? If so, can you hint at which versions work or do not work? Possibly, "git bisect" where it stops working? (You can "git stash" and "git stash pop" your changes over a bisection, if needed).

If you suspect a hardware fault has started to make it not work, try with CHECK_HARDWARE set to 1.

Simon-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants