LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Counting cumulative on time and actuations of a signal

I've been tasked with setting up a DAQ to be able to take in several square waves, from 0 to 5v, to count the number of actuations and cumulative on time of a few solenoids. 5v would be the on position, 0v the off. 

My idea was to count the rising edges for the times actuated and then figure out a way to have a timer go on whenever the solenoids are in the on position and to not add time while they're off. I'd be doing this with 6 different solenoids. They're usually a PWM signal but based on what we actually need I was able to have a relay attached to turn the signal into a basic square wave.

I have a cDAQ-9179 and I was thinking I'd use an NI 9361 card to take the signals. I also have a NI 9326 card, but that's really it so far regarding counter/freq cards. I have other regular voltage cards too such as the NI 9220 if there's a better way to do it with that. I've used LabVIEW a bit back in college and I've modified some already-made code to work for other tests but I'm not very experienced with setting something like this up.

Any suggestions/ideas?

0 Kudos
Message 1 of 4
(1,714 Views)

Hi trevor,

 


@trevor101 wrote:

My idea was to count the rising edges for the times actuated and then figure out a way to have a timer go on whenever the solenoids are in the on position and to not add time while they're off. I'd be doing this with 6 different solenoids. They're usually a PWM signal but based on what we actually need I was able to have a relay attached to turn the signal into a basic square wave.


Which frequencies are you talking about when checking solenoids? What are the properties of the PWM signals?

How do you convert a PWM signal into a "basic square wave" using an additional relay?

 


@trevor101 wrote:

I have a cDAQ-9179 and I was thinking I'd use an NI 9361 card to take the signals. I also have a NI 9326 card, but that's really it so far regarding counter/freq cards. I have other regular voltage cards too such as the NI 9220 if there's a better way to do it with that. I've used LabVIEW a bit back in college and I've modified some already-made code to work for other tests but I'm not very experienced with setting something like this up.


As I'm more familiar with AI and DIO modules I would setup a DAQmx task to read AI signals and analyze them.

It's quite easy to convert the AI signal into a boolean signal by comparing to a threshold value, then you can easily count rising edges and also count the time of the TRUE signal (it's just counting TRUE samples and dividing by sample rate)…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(1,713 Views)

I don't know the frequencies nor properties of the PWMs. One of my techs, who has more experience than I've been alive, created a relay which changes the PWM from a fast series of 24v pulses to a simple square wave from 0v to 5v from pwm on to pwm off. I'm taking the input of that relay to be my signal.

 

Am I able to use a NI 9220 to take that signal and convert to a boolean to do all that you mentioned? How would I do that with DAQmx? Could you show me?

0 Kudos
Message 3 of 4
(1,700 Views)

I'd probably want to set up buffered pulse width measurement with a counter task.  There's a pretty good head start available in the shipping examples - "...Read Pulse Width and Frequency (continuous)".

 

Accumulate an array of all the pulse widths.  The size of the array (the # of elements) is your # activations, the sum of all the array elements is your total ON time.

 

The following minimal mods to that example will do that.

 

 

-Kevin P

 

image.png

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 4
(1,677 Views)