Page 1 of 1

How to generate a square wave chirp?

Posted: Fri Nov 13, 2020 8:13 pm
by sibir
I am using a pyboard to control a linear stage (aka positioning table). The stage has a step motor with an integrated driver, so the interface is via TTL inputs for clock, direction, on/off, and stepsize. The 5V tolerance of the pyboard made it the best, albeit pricey choice for the controller.
For now, I create the clock with an always-on PWM timer and control the motion via on/off and direction.
However, turning on the motion creates quite a jerk which I would like to soften. Unfortunately, there seems to be no gentle way to change the PWM frequency as it requires reinitializing the timer.
Any ideas? Maybe PWM is not the best approach? After all, I am not modulating the pulse width.
So, how to generate a frequency chirp?

Re: How to generate a square wave chirp?

Posted: Fri Nov 13, 2020 10:08 pm
by OlivierLenoir
You can have a look at this project https://gitlab.com/olivierlenoir/micropython-multiaxis and also the following forum posts viewtopic.php?f=15&t=7497.
The GPIO version should work on a PyBoard.

Re: How to generate a square wave chirp?

Posted: Mon Nov 16, 2020 2:22 am
by sibir
Thank you, Oliver. I thought there must be relevant information on the forum, but I could not find it.

Re: How to generate a square wave chirp?

Posted: Mon Nov 16, 2020 2:21 pm
by sibir
I looked through your multiaxis.py code for GPIO. It looks like you are using constant acceleration, so there is still jerk. I will try it out and see if I am happy with the result.

Re: How to generate a square wave chirp?

Posted: Mon Nov 16, 2020 7:37 pm
by OlivierLenoir
So far, manage acceleration is in the roadmap, but I didn't had time to work on it.
You can access the period of the fastest axis by changing MultiAxis.period if you use MultiAxis.g01().
I may have to work on acceleration earlier because MicroPython-DobotArmV1 project will soon require this feature.