Shop OBEX P1 Docs P2 Docs Learn Events
Color sensing application question — Parallax Forums

Color sensing application question

Don MDon M Posts: 1,652
edited 2011-11-08 13:48 in Accessories
I have a potential application whereby I need to correctly identify 3 wire colors during an assembly process. The wires are approximately 24 gauge and are located virtually next to one another. They are fit into as jig and then sonically welded to some contacts. To try and avoid incorrect assembly I want to make a device that will "alarm" if the wires are not in the correct order.

So for those familiar with this type of application here are my questions:

1. Of the several type of color sensors available from Parallax which one would best suite this type of application.
2. Can all three wires be viewed at once and their proper colors defined in a specific portion of the field of view with just one sensor or do I need 3.

Thanks for your insight on this.

Don

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-07 16:30
    As much as I hate not to recommend one of Parallax's color sensors, I think a color image capture would be your best bet here. The reason is that the wire diameter is too small to fill even a fraction of either color sensor's field of view. Granted, you could conceivably use three TCS3200-DBs to do the job, but they would require extensive modification, including replacement of the lens assembly with one of a longer focal length and removing the LEDs in favor different lighting. With a color imager, one unit could read all three colors at once.

    What are the three colors, BTW?

    -Phil
  • Don MDon M Posts: 1,652
    edited 2011-11-07 16:39
    Phil- I am not completely sure of the colors. A friend of mine who works in the factory where they make these assemblies was telling me about the problems they were having during assembly of these parts. I need to get more information from him in order to intelligently respond. In fact I may just pay a visit there tomorrow to see first hand.

    So what are you suggesting by "color image capture"? What type of part would that be? Would the Propeller be able to process the info from this?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-07 17:03
    In considering this more, the way I would solve it is to use a TSL1401-DB along with an RGB LED to sequentially illuminate the wires with red, green, and blue light. That way you would have color values for each pixel across the three wires. (You don't need 2D imaging. One dimension is enough.) You could plug it into either the MoBoStamp-pe or the Propeller Backpack. The former would give you the most options for controlling the LED(s), since it has a second daughterboard socket.

    Along with many other projects, I'm planning an RGB LED plug-in for the 1401's mezzanine connector; but it's not on the front burner at the moment.

    -Phil
  • Don MDon M Posts: 1,652
    edited 2011-11-07 19:00
    So would you turn on each color of the led individually and read the output 3 times?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-07 19:19
    Yes. Well, actually four times, since you want to take a baseline sample (dark reference) with all the LEDs off.

    -Phil
  • Don MDon M Posts: 1,652
    edited 2011-11-07 19:45
    OK. Well this sounds interesting. I'll have to order one of those sensors and look into this a bit further. So you'd recommend the MoBo board over the backpack? Wouldn't the Prop board offer a little more in the way of computing power and options?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-07 20:06
    The Propeller certainly does offer more options as far as processing and more RAM for image storage. But with only one daughterboard connector, there are limited spare pins available for LED control. You could tap off the 1401's mezzanine connector. It offers two otherwise uncommitted pins (ported to A4 and A5) that could be used with a 74HCT138/139 address decoder to drive the LED segments. The go/no-go LED/alarm could then be driven from the Backpack's 3-pin interface header or from the PropPlug connector. (For that matter, the RGB LED address decoder could be driven from the Backpack's PropPlug interface.)

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-07 21:12
    Forget the part about the address decoder. There are three available pins on the mezzanine connector capable of driving the RGB LED directly. In fact, I've got a test setup built right now, which I "just" need to program to try it out:

    attachment.php?attachmentid=86673&d=1320729098

    More to come...

    -Phil
    467 x 256 - 30K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-07 22:53
    I am now quite comfortable that the TSL1401/Backpack/RGB LED is the way to go. Here's a photo of the test setup with three wires (red, yellow, and blue) lying side-by-side:

    attachment.php?attachmentid=86677&d=1320735003

    Here's the output I got from the image sensor:

    attachment.php?attachmentid=86676&d=1320735002

    This was without any calibration, ambient subtraction, or white balance. Adding those features would improve reliability even more.

    -Phil
    526 x 318 - 10K
    371 x 415 - 51K
  • Don MDon M Posts: 1,652
    edited 2011-11-08 04:44
    Phil- Thanks for your insights thus far.

    Questions-

    Would you care to share the program you used? I know the PC program is on the product page but was wondering about any additional spin program you may have used in this demonstration. Also any connection diagram.
    Is that just a black plate background?
    Did you use an all in one RGB led or 3 separate led's?
    Is there a different lens on the line scan sensor? It looks longer than the one pictured on the product page.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-08 07:42
    Don,

    "Would you care to share the program you used? I know the PC program is on the product page but was wondering about any additional spin program you may have used in this demonstration."
    Of course. Both the Spin and PC programs are new, and I want to revise both a little first.

    "Also any connection diagram."
    I'll work up a schematic later today.

    "Is that just a black plate background?"
    Yes, black acetal (e.g. Delrin).

    "Did you use an all in one RGB led or 3 separate led's?"
    It's an all-in-one in a P4 ("Piranha") through-hole package.

    "Is there a different lens on the line scan sensor? It looks longer than the one pictured on the product page. "
    The lenses currently being shipped with the linescan sensor are longer than the one illustrated on the product page, although the focal length is the same. The one in my photo is unscrewed from the housing quite a bit in order to achieve a close-up focus.

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-08 11:28
    Don,

    Attached is a zip with the Spin and .exe files. Here is a schematic of the LED attachment:

    attachment.php?attachmentid=86689&d=1320780198

    The LED is a TopBright TB5-V120-Flux-RGB8000, which I bought from China off of eBay. It's a common-anode unit.

    Here is the output I got with the program from a multi-color (brown, red, orange, yellow, green, blue) ribbon cable with 0.05" lead spacing:

    attachment.php?attachmentid=86687&d=1320780161

    Oddly enough, the LED's color outputs exactly match the spectral sensitivity of the TSL1401 chip, so no white balance was necessary. (Such a close match between sensor and light source almost never happens!) I did subtract the ambient in the PC program, however, and you should do this, too in your ultimate Spin program.

    -Phil
  • Don MDon M Posts: 1,652
    edited 2011-11-08 11:43
    Phil- Thanks. I have ordered the Prop backpack and a TSL1401 and a TCS3200 to play with too. I'll need to source the RGB led, I see Sparkfun has some.

    I visited the factory today to watch their process. They currently use a Keyence Digital RGB sensor that uses fiber optic heads at the point of sensing. So this brings up a question-

    Due to the available mounting configuration the TSL1401 would have to face upwards underneath the wires and look at the wires within a distance of approx 1" - 1.5". In doing so there would not be any standard background so basically it would be looking up at whatever along with the wires. Will this present a problem?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-11-08 12:03
    Don M wrote:
    ... so basically it would be looking up at whatever along with the wires. Will this present a problem?
    Yes, it could be a problem if the "whatever" is too bright and swamps the sensor. Is there no way to shield the background? Also, my sensing distance is about 3/4". For distances much larger than that, you may need to switch to a longer focal-length lens to keep the field of view small. 16mm would probably be about right. Here are some sources of lenses:

    ····www.ukaoptics.com
    ····www.mars-cam.com/optical.html
    ····www.sunex.com/

    You will want one with an M12 x 0.5mm thread and with a built-in IR filter (most common).

    Since this is an industrial environment, a protective housing is also a must.

    Just out of curiosity, what issues are they having with the Keyence sensors?

    -Phil
  • Don MDon M Posts: 1,652
    edited 2011-11-08 13:48
    Actually that was my question to them about what's wrong with what they have and what could be done to make them work better.

    First of all the Keyence sensor is one to one with each wire so you need a sensor for each wire location. Somewhat limits machine usage as some have just one sensor while another has 2. My thinking with the TSL1401 is that it would only need one sensor and could be "configured" through a display and buttons to set it up in viewing "windows" as to the number of wire locations and colors, etc..

    He tells me that the operator "messes" with the setups of the sensors (sensitivity, etc) and while I was there they had 2 of the 3 machines set so that they would let any color work which defeats the purpose of having them.

    Some of the wires have a tracer color stripe and that messes up with their existing setup. He gave me some sample wires- Black with red tracer, Yellow, Blue, Orange with white tracer, Yellow with black tracer, White.

    I attached a couple photos.

    2011-11-08 09.41.06.jpg
    2011-11-08 09.13.16.jpg
    1024 x 768 - 98K
    1024 x 768 - 103K
Sign In or Register to comment.