Light Flashing Frequency Calculation with NI Vision

Updated Jan 5, 2018

Reported In

Software

  • Vision Builder for Automated Inspection
  • Vision Development Module

Issue Details

How can I use NI Vision Builder for Automated Inspection (Vision Builder AI) or NI Vision Development Module (VDM) to determine how quickly an LED or some other light source is turning on or off?  The frequency of flashing or the duration in which the light is on and off?

Solution

Regardless of if you are using NI Vision Builder AI or NI VDM, in order to determine the frequency of the flashing or even how long the light is on or off, you will need to make sure you at acquiring the images at least twice as quickly as the highest frequency of the light flashing to not get aliasing.  You will also want to make sure you are acquiring the smallest image size to improve processing speed.


Vision Builder AI 

  1. Acquire the image 
  2. Set an ROI that only contains the light 
  3. Determine what state the light is in:
    • Colored image: use Measure Colors and set Limits to the values that can identify the different states of your light.
    • Monochrome image: use Measure Intensity and set Limits to the values that can identify the different states of your light. 
  4. Record the state of the light in a user-defined variable as a 1-D array.
  5. Go through the 1-D array after a set period of time to determine the frequency or duration of on/off.
 

Vision Development Module

  1. Create an acquisition loop that acquires the image from the camera and send the image reference to a queue.
  2. Create an image processing loop that reads from the queue that the acquisition loop writes to.
  3. Inside the image processing loop, read from the image queue and determine the state of the light.  You will want to use as small of an ROI as possible.  You may find IMAQ ColorHistogram or IMAQ GetColorPixelValue for colored images and IMAQ Histogram or IMAQ GetPixelValue for monochrome images useful to determine the state of your light.

Additional Information

The sampling rate of at least twice the max frequency of the light is due to the Nyquist-Shannon sampling theorem.

WAS THIS ARTICLE HELPFUL?

Not Helpful