From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

PWM light dimmer using cRIO

We are attempting to dim a 60W incandescent light bulb using a square wave generator in labview at 120Hz frequency. We are using a cRIO analog output voltage of 5V (even though the SSR switches around 2) to a solid state relay (opto22 model 120d25). The problem is that the bulb doesn't dim as expected, it just turns on at around 50% of the duty cycle.

0 Kudos
Message 1 of 2
(2,415 Views)

Yet another problem caused by the Dynamic Data Type. You configured the Simulate Signal function to generate 200 samples per run at some very large number of samples per second. However, you can only write a single point of data to the analog output at a time, so you're discarding 199 of every 200 points generated. Not surprisingly, this means you're discarding a lot of transitions and not getting the square wave that you expect.

 

On a cRIO, a much better way to generate a PWM signal is in hardware using the FPGA, on a digital output. Even if you can't use the FPGA directly, it would be better to use a digital output, unless for some reason one is not available to you. Either way, you will not get an accurate PWM signal with high resolution without using the FPGA, because you can't run the loop fast enough on the RT platform. Let's say you want 1% resolution on the duty cycle; in that case you need your loop to run at 100x the PWM frequency, or 12kHz. You'll have to test to see if you can achieve that. Your square wave generator should output only 1 point per iteration since that's all you can write to the output at a time, and the samples per second frequency will determine the duty cycle resolution (ie, for 1% resolution, enter 12000, again with the warning that it may not work).

0 Kudos
Message 2 of 2
(2,407 Views)