photodiode to digital pin

I recently bought these diodes
and i want to use the ir photodiode to switch on a digital pin on the arduino.All the circuits i have seen use a analog pin to read the diode.
could a circuit like this switch a digital pin when a ir led shines on it?
any idea what value the resistor should be?
I`m new to electronics and arduino (and drawing).

The diode conducts when light shines on it? Would appear to be reversed - you want current to flow into base of NPN to pull digital pin low when light shines. 10K for R1 is sufficient.

What is your application - as there may be better & simpler solutions with IR receivers (vc leds).

Using your approach, the circuit will be very open to interference from electric lights, sunlight etc. etc.

I want it do detect when someting comes between the ir led and photodiode.
After some messing around i came up with following and it works perfectly.

ps. the diode has to be reversed bias.


Are you sure the digital pin should also be connected to Vcc or is it just a drawing error?

In theory it will be always Vcc ...if I am correct?

Or am I mistaken?

I am not sure. i will try it without when i get back to my arduino!

Turns out it did not need a transistor to turn on digital pin! Ya live and ya learn! (sometimes). Love this Arduino stuff!

Good stuff!

We displayed 2 similar exhibits at the recent Dublin Maker Faire, which reset an Arduino in one and Woke a sleeping Arduino in the other - just using an IR LED without a transistor or any code.

However, still succeptible to an old interference.