Shop OBEX P1 Docs P2 Docs Learn Events
TCS3200-DB problem — Parallax Forums

TCS3200-DB problem

Involute1344Involute1344 Posts: 14
edited 2011-03-03 18:17 in Accessories
]I'm a sculptor (kinetic) developing a piece that will sort M&Ms using the TCS3200-DB. I've spent a lot of time collecting data and characterizing M&Ms via the sensor and was quite satisfied with its ability to discriminate (at least, once the RGB values are converted to HSI). In the last couple of weeks, though, the sensor's been providing completely different data than what I've seen before. All the frequencies are lower, by about 50% (I always run the sensor at 1:1, i.e., full-speed, and net out ambient light by strobing the LEDs). I still get different values for the individual channels, but nothing that converts to the appropriate hues. I've stripped everything down to just the sensor, the DB-Expander, and a breadboard, using a digital storage scope to acquire the data, but no luck. I've even swapped out the sensor for a new one on the chance the old one got shocked somehow. Any ideas what might be causing this behavior?

Very frustrating since everything was rock-solid until I replaced the breadboard and DB-Expander with a cable for direct connection to my CPU board (not Parallax-based). Then the weirdness. Unfortunately, going back to the breadboard and DB-Expander didn't fix the problem.

Thanks.

Attachment not found.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-13 21:11
    Karl,

    Please include a schematic or complete hardware description, along with a copy of your program. Also, please include some "before" and "after" sample data for comparison.

    Thanks,
    -Phil
  • Involute1344Involute1344 Posts: 14
    edited 2011-02-13 22:13
    Ooops. OP edited to include pdf. No code, just raw data form sensor.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-13 22:29
    What did you use to acquire your original data? Just the scope? Or was there a micro involved at that stage? If there was a micro, how did you first recognize there was a problem?

    -Phil
  • Involute1344Involute1344 Posts: 14
    edited 2011-02-13 22:58
    Just the scope. The micro later confirmed the scope's findings, as it does now (though, per the schematic, I've temporarily removed it from the equation). I discovered the problem on the micro when it started to incorrectly identify M&Ms. Nor did it happen immediately with the switch to the new cable, but over the course of a few hours. That's when I went back to just the sensor board, the expander, and the stock cable.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-13 23:16
    Okay, let me make sure I'm clear:
    1. The problem is that the output frequencies have gotten lower on all channels by about 50%.

    2. The problem began when you switched cables and gradually got worse during the course of an hour.

    3. Upon going back to the old cable the problem persisted.

    4. The same issue occurs with more than one sensor board.

    Two things come to mind:
    1. Your subject distance has changed. IOW, the distance from the lens to the candies has gotten larger, or the candies are no longer centered in the field of view when the samples are taken.

    2. Your power supply voltage has dropped or is not providing enough current to the LEDs when they are strobed. Did you change Vdd and +5V to 3.3V, perhaps? (Only Vdd is 3.3V/5V convertible. The +5V supply has to be 5V.)

    Do either of those possibilities ring true?

    Also, one thing puzzles me: if you're converting to HSI, the Hue should not change if the outputs from all three color components drop uniformly. Only the Intensity would be affected in this case.

    -Phil
  • Involute1344Involute1344 Posts: 14
    edited 2011-02-14 11:38
    Phil:

    Summary 1 - 4: correct.

    Suspicion 1: incorrect. My set-up hasn't changed (see attached photos).

    Suspicion 2: incorrect. The power supply has always been ~5.125V. I've tried two different supplies.

    I agree the hue should not change if the RGB values drop uniformly, but they don't. I was speaking loosely when I said they dropped about 50%. R is 57% of original, G 54%, and B 50%.
    1024 x 842 - 68K
    1024 x 1246 - 109K
    1024 x 764 - 64K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-14 11:52
    You've chosen a very challenging orientation from which to observe the candies. Based on my own experience with sorting M&Ms, I know you'd get more consistent results reading from the top than from the edge. For one, the subject distance will not be so dependent on the candy's position in the pocket. Also, you'll be looking at a broad surface, rather than a tiny edge, which may or may not be centered in the field of view. If the edge is not exactly centered, you will get a lower reading. Don't worry about the white "m". It has virtually no effect on the readings.

    Something else I wonder about is the edge of the hole in the clear Plexi with regard to the LEDs. It appears as if the edge will interfere with the beam pattern, due to refraction. This could also skew your readings if the LED positions get disturbed the slightest bit. I would recommend making the hole larger if the edge is in the way.

    BTW, if you need a couple feed tubes sized just right for M&Ms, I have lots and would be happy to send you some. Here's a link to the M&M sorter I designed for Parallax (which has been discontinued):

    -Phil
  • Involute1344Involute1344 Posts: 14
    edited 2011-02-14 13:49
    I wish I'd found you a couple years ago when I first started thinking about this (obviously it hasn't been a full-time project). I came across your sorter early on in my research, though I never knew who designed it. Very impressive mechanism you came up with, using a single electro-mechanical component. I considered using the broad side instead of the edge, for all the reasons you mentioned, but I assumed the printing would cause problems (in spite of the fact that your machine seems to do OK). Why doesn't it? I would think even averaging the gray over the 3.5 mm x 3.5 mm viewing area would through the hue off significantly.

    Thanks for the tube offer. If I end up going that way I may take you up on it. What diameter do you use?
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-14 14:00
    The overall area of the printed "m" is so small compared to the field of view, that the effect is negligible. Add to that the fact it's printed in a zero-saturation color, so even if it affected the intensity and saturation slightly, the hue would escape relatively unscathed. (BTW, you can defocus the lens to get a bigger field of view if you need to. This also helps to blend the detail among the sensor's color pixels.)

    I had the tubes custom made to fit the M&Ms, since no stock sizes fed them properly. Consequently, I had to buy a LOT of them. Anyway, ID is 0.555", and OD is 0.615". It's a non-stinky plastic that won't contaminate the candy with noxious chemical fumes. IIRC, it's an FDA-approved polymer, but I wouldn't swear to it.

    -Phil
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-02-15 08:20
    ....I know you'd get more consistent results reading from the top than from the edge. For one, the subject distance will not be so dependent on the candy's position in the pocket. Also, you'll be looking at a broad surface, rather than a tiny edge, which may or may not be centered in the field of view. If the edge is not exactly centered, you will get a lower reading...

    Perhaps you could raise your sensor a little and use a prism or a mirror so your sensor looks down on the candy. Perhaps that would avoid a total redesign of your system. However, if you don't want the sensor to be visible to your viewing public, you might lower the sensor and look up from the bottom, but that would require a transparent, low friction, non-smearable floor for the candies to skooch along.

    I presume that, once it detects your favorite color candy, a jet of air puffs it up and you catch it in your mouth. True?
  • Involute1344Involute1344 Posts: 14
    edited 2011-03-02 17:56
    ElectricAye:

    Sorry for the delayed reply. The forum didn't notify me of another post. Once identified, the disk rotates allowing the M&M to drop into the machine which has configured a series of channels directing it to the proper bin. You can remove it from here.

    Phil:

    Attached is a pic of my tester for collecting data from the faces. I've also attached a spreadsheet of the collected data. It's still somewhat ambiguous, especially when distinguishing between an orange (with or without an M&M label) and a red (with no label). I won't blame you for not wanting to wade into the sheet; can you send me your data so I can compare the two sets and maybe see where I'm going wrong? Any other ideas? Thanks.
    1024 x 1241 - 87K
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-03 15:01
    'Had a heckuva time getting to your xls file. Can you provide a version that's free of Excel macros and put it in a zip, please?

    Thanks,
    -Phil
  • Involute1344Involute1344 Posts: 14
    edited 2011-03-03 15:40
    Sorry, Phil. Try this one. Excel assures me it's compatible with Excel 97 - 2003, so it should be better-behaved.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-03 16:07
    'Still no joy -- sorry. Excel continues to warn me about malicious macros. Can you post it as a CSV file that I can import into Excel?

    -Phil
  • Involute1344Involute1344 Posts: 14
    edited 2011-03-03 18:17
    Well, once again Microsoft is being too clever. I can't do any better, I'm afraid. I've attached a pdf of the sheet so at least you can see the values, but you won't be able to check my formulas (lucky you).
Sign In or Register to comment.