0

This is my first question on this site, and I'm relatively new with Arduino. I do have some experience using the board to reprogram a robot that used infrared proximity sensors, servos, and switches.

I would like to add a sensor on to the robot that will allow him to recognize specific "obstacles" that I will put in his environment (not walls!) For instance, when he sees a red card, he needs to spin, but when he sees a green card, he needs to roll in the opposite direction. I do not want to spend much on the cards, but I would be willing to put a small battery and LED in them if I had to. The cards do not necessarily need to be colored, I was just using that as an example.

The robot will be in a well-lit room with noise in the background. He will be controlled by an Arduino Uno, an infrared sensor and a remote control. He can be pretty close to the cards if he has to (3 centimeters or so would be enough). It would be ideal if he could discern different types of cards, but that is not necessary as long as he's able to tell a card from the rest of his environment.

I am simply not sure how to go about implementing this. I have read about using photoresistors to differentiate color, and they're really cheap, but will they be accurate enough from a distance? This is the light sensor I was considering using:

http://www.mouser.com/ProductDetail/Adafruit/161/?qs=GURawfaeGuDpQ5XPTNqKUw%3D%3D&gclid=Cj0KEQiA6IC2BRDcjPrjm_istoUBEiQASrLz1rQNwZgntUcccnOmrFph-pCbu60R00GNozB_XbZxYz0aAn0j8P8HAQ

I'm willing to pay about 5$ for one if I need to.

If I use the light sensor method, can I just use brightly colored cards or will I need to use LEDs? Is there a better way to accomplish my goal that you are aware of?

Thank you for your time. If there is missing information in my question, please tell me and I will add it.

3
  • How about NFC RFID cards?
    – Majenko
    Commented Feb 14, 2016 at 21:45
  • I'm not sure. Your mentioning it was the first time I'd actually heard about the things. They sound really neat, but it looks like it'll cost about 45$ for the setup, and for that money I can get a nice color sensor and the cards will be easier to make. Thank you for your response, though, and I will keep it in mind!
    – Joy
    Commented Feb 14, 2016 at 22:14
  • A cheap RFID sensor is a few pounds plus the stickers, they're like 0.1-0.2 pounds usually (depends on the quantity) I think you'd get like 100 stickers plus a reader for 25 pounds. Plus RFID is much more reliable.
    – Avamander
    Commented Feb 15, 2016 at 9:59

3 Answers 3

0

If you are controlling your robot with a remote control, why do you need it to detect cards, instead you can tell it to do whatever you want right?

If you want to detect specific objects according to their colors, arduino is not a platform i will choose, because it doesn't have processing power to do image processing.

But take a look at this, http://charmedlabs.com/default/pixy-cmucam5/ it can talk to arduino, and you can train it by telling it identify colored objects which i might think is apt for your case. RFID tags will be a good idea as @Majenko said.

1
  • I'm making a "game" where the robot "fights" enemies that you direct him towards. Once the robot recognizes an enemy, he "fights" it (knocks it over) and the player gets a point (or something to this effect). The Pixy looks awesome, but I think it might be a bit too powerful for a project of this scope. Thank you for your response. I will do more research on RFID tags!
    – Joy
    Commented Feb 14, 2016 at 22:19
1

You can get an RFID reader for $7 from eBay:

RFID reader

Cards are around 30 cents:

RFID card

I have example code for an entry control system which uses that reader.

The cards tend to activate at around 3 cm to 5 cm, so that sounds about right. Of course they aren't particularly directional, but if you are driving in a certain direction and it detects a card it is probably in front of you (however possibly off to one side).

You could combine card detection with simple range finding using an ultrasonic detector.

1
  • Oh, wow, this looks great! Thanks so much! I think this will be perfect.
    – Joy
    Commented Feb 18, 2016 at 22:02
0

Detecting colour with RGB illumination and an LDR is not particularly accurate in my experience. The idea is you illuminate the card (or whatever) with red light, take an LDR reading, then with green then blue.

This gives you a set of 3 light levels for the different colour components of the object. Combining them together gives you an RGB signature for the object. Ideally, on say a red card, the value from the LDR under red illumination is much stronger, and blue & green much weaker.

RGB LED + LDR colour detection does work, but it's not accurate, and it helps to block out ambient lighting. Maybe if you put a lot of time into calibration, it would for you. I had a classroom of 14 kids, each made-up one of these circuits, yet only a couple had any moderate success, if at all. That said, we were using very cheap RGB LEDs and similar quality LDRs.

There's a bunch of stuff you can do to help the accuracy, like subtract readings with only ambient illumination, take multiple readings, etc.

I think you would save yourself a lot of time and frustration buy using a purpose-made colour sensor.

Something like the ADAFruit Colour Sensor - https://www.adafruit.com/products/1334

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.