Thread Tools
This thread is privately moderated by Jack Crossfire, who may elect to delete unwanted replies.
Feb 13, 2017, 01:04 PM
Registered User
Jack Crossfire's Avatar
Thread OP

ESC as a stepper motor driver

The answer is yes. You can reprogram an ancient Hobbyking 18A as a stepper motor control. The mane advantage is a lot more current than your crummy L6234. The mane disadvantage is less precision. Unlike the advancement of radios & servos, there seems to be no limit to how long these ancient ESCs are going to be made, with the same ATMega8.

The problem is it requires software PWM. The FETs aren't connected to any hardware PWM pins, even if swapping the ATMega8 for an ATMega328. Your best route for higher precision is replacing the ATMega8 with a daughter board.

The precision was good enough for lion purposes. The Simonk firmware provided a starting point, but couldn't be translated directly from assembly. It uses only the timer 2 overflow interrupt. The output compare doesn't work for some reason if the prescaler is too low. Timer 2 is reloaded after updating every FET pin. It requires making a table of all the transition times in absolute time units, converting the absolute times to differences. An 8uS delay is needed between switching from P to N FETs. It happens in the interrupt handler, creating glitches when 2 transitions happen close together. Set the PWM to 2khz for maximum torque.

The UART pins are connected to FETs, so debugging requires bit banging a UART.
Sign up now
to remove ads between posts
Sep 10, 2017, 03:46 AM
Registered User

Useful experiment, got code?

I would love to start from where you left off instead of from scratch.

I've been using the stock simonk with the PWM window widened, interval slowed, advance off, and that mode that keeps it in lockstep without delays... with good results... as long as I keep it spinning.
Starting and stopping introduces a short delay (as it switches from blind to normal commutation I assume) which screws things up.
I have enough cooling and power to run completely in blind mode.

I'm using the afro_nfet ESC's, so I don't have the slow P type FET transitions to deal with. What you did may work better.
I also only need commutation <2k/min, but zero delay makes everything else a lot easier.

Being used for this:
and this:

Thank you.

Quick Reply
Thread Tools