Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect DIP switches position

Hi,

 

I need to detect the position of DIP switches using NI Vision Builder. The method I have tried is first to create an intensity plane, threshold the image, detect objects and measure the distance between found objects. Then I try to deduce the position of the switch based on the distance between objects.
The main problems are wrong objects detected and not all DIP switches detected. Is there any other ways or suggestions how to approach the challenge? This seems to be a tricky one.

I attached four example images and vbai which I have tried.

Any help would be appreciated.

 

Br,

Jick

0 Kudos
Message 1 of 9
(3,523 Views)

I would try drawing a line across the switches.  If you position it right, you will see white for OFF switches and dark for ON switches.  You should know where each switch will be, so you can just go across the line and read the On/Off status at each position.

 

With VBAI, you may need to draw a small box for each switch and look at them one at a time.  The single line might only work in LabVIEW.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 9
(3,496 Views)

Can you reposition the camera to be looking at the dip switches straight on? If not, you could consider using a mirror to get a view of the DIP switches that don't overlap each other. The current angle makes it very difficult to tell if a DIP switch is up or down because adjacent switches can cover the area where the UP/DOWN position would be.

0 Kudos
Message 3 of 9
(3,493 Views)

Hi,

 

The thing is that I cannot move the camera. Have to think about the mirror too.
Drawing a line might work but the problem in this case is that I have to find the DIP switch row position exactly from the image because there might be some shifting depending on the platform and the unit under test. Even though the camera position will be roughly calibrated, it is not 100% sure it is at the same position each time.
I am now trying to use Match Pattern step and teach it different kind of combinations of switches using template images. This seems to be quite good method but disadvantage is that there is a lot of combinations to teach.

 

Br,

Jick

0 Kudos
Message 4 of 9
(3,484 Views)

Here's a method that works well.

Use Pattern Matching to find location and create Coordinate System.

Create Measure Intensity using the Coord System to reposition for each DIP. Have the Measure Intensity use a small ROI exactly where the DIP switch would be when it's up. If the Avg. Intensity isn't ~150, the DIP switch is down.

I attached a sample inspection to illustrate this. This will be much better than learning all the PM combinations.

Hope this helps,

Brad

0 Kudos
Message 5 of 9
(3,477 Views)

Thanks for your reply. I get a warning message from Match Pattern 1 when opening your vbai (see attachment) and the rest of the steps fails after that.

Did you manage to get reliable reference point for the coordinate system which is detected every time? I am asking because it was difficult to find anything unique from the image for the Coordinate System step.

 

-Jick

0 Kudos
Message 6 of 9
(3,426 Views)

Sorry, I forgot I was using pre-release DLLs for PM. Here's an updated VBAI inspection that should work for you.

Thanks,

Brad

Message 7 of 9
(3,416 Views)

Thanks a lot, it seems to work. I just have to fine tune pass/fail limits due to surrounding lights.

 

-Jick

0 Kudos
Message 8 of 9
(3,389 Views)

Thanks a lot, it worked fine with my own DIP switches too

0 Kudos
Message 9 of 9
(3,378 Views)