Color sensor with 8 programs


I'm trying to create a program that will have 8 different setups (options).

but I think I'm getting into a bit of a trouble with the pins I need for this so I'm asking here.

I bought the: TCS230 TCS3200 Color Recognition Sensor Detector Module for MCU Arduino

as a sensor for the color I want.

I'm going to have 8 different colors to watch for with the tolerance and all, they are going to be different colors but I've got this thing covered already.

my problem is that I want the users to push a button out of 8 buttons and I want a LED to light up so the user will know he selected the right program. also I want to switch the LEDs if the user push another button.

Also I want to put 2 LEDs as indicators for the user to know if the color is in range or not.

Right now if I count things right I have 19-20 pins to play with on the UNO (not sure but unless you guys come with a great plan I won't have enough)

The sensor takes 5 pins and each LED will take 1 and each button will take one and I need the 2 indicators which puts me at 23 pins that I need.

I know I can go with the MEGA but I'm sure things can be done to remove the LEDs pins from the equation which will give me what I need. I just am not sure how this can be done.

I thought about putting a LED after each button in series but that means I'll have to put a button that will keep the VCC up for the LED to light up and when the user will need to change the setup he'll need to first "unclick" the program he is on and turn on another program.

I'm pretty sure there is a simpler way I have yet to discover and would be glad if you could help me.

Thanks in advance,
And if you need more details please let me know.

I don't have a sketch yet but it doesn't really matter in here because I'm looking for a concept.
Thanks again for any help you can give me.

Hi sagirokach,

Just a few thoughts to consider in your design:

  1. If possible, avoid using digital pins 0 and 1. They are attached to the serial I/O pins that connect (via USB) to your computer. They will work for what you want, but sometimes circuitry can interfere with the serial function and will keep you from uploading your code.

  2. If you don't want to use a Mega, you can extend your digital I/O pins like this.

  3. You could consider using an "analog switch" like this.


Interesting read!
Thanks for the 1st point, I didn't know that.

and the "analog switch" can come handy.... I'll try that one and let you know...

Thank you anyways. :slight_smile: