08-25-2021 11:14 AM
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?
08-25-2021 11:29 AM
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)…
08-25-2021 11:51 AM
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?
08-25-2021 02:03 PM
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