08-21-2012 04:33 AM
Labview ver:2011
Hardware:DAQ6009
I'm currently monitoring an LED that is on for 1sec and off for 3 sec. I'm monitoring the signal via a LDR (light dependent resistor) into one of the AI (analogue Input) channels.
Every time the light comes on I can see a peak in the graph plot.
I now want to detect if the LED on/off pattern changed ie: if LED is on for 4sec and off for 3 sec etc.
any suggestions will be appreciated
08-21-2012 10:56 AM
First you need to choose a threashold of what voltage you concider "ON". Then simply pass your analog voltage array into a Greater Than with the chosen threshold. This will yeild a boolean array. From there you should be able to check for your ON/OFF pattern.
08-21-2012 11:32 AM
Sorry if I didn’t make it clear, at the moment I can detect when a light comes on/off. 1V representing the LED on and 0V representing LED off.
The difficult part is recognising if the On/Off pattern is outside the quiescent condition.
Eg: if the light is on for 1 sec and off for 3 sec that means everything is ok (quiescent condition), however if the on/off period changes (eg if the light comes on for 4 sec and off for 1 sec, or vice versa) beyond the quiescent then I want to know an event has happened.
08-21-2012 11:50 AM - edited 08-21-2012 11:51 AM
I would use the Search 1D Array to find when the signal transitions from low to high and back. Subtract these to get the pulse width in number of samples. You will have to multiply by the sample rate to get the actual time in seconds.
08-22-2012 04:44 AM
when you say sample rate, is it for the DAQ because my signal is coming in directly from the DAQ (on-Demand)?
08-22-2012 11:42 AM
@D Raz wrote:
when you say sample rate, is it for the DAQ because my signal is coming in directly from the DAQ (on-Demand)?
Yes, the sample rate is the rate at which the DAQ is acquiring samples. On demand is probably not the way you want to acquire your data. You should use continuous and just grab what data is available and process what you have. Since you are dealing with seconds, I would use a sample rate of something like 100Hz.
06-17-2013 09:51 AM
I find your method interesting, although I have sorted this issue out (not 100%) but I tried your method I can't get it to work. I have attached what I have done.
Appreciate your reply