Shop OBEX P1 Docs P2 Docs Learn Events
TCS230-DB color sensor with arduino duemilanove — Parallax Forums

TCS230-DB color sensor with arduino duemilanove

hscriberhscriber Posts: 2
edited 2011-04-27 12:23 in Accessories
I am trying to make a robot that actively hunts down and retrieves golf balls off a driving range. I have a PING sensor to measure distance and tell my robot how far to move, but I want to use the TCS230-DB to determine if what I have found is in fact a golf ball. All the code I can find for it is in basic stamp, and I have no clue how to read that, let alone convert it to the arduino language. Does anyone have a sample code that they used with this sensor that I could look at to see where to even start? I have looked at the manual, it means nothing to me. I am a basic beginner, and haven't yet delved into schematics and things. All the codes I have written I have had a basic starting code that I modified to make do what I want. Please help.

Comments

  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-04-26 17:29
    Welcome to the forum.

    Could you please be a little more explicit about how your system is going to operate? How is your PING being used to find golf balls or to determine movement toward golf balls? What distance is the PING supposed to be measuring - distance to golf balls or distance from some sort of reference point? I seriously doubt the PING, by itself, could detect golf balls in the grass.

    Are all the golf balls the same color? Are they uniform in color or might they have stripes or logos on them? How will your system move through the grass and look for the balls? How fast does this thing have to work?

    The TCS230 senses color by comparing different sensor signals as measured through various filters. Do you really need to sense color or could some sort of contrast comparison be good enough? In which case could you use the TSL230? http://www.parallax.com/tabid/768/txtSearch/TSL230/List/0/SortField/4/Default.aspx

    As for reading the data sheet of the TCS230, it's fairly straightforward insofar as data sheets go. Are you sure you are ready for tackling a problem of this complexity? To me, it doesn't sound like a task for a beginner. It does, however, sound like a splendid job for a Propeller chip. Have you looked at those? http://www.parallax.com/StoreSearchResults/tabid/768/List/0/SortField/4/ProductID/423/Default.aspx?txtSearch=propeller+proto+board

    http://www.mouser.com/_/?Keyword=TCS230&FS=True
  • hscriberhscriber Posts: 2
    edited 2011-04-27 11:55
    The PING is reading distance every certain time interval, and if the distance is less than whatever I specify, I think I have it set to 36 in, it tells the servos to move forward. So basically, it's on a driving range, so anything it encounters should theoretically be a golf ball. I have an if statement that looks something like this:

    if (distance<=36){
    rightservo.writeMicroseconds(1400);
    leftservo.writeMicroseconds(1600);
    delay(t);
    }
    t is a variable I defined as distance divided by the speed of my servos.

    I want to be able to roll over the object the PING detects and see what color it is. If this sensor doesn't see white very well (the color of my golf balls), then I have thought about spray painting them neon green or something. I just need to know how to use this sensor.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-04-27 12:19
    hscriber wrote: »
    The PING is reading distance every certain time interval, and if the distance is less than whatever I specify, I think I have it set to 36 in, it tells the servos to move forward. ....

    For the light sensor, look at the Downloads and Resources for this, especially the Nuts and Volts articles: http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/TSL230/List/0/SortField/4/ProductID/88/Default.aspx

    The concepts behind the TSL230 are about the same except you might need to shift which color filters you are "looking" through for the TCS230. You basically control this chip by making pins go high and low, then read the output frequency.

    But as for my other point about the PING not "seeing" the golf balls.... have you tried your PING yet? Do you know of any one who has managed to get the PING to detect a golf ball in the grass? I very much doubt that it is possible, at least not from any significant distance. However, you might get the TCS230 or TSL230 to scan the grass and detect changes in light, but it's going to be a tedious process, scanning each patch of grass inch by inch.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-04-27 12:23
    The TCS230 (now the TCS3200) outputs a stream of pulses whose frequency is proportional to the light intensity. The Stamp programs count the pulses during a program specified period of time to get the frequency using the COUNT statement. That's it. There are two control lines from the Stamp to the sensor to select the color to be sensed and there are two control lines (for the TCS3200) to select the amount of prescaling. I'm sure there's an Arduino library routine to count pulses for a specified time and the control lines are controlled by setting them to output high (1) or low (0). You'll need to do some experimenting to see what sort of counts are useful and whether you need to do any prescaling and do the same for each of the colors.
Sign In or Register to comment.