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: 

Measuring of DUTY CYCLE with myDAQ?

Solved!
Go to solution

Hello everyone,

 

sorry for my beginer question. Is it possible to measure duty cycle with myDAQ? If yes, could you give me an advice  please how? I want to measure temperature with  temperature sensor SMT 160-30 with duty cycle output.  I tried both analog and digital input. In the case of analog input there is a problem with zero amplitude (error). If I use digital input then output is boolean 1 and 0 and I dont know how to proceed to determination of duty cycle. I use DAQ assistant so I will gratefull for solution with DAQ assistant.

 

thanks a lot

 

Pavel

0 Kudos
Message 1 of 13
(5,355 Views)

Which duration do you want to measure?

0 Kudos
Message 2 of 13
(5,328 Views)

Hi Artem,

 

thanks for response.

 

I am not sure if I understand your question. I want to measure continuously and I would appretiate if it could be possible to determine duty cycle e.g. each 5 seconds.

0 Kudos
Message 3 of 13
(5,318 Views)

What kind of signal you have?
You talk about cycling and then about  temperature sensor.
Do you want measure temperature period?
Can you draw or record sample of signal?

0 Kudos
Message 4 of 13
(5,306 Views)

Hi Pavel,

 

I think you'll want to use a counter input task. If you're using the DAQmx drivers you can take a look at the Counter - Read Pulse Duty Cycle and Frequency (Continuous) example, by clicking on Help >> Find Examples.. and searching for "duty cycle".

 

Or, you can use a drop down a DAQ Assistant on your block diagram and configure it for a counter input task.

0 Kudos
Message 5 of 13
(5,297 Views)

I already did it, but it showed me a statement that current device (myDAQ) has not inputs for such measurement of duty cycle (in the case of counter input).

0 Kudos
Message 6 of 13
(5,289 Views)

please see datasheet of this temperature senzor e.g. at http://www.gme.cz/img/cache/doc/969/009/smt160-30-datasheet-1.pdf . The output of this signal is square signal witch changing duty cycles as effect of temperature.One way coul be: I could connect sensor to digital input I will get changing values 1 and 0 (according to square cycle and duty cycle the amount of measured 1 and 0 should be influenced by temperature). Unfortunatelly I am beginer with labview and I dont know how to work with logical values (1 or 0) to calculate amount of ones and zeroes. From ratio of ones and zeroes it is possible to calculate duty cycle.

0 Kudos
Message 7 of 13
(5,277 Views)
Solution
Accepted by topic author Pavel88

What you should do is capture an analog waveform (the PWM signal).  Then you do a comparison on all of the captured data to see if it is larger than a threshold.  A typical threshold for a 5V signal is 2.5V.  That should result in a boolean array.  You then use Boolean To (0,1) followed by Mean.  If you want a percentage, multiply by 100.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 13
(5,268 Views)

You can read array of DI data. In port format it already numeric. Then you can use Pulse measurement VI

 

DI.png

0 Kudos
Message 9 of 13
(5,258 Views)

: Thank you for your advice. It is certainly solution of my problem. Unfortunatelly I dont know how to make the block diagram. I have never worked with arrays in labview (I am really begineer). Is it hard to built this block diagram?  Is it possible somehow zero the values e.g. after 5 seconds to calculate new array and then new value of duty cycle(the value of duty cycle will be refreshed every 5 seconds)?

 

thank you very much

0 Kudos
Message 10 of 13
(5,252 Views)