09-19-2022 04:41 PM
Hi Guys,
i try to build this movement plot for my stepper motor. For that I use myRio and control the motor with PWM Frequency.
i already try it with the ramp vi but the result is an array , which i can not use for my frequency .
Can somebody help me ??
Best Regrades
Akbaba
09-19-2022 08:20 PM
Hi Akbaba,
@Akbaba66x wrote:
i already try it with the ramp vi but the result is an array , which i can not use for my frequency .
Why can't you use the array for your PWM generation?
(Why don't you attach your current VI?)
09-20-2022 02:51 AM - edited 09-20-2022 03:27 AM
I
I don't have a actually VI. i just testing it with a Ramp_Pattern.
09-20-2022 03:22 AM
It would really help if you sent the code not as screenshot, but as a file or snippet. Others than can work on your case and quickly show you their ideas.
These Express VIs you use work with single frequency value. You can use these, but you basically need to write the frequency value every N milliseconds. So a for loop would be needed where you feed a new value of frequency one by one. I think there are also VIs where you input the desired sequence all at once and the sequence is automatically outputted at a given sampling frequency, which would be more precise.
09-20-2022 03:30 AM
Sorry, i forget the vi.
I thick the automatically outputted at a given sampling frequency is better
09-20-2022 10:48 AM - edited 09-20-2022 10:54 AM
Ramp pattern will work if you use it correctly.
First, you want to chose start and stop values corresponding to the frequencies you want to output. You can create a dwell array too! Just append the ramp up, dwell, and ramp down arrays.
Then, you need a loop to pass each value element by element to the PWM frequency input. A For Loop with an autoindexing input would work well. Add some time delay to the loop to set the dt.
You might want to use some low pass filter as well to prevent the hardware from jerking as it changes acceleration.
09-21-2022 05:39 AM
Hi
Do you have in example vi.
I don´t now how to do it.
Best Regardes
09-21-2022 07:26 AM
Made any progress with prior, moderately detailed suggestions? What's the sticking point?
Maybe it's time to consider buying a stepper controller that can do the trajectory generation for you...
-Kevin P
09-22-2022 03:24 AM - edited 09-22-2022 03:44 AM
I try a test version of the acceleration. but i get always 0.
I have know idea why?
09-22-2022 07:29 AM
1. Starting from 0 freq -- not truly possible for a stepper. 0 freq takes infinite time!
2. Not specifying # samples in the ramp. It isn't 0, but you need to be in control of this.
3. You auto-index a loop with your ramp values. Then you turn each scalar into a 1 element array. Then you index into that array with an ever-increasing index value, asking for elements that don't exist. So LabVIEW gives you the default value for your datatype -- 0.
4. You don't auto-index with the output, so you only retain the very last value from all that For Loop iteration.
5. The whole thing is wrapped up in a While Loop that basically erases all your work as soon as its done.
I added an illustration of ramp generation to your code. Spot the differences! (But please be aware, this is still only a *very*, *very* small step toward your end goal of general trajectory generation for position control.)
-Kevin P