Feather/CircuitPython: Massive (>1s!) servo latency?

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
DrNo
 
Posts: 4
Joined: Thu Oct 21, 2021 1:04 pm

Feather/CircuitPython: Massive (>1s!) servo latency?

Post by DrNo »

Hello Friendly Folks,

I've got a Feather M4 Express with a standard servo attached, using CircuitPython and Mu on a Mac.

The servo will follow instructions perfectly well, but with roughly 1.5 seconds of latency, i.e. "move here -> 1.5 second wait -> finally moves!" Even if I command slow, smooth motions, those motions take place just fine, but again only after a long delay. (A second, different, servo does the same, and I have no code that would insert deliberate delays.)

Initially, I found I could improve this by this by changing the frequency of the PWM signal from 50 Hz to 500 Hz, at which point the latency was not noticeable. However, this fix was likely illusory, and once I added a bit more to the code (adding a BNO085 position sensor), the latency was back just as it was.

Given the drastic level of latency (again, at least a second), there must be something very simple that is wrong or misunderstood. Would anyone have a clue about what direction to look?

Thank you!

User avatar
johnpark
 
Posts: 985
Joined: Wed Mar 25, 2009 2:15 pm

Re: Feather/CircuitPython: Massive (>1s!) servo latency?

Post by johnpark »

That's odd. Please post your code, thanks.

User avatar
DrNo
 
Posts: 4
Joined: Thu Oct 21, 2021 1:04 pm

Re: Feather/CircuitPython: Massive (>1s!) servo latency?

Post by DrNo »

Hello and thank you for responding.

After working on my code a while, the problem is no longer present, and I can't reproduce it.

My suspicion is that it was related to flooding Mu's serial output rather than something to do with the hardware.

I have to admit that I'm a rank newbie when it comes to Python (I'm more of a C person), but the problem was so inexplicable and bizarre that I thought I'd put it out there.

Anyway, thanks again.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”