0

PWM Frequency Limit on Motor Shield v2
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PWM Frequency Limit on Motor Shield v2

by OBnewbie on Wed Sep 30, 2020 11:04 pm

As my user name suggests, a newbie here and to Arduino. Forty years in high tech, HW & SW but never released a line of code or designed a piece of hardware. ;-)

Just got my Adafruit motor shield v2- installed headers, library, plugged into my Mega 2560, and ran the example program. Worked like a charm.

I noticed that the AFMS.begin (xxxx) command is used to set the PWM frequency in the example program. But I discovered empirically that it won't go any faster than 1.6 KHz or so (and then also found that mentioned on the forum).

But the Toshiba TB6612 datasheet says the fastest switching frequency supported is 100 KHz. My application is not a conventional motor, but rather switching an electromagnet in a custom-design motor and I was expecting to be able to switch at a frequency much faster than this constraint.

Is there some inherent limitation in the Adafruit shield design that constrains this? Or a jumper or mod or library command that would get around this limitation?

In the worst case, I'd like to be able to activate the electromagnet for as short a duration as 80 uS. Not knowing anything about PWM, I assume there must be a Nyquist criterion or some other such principle at play here, leading me to believe I'd need at least two cycles of my PWM signal within that window, meaning a 40uS period, or a 25KHz frequency.

Is there a way to break through the 1.6KHz ceiling?

Thank you for any insight.

OBnewbie
 
Posts: 2
Joined: Wed Sep 30, 2020 10:49 pm

Re: PWM Frequency Limit on Motor Shield v2

by adafruit_support_bill on Thu Oct 01, 2020 5:52 am

the Toshiba TB6612 datasheet says the fastest switching frequency supported is 100 KHz.

The PWM on the shield is generated by the PCA9685 chip. The maximum PWM frequency for that chip is 1.6KHz. For higher frequency operation, you cold use a TB6612 breakout and control it via PWM directly from your microcontroller. https://www.adafruit.com/product/2448

adafruit_support_bill
 
Posts: 81533
Joined: Sat Feb 07, 2009 10:11 am

Re: PWM Frequency Limit on Motor Shield v2

by OBnewbie on Thu Oct 01, 2020 10:45 am

Got it- thank you adafruit_support_bill. Sounds like the shield wasn't the right tool for the job. I don't recall seeing anything called out about that speed limitation in the docs before purchasing, so FWIW, it might be worth highlighting that in the docs. (Or is it there and I'm missing it?)

The breakout board seems fine for my purposes though a bit less tidy than the shield. In either case, once things are operating at speed I'll probably add a pass transistor to operate at higher current.

Thank you!

OBnewbie
 
Posts: 2
Joined: Wed Sep 30, 2020 10:49 pm

Please be positive and constructive with your questions and comments.