Ardunio color sensor

I am trying to make a sensor that could sense the color of pencils going into a pencil sharpener. The point of this project would be to sense whether or not someone was trying to sharpen a colored pencil in a electric pencil sharpener this would be useful to stop someone from sharpening a colored pencil and jamming the sharpener. I have never used an Arduino board and I was wondering what kind of color sensor and/or Arduino board I would use. thanks for the help! by the way this is my first real venture into micro processing.

Most sensors work by having an led and photo transistor. You can either have three colour LEDs and one photo sensor and flash each in turn to take the reading. Or you can have a white LED and filters over three photo transistors. You can either make these from bits or buy an IC with them all in. A Google search will bring up several kinds.

The big problem is targeting the sensor, it has to be close but it is quite a wide area it covers. The mechanics of mounting the sensor are going to be your biggest problem.

Any Arduno board will do.

Might be kind of difficult sensing the color of the lead, especially if the pencil is so worn down that very little lead is sticking out of the wood. You could detect the color of the pencil shaft, but then it wouldn't discriminate against yellow pencils. Maybe detect the softness of the lead by sensing the torque increase on the motor that drives the cutter.

yeah my goal would be to sense the shaft of the colored pencil, not the lead, I would mount it on the outside and have it press up against the pencil shaft to sense the color. My goal would be not to change the circuitry of the sharpener but rather use resistance to equal the amount of power drawn to act like a switch shutting down the sharpener if it detects any color besides the usual yellow shade of a regular pencil. The rig would be something that I could set up with an existing sharpener.

And what kind of color sensor should I? use something like this? RGB Color Sensor with IR filter and White LED - TCS34725 : ID 1334 : $7.95 : Adafruit Industries, Unique & fun DIY electronics and kits

bryannichols:
yeah my goal would be to sense the shaft of the colored pencil, not the lead

That's just not going to be reliable. Black pencils come with all different colours on their shafts, depending on the manufacturer and range.

okay, so what would you suggest? I figured out my shut off method but the sensor is the part I haven't figured out yet.

bryannichols:
okay, so what would you suggest? I figured out my shut off method but the sensor is the part I haven't figured out yet.

special circuitry to sharpen all colors of leads.

there is no reason you cannot sense the paint on the pencil exterior and just accept yellow as standard.
then flag the sharpner when it finds wood, or red, or black or some advertising type, but also allow the person to select a shapening mode for color pencisl.

people do not like to pull a snapped tip pencil back any more than you like to un-jamb the sharpener.

I guess what I am saying is that instead of being exclusionary, be inclusive, but with user input.

I can't think of a reliable way. Maybe the best you can do is have the sketch keep a list of the known shaft colours of black pencils, and hope that none of the coloured pencils have that exact same shade.

bryannichols:
And what kind of color sensor should I? use something like this? RGB Color Sensor with IR filter and White LED - TCS34725 : ID 1334 : $7.95 : Adafruit Industries, Unique & fun DIY electronics and kits

Expensive... I might try an rgb led and an ldr to begin with. The trick would be to exclude as much ambient light as possible from hitting the ldr, and exclude light coming directly from the led.

You could try making a small block of wood. Drill a hole going through it just large enough to put the pencil through. Then drill two smaller holes at right angles to the first hole, forming a V shape. The idea would be to be able to look down either of the smaller holes and see the same spot on the shaft of the pencil. Then you would mount the led in one hole and the ldr in the other.

The rgb led would be connected to 3 digital outputs of the Arduino. You can use a single series resistor on the common pin (e.g. 220R) because we will only be switching on either r, g or b at any time. The ldr would be connected to an analog input on the Arduino along with a resistor to make a voltage divider (e.g. 10K). The sketch would switch on the red led, wait a short time for the ldr to settle, take a number of readings from the ldr and average them, then switch off the red led, switch on the green led and repeat the process, and finally repeat for blue. With the 3 readings for r, g & b, the sketch would perform an rgb to hls conversion to get a colour "angle" 0 to 359.

Okay, thanks a lot! An you do mean a light dependent resistor? right?

Yep. They are cheap, so if the circuit does not work, you have not wasted too much money.

You could also use a photo transistor - they are about the same price. You wire them up slightly differently (like a transistor, with the photo-electrons supplying the base.)

If you are wanting to see the color of the lead, you may try using optic fibers(light pipes) to channel the light to the small areas.

A single CdS-300 sensor and a single RGB LED is all that is needed.

The CdS-300 cell responds to visible light, but not linearly.

The RGB LED provides 3 spectrum values. Brightness can be easily controlled by currentl with a fixed 5V Vcc, current is a function of the series resistance. Thus, it is possible to adjust a simple circuit to "white-balance" 3 CdS readings to the same analog amplitude.

Connect the CdS to 1 analog input and the 3 LEDs are pulsed on/off in sequence. The analog values are stored: V1, V2, V3.

The algorithm must take V1, V2, V3 as points on a curve of known spectral response:

qRkcm.png

[1]qRkcm.jpg

[1]qRkcm.jpg

BeerBelly:
If you are wanting to see the color of the lead, you may try using optic fibers(light pipes) to channel the light to the small areas.

Or a lens.

Just an idea: How about measuring the conductivity of the graphite? Maybe a needle in the middle of the sharpener as one contact point, an the sharpener itself as the second.

lg, couka

couka:
Just an idea: How about measuring the conductivity of the graphite? Maybe a needle in the middle of the sharpener as one contact point, an the sharpener itself as the second.

lg, couka

To my limited knowledge, the pencils with the colored centers are non-graphite. The idea of preventing the sharpening of non-graphite pencils (that is, only graphite pencils will be sharpened) the contact concept falls apart with a brand new blunt-end graphite pencil.

The Op's premise is that graphite pencils are all painted one color. Non-graphite colored pencils are painted the color of the drawing material... wax, powered coloring, what-ever.

To prototype the design, we only need to be able to differentiate all of the colored pencils from the single color of the graphite pencil.

In a Rube Goldberg world, we would RFID the pencils or bar-code them.

Ray

Perhaps a digital camera to takes some frames of the last user, a TFT to display it, something to detect sharpener jams and a sign saying "NO COLOR PENCILS IN SHARPENER. This IDIOT doesn't know color pencil from regular pencil.". After a while, even cats can be trained.....

GoForSmoke:
Perhaps a digital camera to takes some frames of the last user, a TFT to display it, something to detect sharpener jams and a sign saying "NO COLOR PENCILS IN SHARPENER. This IDIOT doesn't know color pencil from regular pencil.". After a while, even cats can be trained.....

OMG! That rich.... +1

Ray