To Audioguru: R2 is in fact a 47k resistor, not 4k7, which happens not really to matter since I guess its still too low value. I'm thinking of replacing it with a 470k or even 1M resistor. Do you think this would work, or do I have to add a buffer, comparator or similar between the CPU input and the junction?
To ljcox: I haven't yet tested this particular setup, because I'm waiting for a bunch of BP104s to arrive by mail, but I have tried it with a BPW34 which, although also sensitive to normal light, worked quite nicely.
In any case, D1 and D2 will be mounted in a dark place, so there should be little or no ambient light to mess with D1. Also, they are spaced no further than 10 cm away from each other, so I guess distance won't be the problem. Am I wrong?
I've been searching the database for similar posts, and there seems to be quite a few, and I learned much from them, but none of them really seems to answer this question: Can the photodiode act as a logic switch (in this case with a 2051 input)?
Thanks so far for your help.