How to generate a square wave chirp?

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Post Reply
sibir
Posts: 9
Joined: Tue Jan 17, 2017 1:18 pm

How to generate a square wave chirp?

Post by sibir » Fri Nov 13, 2020 8:13 pm

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?

User avatar
OlivierLenoir
Posts: 58
Joined: Fri Dec 13, 2019 7:10 pm
Location: Picardie, FR

Re: How to generate a square wave chirp?

Post by OlivierLenoir » Fri Nov 13, 2020 10:08 pm

You can have a look at this project https://gitlab.com/olivier.len02/micropython-multiaxis and also the following forum posts viewtopic.php?f=15&t=7497.
The GPIO version should work on a PyBoard.

sibir
Posts: 9
Joined: Tue Jan 17, 2017 1:18 pm

Re: How to generate a square wave chirp?

Post by sibir » Mon Nov 16, 2020 2:22 am

Thank you, Oliver. I thought there must be relevant information on the forum, but I could not find it.

sibir
Posts: 9
Joined: Tue Jan 17, 2017 1:18 pm

Re: How to generate a square wave chirp?

Post by sibir » Mon Nov 16, 2020 2:21 pm

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.

User avatar
OlivierLenoir
Posts: 58
Joined: Fri Dec 13, 2019 7:10 pm
Location: Picardie, FR

Re: How to generate a square wave chirp?

Post by OlivierLenoir » Mon Nov 16, 2020 7:37 pm

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.

Post Reply