LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW PID controlled PWM output

Solved!
Go to solution

Dear All,

 

I need to control the heater with set temperature. My idea is to use PID control which can output duty cycle percentage and in-turn generate the PWM signal to control the SSR using single board RIO with 1 KHz frequency.

 

I have searched the forum for previous post. But unfortunate to find right one, most of them uses DAQ to generate variable duty cycle PWM output. Hence am using RIO digital I/O line in RT, am not familiar on how to proceed.

 

I would be happy to see the replies.

0 Kudos
Message 1 of 18
(7,152 Views)

Hi,

 

you can use attached vi and link the output to Digital Output port of RT. The vi has two inputs: "PID output (%)" which you connect to your PID controller and "PWM period (sec)" which specifies the lenght of PWM period. For heater I ussualy set something between 3 to 10sec. For better resolution I usually use heater  with more heating elements and split PWM into more parts.

 

BR, Jan  

Message 2 of 18
(7,120 Views)

Hi,

 


@JanBarton wrote:

Hi,

 

you can use attached vi and link the output to Digital Output port of RT. The vi has two inputs: "PID output (%)" which you connect to your PID controller and "PWM period (sec)" which specifies the lenght of PWM period. For heater I ussualy set something between 3 to 10sec. For better resolution I usually use heater  with more heating elements and split PWM into more parts.

 

BR, Jan  


 

Thanks for reply. Attached vi is protected, if don't mind can you share the password.

 

0 Kudos
Message 3 of 18
(7,115 Views)
Solution
Accepted by topic author lv_user_bs

Sorry, my fault 🙂

 

Here you are

 

BR,Jan

Message 4 of 18
(7,086 Views)

Hi JanBarton,

 

Thanks for your time. Can you please help me out to understand the logic because am new to this.

0 Kudos
Message 5 of 18
(7,077 Views)

Hi,

 

it is easy. A simple sawtooth  signal is built representing a value from 0-100 of period time. This signal is compared to wanted output value. If the value is  higher than the current value of sawtooth signal the output is high. See fig.2 on this webpage  https://en.wikipedia.org/wiki/Pulse-width_modulation  

 

BR,

 

Jan

0 Kudos
Message 6 of 18
(6,986 Views)

hello sir

Can you make a screenshot of the code ?

because i have labview 2015.

thank you

0 Kudos
Message 7 of 18
(5,655 Views)

Hi nad,

 

Can you make a screenshot of the code ?

I took the liberty to simplify the VI a little bit:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 18
(5,647 Views)

Thank you !

Another question : In tick counter, why do use ms like counter units ?

I think it's good  if you use ticks  unit.

and why do you multiply the result of substraction by 0.001 ?

 

0 Kudos
Message 9 of 18
(5,624 Views)

Hi nad,

 

In tick counter, why do use ms like counter units ?

The OP decided to use that VI (most probably) on a RT target, with using a millisecond tick counter…

 

I think it's good if you use ticks unit.

Depends on the target you want to run that code on…

 

and why do you multiply the result of substraction by 0.001 ?

Because the control is named "PWM period (sec)" and your tick counter gives ms: there's a conversion factor of 1000 between both units…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 18
(5,619 Views)