10-03-2025 05:32 PM
Good evening to everybody,
I am a PhD student and I work with LabVIEW 2024Q1 (64-bits) for measurement and acquisition activities. However, this time I wanted to control a DC motor (24V and 1.6A) through a bipolar transistor. In particular, I wanted to drive the transistor by using the NI9401 DIO equipped by my cRIO 9057 coded in Real-Time. I know that NI940x has an embedded function for PWM, but it is only available for LabVIEW 32-bit version (Do you know why?). So I started to think about how to generate a command signal through the VI. My strategy is to generate a +/- 5V square waveform with editable frequency and duty cycle, compare to a 2.5 constant with "greater than" block, and use the boolean output to command the DIO pin. However, I am having trouble because I haven't set the cRIO clock frequency and the PWM frequency. In particular, I set the cRIO cycle frequency at 1 kHz and set the PWM frequency at 100 Hz. However, when I change the duty cycle, the DC motor doesn't run at all. The only value that works is at 100% of the duty cycle. In addition, if I set the PWM frequency lower, like 7.5 Hz, the system works with a rough DC motor Voltage regulation (I can see the fan speed change only for some setpoints, such as 30%, 50%, 80% and 100%. To summarise, I have many questions:
1 - Do I make mistake in frequency settings? Is there a general rule to set the PWM?
2 - Why the control system does not work at 100 Hz?
3 - Is the PWM strategy wrong? There are some easier way to implement a PWM in LabVIEW?
I hope it is only my bad knowledge about the control-power systems and that you can provide me useful suggestions. Thanks in advance
Luigi
10-05-2025 09:32 AM
Unfortunately, the myRIO is at "end-of-life". It has PWM "built-in", but the most recent Software Toolkit for it is for LabVIEW 2021 Q3 (32-bit). It never had 64-bit support (but was able to do amazing things with 32-bit LabVIEW).
Bob Schor
10-05-2025 09:05 PM
Not sure which embedded function you are referring to. Were you using Scan Mode?
You can use NI-DAQmx Real-Time mode with cRIO-9057. Refer to example Change Duty Cycle on a Continuous Pulse Train of NI-DAQ™mx Task. See Take Your First Measurement in LabVIEW Real-Time (Data Logging) for the setup. For control at 1kHz, Real-Time mode is more than enough.