05-09-2025 02:47 PM
Hey everyone! I'm very new to LabVIEW and I’ve been tasked with a project where I need to control an SG90 servo motor using LabVIEW and a USB DAQ 6009 (NI). This is for a university assignment and I'm feeling pretty overwhelmed 😅 I’ve done some research but still don’t fully understand:
How to generate the correct PWM signal for the SG90 using the DAQ 6009 (which I’ve heard doesn’t support hardware PWM?)
How to wire the SG90 to the DAQ properly (power, GND, signal)
Whether it’s possible to control the servo with software PWM in LabVIEW, and how to implement that I’d really appreciate any guidance, examples, or simple explanations to help me understand what I need to do. Even pointing me to a beginner-friendly tutorial would help a lot. Thanks in advance for any help!
05-09-2025 06:52 PM
Well first, have you looked at the specs for the USB-6009? They are here:
https://www.ni.com/docs/en-US/bundle/usb-6009-specs/page/specs.html
If you look at the specs you can see that it has 2 analog outputs, and can do 0 to +5V, at up to 5 mA of current. It can update at 150Hz.
5 mA isn't a lot. I don't know how much current your motor requires, but there's a reasonable chance that it needs more than that. Unless it's a very low-power motor, that means that unless you add an amplifier circuit, you probably can't use just the 6009.
It also doesn't support negative voltage output. So it's likely that your motor can only go one direction unless you also add some kind of inverter, or use the second analog output wired in reverse to handle that.
The 150Hz speed limit means you can't output a pulse shorter than around 6 ms either. Not sure if that's enough to control your stepper properly.
Using the Digital outputs instead, if you don't need anything other than 5V, might work but they are also low current and would likely need amplification. There's also no negative option so you'd need to have a reverse option wired up if you need that. The speed they run at isn't listed but according to this thread:
https://forums.ni.com/t5/Digital-I-O/Slow-digital-output-on-USB-6009-using-NIDAQmx/td-p/2812176
You can probably get about as fast as 1kHz, for a 1 ms pulse. So that would be faster.
I've never tried to do exactly what you are describing though, so all of the above is kind of theoretical for me as well.
05-10-2025 08:57 AM