Sensing light difference between white and black color on paper

I'm creating a project where I want to smoothly and slowly drag (most probably, it will be done by a motor that slowly turns a wheel) a white paper sheet with solid black lines and dots directly over an array of 20 sensors. The dots and lines will be 5mm thick and they will be close side by side. To give more context - it will be printouts from MIDI software piano roll.

The photo pair should be chosen in such a way that black levels trigger Arduino digital input pin to LOW and white levels trigger HIGH.

Which exact diode and photodiode models (hopefully, popular and cheap ones) would be the most appropriate for this purpose and could switch between HIGH/LOW levels with minimum additional components?

How should I locate them? Should they be at 45 angle to each other to receive reflected light from the paper?

Or can I put them above and below the paper (most probably not, the difference of black/white might be too small to trigger HIGH/LOW reliably)?

I guess, in any case I might need to add resistors to shift output voltages a bit because it seems unlikely to hit the right spot immediately just by using photo pairs alone. At least, I would like to avoid using opamps or additional transistors.

SFH3410 should do it. I believe your algoritm is more important here

Thanks. But all SFH3410 options seem to be SMD; I might need something more suitable for prototyping.

But I just found QRD1114. Wondering, will this work if I drag a sheet with 5mm thick black lines over a sensor? Will it reliably detect the difference between black and white parts of the paper and how it should be located for the most accurate results?

I guess I'll have to try to be sure. Unless somebody can immediately tell me that QRD1114 will not be good enough for my purpose.

I have used the QRD sensors to do almost exactly what you want to do. My use was in a 3 bit absolute encoder for a wind direction vane. You may need to experiment with the media used to make the black lines. I had trouble with black toner of a laser printer being too reflective (to IR), but Sharpie pens made a better black line.IR REFLECTIVE.jpg

The 30K resistor can be the internal pullup on the input pin.

u should check these out

QRD1114 white vs black detection

Thanks for the answers.

So, QRD1114 might be not the best choice - my black lines might come from different printouts, including the laser ones. Could there be some way to make the colors more distinctive for the sensor? Maybe putting some kind of a frosted filter (sandpapered film) on the sensor to keep it from detecting too much reflections caused by ink and not the color itself?

The problem is not unique to the QRD sensors. It is just the way of IR light. Something that looks dark and not at all reflective to you might be very reflective to IR. You might look into the sensors that people use in line tracking robots. Perhaps they have better sensors or techniques for sensing the black lines of various media.

Is there any similar QRD1114 alternative using visible light diodes? I will need 20 of such pairs, thus it would be great to have something tightly integrated in single element, so I can create an array of them.

Is there any similar QRD1114 alternative

Pololu's QTR series line sensors. They have been around for quite a while, so there is a lot of experience to call on, especially Pololu's forum.

There is no real advantage to using visible light. If you have problems with the existing ink, look for another that works well with IR sensors.

I’m afraid I don’t have much ink choices - it’s what comes out of a standard printer. The idea is to avoid manual painting of the note bars on the sheet.

I have found a similar project using IR diodes and pulling the sheet between them instead of reflecting, but the scheme was using comparators (opamps).

As I understand, photo transistors (such as in those QRD and QTR) should be more sensitive than photodiodes and I have seen some projects attaching QRD directly to Arduino input pins (with a pullup resistor), but I’m not sure if such a simple approach will work for black/white on a paper sheet.

Well, I’ll have to try. I have a bunch of simple LEDs and IR LEDs, but I have to buy photodiodes/transistors/QRD - will see, what’s available and cheaper.

Just found a deal - pairs of PT204-6B IR204-A , at least I can arrange them for shining through the sheet to avoid relying upon reflected light, but not sure if PT204-6B alone will be able to provide strong enough signal for emitting HIGH level on Arduino pin.

Try the QTR module before assuming that it won't work.

Surely you can afford the price of a good cappuccino for a pair of well engineered modules.

Something that I have found to be very effective is to attach the LEDs to a digital pin. This way you can measure ambient light and reflected light. By taking both measurements into account, you can eliminate interference from changes in ambient light (people casting shadows, at night, outside ...). This does require analog inputs, though. You can easily multiplex two of the six analog input pins, using 3 digital pins for the address selection.