NI Home > Community > NI Discussion Forums

LabVIEW

Showing results for 
Search instead for 
Do you mean 
Reply
Member
frnz
Posts: 98
0 Kudos

read relay switching time with scope tds1002

Hello everyone,
 
I need to measure relay's switching time (time from normally open to close position) and I don't know how to do this using TDS1002.  This is my first time writing a labview program (LV 7.1) using an oscilloscope.
 
The question is how do a measure and compare this data so as to make sure that this time is within the specs:  less than 200ms.
 
Basically the hardware circuit (detector) provides a low to high level (0 to 5V) when relay change state: open to close position.
 
I am planning to use the external trigger to start adquisition and channel 1 to monitor this level change.  The relay will bounce for about 10mS. 
 
Could it be possible to have a sample code that relates to this request or get some pointers as to how to perform this task in labview?
 
Thanks very much,
 
Frank
 
Member
frnz
Posts: 98
0 Kudos

Re: read relay switching time with scope tds1002

Hi Everyone,

Could someone point me to a link, app notes or sample code (labview) to be able to perform above request?  Thanks very much,

Frank

 

Knight of NI
Dennis_Knutson
Posts: 34,665
0 Kudos

Re: read relay switching time with scope tds1002

Are you interested in knowing the exact switch time or just that it occurs before 200msec? If it's just that if happens before the spec, then you can place a pull-up on one side of the relay, gnd the other side, and use the Mask & Limit Testing Express VI or the lower level Limit Testing functions. Another way would be to get a subset of the waveform from the 200msec point to the end and look at the max value in the waveform array. If it's right around gnd (use the In range and Coerce function), you know that the relay is closed and has stopped bouncing.
Member
frnz
Posts: 98
0 Kudos

Re: read relay switching time with scope tds1002

Thanks Dennis,

I need to know the exact time (+/- 1 mS) that the relay takes to switch from open to close or vice versa. That means that I need to monitor bouncing time and be able to determine when relay stops bouncing and the time that it takes to stabilizes at its close or open position (switching time).  Do you have any sample code, even if it is for other scopes; I am just looking for the technique to do this measurement right. Thanks again,

Frank

 

Knight of NI
Dennis_Knutson
Posts: 34,665
0 Kudos

Re: read relay switching time with scope tds1002

No, I have no example code. It's really not a matter of example code for a scope anyway. I don't think there is any scope that can measure it directly. You'll capture the entire waveform with the available driver and process it in LabVIEW. There's the tedious method of doing a waveform subset from the start to point x (i.e. 200msec or whatever the max might be). If the max of the remaining waveform is greater than x volts, then do another waveform subset. This time from the initial point plus the sample time. Maybe someone else will have a more elegant method.
Member
frnz
Posts: 98
0 Kudos

Re: read relay switching time with scope tds1002

Thanks Dennis,
 
I would like to try your suggested approach about looking at a subset of the total waveform.  Would you mind to explain this approach a little bit more, such as which vi to start with, then any subsequent vis to use to accomplish this task.  Thanks again for your help,
 
Frank
 
Knight of NI
Dennis_Knutson
Posts: 34,665
0 Kudos

Re: read relay switching time with scope tds1002

[ Edited ]

Here's the basics of what I was thinking. It uses the Get Waveform Subset function inside a loop. It keeps changing the start index of the waveform subset, gets the Y array, gets the max value, and checks the value using the In Range & Coerce. You could just as easily use the Less Than or Equal. This is of course, assuming that you are looking for a 5V to Gnd transition. The loop will terminate when the condition is met. You would then use the index value (the i value) to determine the time at which this condition was met. You would want to add some more code to terminate the while loop if the condition is never met. If you could do an actual acquisition of a relay closure and post the waveform of that, I or someone else could experiment with some real data.

Message Edited by Dennis Knutson on 10-08-2007 11:13 AM

Member
frnz
Posts: 98
0 Kudos

Re: read relay switching time with scope tds1002

Thank you Dennis!

This is a good starting point; I will try and advice results later on.  I will post more info as you have suggested above.  Thanks again!

Frank

 

Knight of NI
Dennis_Knutson
Posts: 34,665
0 Kudos

Re: read relay switching time with scope tds1002

I just had a better idea. If you reverse the Y array, you could search for the first point that exceeds some value. This would tell you where the bouncing has stopped. Knowing the size of the waveform and the sample rate, it would be a simple calculation to determine the time from the beginning of the acquisition.
Member
frnz
Posts: 98
0 Kudos

Re: read relay switching time with scope tds1002

Thanks Dennis, your continue support and ideas are much appreciated.

Frank