Smoothing PWM power to motor coils

Thread Starter

jcatkeson

Joined Feb 10, 2023
31
Hi All,

I have an Arduino sending digital signals through transistors, driving some DIY motor coils, simple:

Arduino digitalWrite() -> transistors -> coils.

It works great, plenty of force and no fire. V-in is 5 volts and each coil is 2 ohms, so about 2.5 amps per coil.

One problem though is resonance. The rotor often overshoots the coil too quickly and gets pulled backward.
Looking into this, I found microstepping is a common solution. So now I want to do:

Arduino -> PWM -> transistor -> (low pass R+capacitor?) -> coil.

But a raw 500hz PWM signal is going to feed a lot of HF noise into the coil, inducing unwanted voltage spikes.

So the question is, what goes between the transistor and the coil, to smooth out the PWM into a more gradual wave? If it's just an RC filter like above, what values are reasonable? Highest priority is to avoid fire.

(BTW yes the circuit is protected by flyback diodes, but still...)

Thanks,
John
 
Last edited:

Thread Starter

jcatkeson

Joined Feb 10, 2023
31
Use a higher frequency. The inductance of the coils then smooths the current.
D'oh of course! I hadn't thought of that, the coil itself is a filter!

Unfortunately I am stuck at 500 hz as long as I am using Arduino Uno.

Still maybe 500 hz is high enough frequency to do the trick?
I'm going to have to do some math and/or experiments...
 
RC filter is lossy.
Use LC rather.
If you can, go higher with frequency (1-2khz) , so the coil and cap don’t have to be so bulky.

When the bjt is on the L is charged through motor phase (and cap) and
bjt.
Once the bjt is off the L discharges thru diode and motor phase.

Use L with high enough inductance to be in continuous conduction mode, otherwise the pwm duty won’t match the motor current, another words, the Vphase=D * Vcc will not be valid.
IMG_3277.jpeg
 
Last edited:

Thread Starter

jcatkeson

Joined Feb 10, 2023
31
Question posed in #5, not yet answered fully?
I'll tell you anything you want to know. What details do you need?

I guess as a category it would be a stepper, because it's just four grounding wires connected directly to 4 coils. No brushes, no back EMF electronics or sensors.

All 4 coils get their +5V power from a common bus, but are individually, periodically, grounded by 4 MOSFET transistors.
 

Thread Starter

jcatkeson

Joined Feb 10, 2023
31
The Arduino is capable of higher frequencies. Perhaps you have to skip the library and set up the PWM yourself.
Looking into this now, I see a bunch of different approaches, tools, and code samples online. Which is best? Would you recommend one in particular? Thanks...
 

Thread Starter

jcatkeson

Joined Feb 10, 2023
31
To follow up, I used PWM.h to increase PWM frequency to 50khz, with no filter except the coils themselves.
(FYI I could only change the frequency of 4 pins at once using non-safe mode.)

It works OK, but it didn't fix the backdriving problem. Turns out the backdriving was caused by not enough power. I changed V-in from 5v to 12v and it performed a lot better.

So anyway, thanks everyone for the help and information!
 
Top