04-17-2024 01:00 PM
Hello community!
I am trying to make a servo controller vi in LabVIEW for a sg90 servo motor.
Currently, my vi allows me to set the servos position anywhere from 0-180 degrees. However its position is only updated about once every 2 seconds.
I can see that the daqmx write function is where the delay occurs but I cant think of a way to make it go faster.
I am wondering if this is a limitation of the software or if there is a way I can make the servos position update more "instantaneously".
In my current code, I have a sinewave generator which has the servo move across its full range by connecting its output to the duty cycle of the PWM signal.
My end goal would be to have a knob or dial which can move the servo smoothly through its range.
Any help or tips is/are greatly appreciated.
04-17-2024 04:37 PM
Cannot open your VI. Many of us (including me) are using earlier versions of LabVIEW. Please "Save for Previous Version" and specify LabVIEW 2019 or 2021.
Bob Schor
04-17-2024 06:43 PM
Apologies again...
04-17-2024 06:59 PM
When Fs and #s are equal, that is one second worth of data points. DAQ device will output all the existing data from the FIFO before processing new data, hence the delay.
Why don't you use this example instead? PWM Servo Control with DAQ
04-17-2024 07:03 PM
What hardware are you using? what are available at your disposal to use?
Why are you wiring a waveform to a numeric input?
04-17-2024 10:06 PM
Currently I am working with an CDAQ 9174 and a NI 9263 which is purely an analog output card.
I think I have a few other types of units I could get my hands on, but I haven't considered any yet.
I have the sine wave as the input so that my servo will sweep over its range without requiring input. Previously, I had this input wired to a dial which achieved the same kind of control.
What I would like to achieve is having my output signal update at a high rate so my servo will move as I adjust its duty cycle input. What is occurring right now is that the servo position updates once every 2ish seconds.
04-17-2024 11:35 PM
Try this implementation (VI attached in v16.0)
04-18-2024 04:00 PM
Santo_13, Thank you for providing that Vi.
Unfortunately, it is experiencing the same issue of updating position about once every 2 seconds.
I think that in order to solve my problem, I will have to download the "LabVIEW Real-time module" in order to get the response time I desire.
Thank you for your help anyways.
04-18-2024 04:04 PM
Or perhaps!
The timed loop structure is what I need?
What I need is for the loop to write data at a higher rate of speed, so this timed loop I see may be what I need
04-18-2024 07:12 PM
Hello,
I am trying to make a servo motor sweep smoothly across its range by sending a pulse signal which varies in duty cycle.
My code currently runs my waveform and collects data points for 2 seconds before sending data to the "DAQmx write" function. When I highlight the execution, it looks like only the latter second of data is written into the buffer, which then plays for 2 seconds.
Is there a way I can maybe collect all of the data points over that time and *then* send it to the DAQ task so that the output has a pulse pattern where the duty cycle changes with time?
Any help or advice is appreciated!
thanks.