Hi,
[...] However after following the tutorial it seems that I have somehow gotten the circuit working with the photodiode. Can someone explain why this works -
The difference between photo diodes a and photo transistors is the gain - photo transistors are more sensitive, but slower reacting as well.
I placed a 220ohm resistor for R1, then I measured the resistance of my photodiode. In one direction it was infinite( or above 20 megaohms anyway ), in the other it was 76Kohm. I had some 42Kohm resistors so I put two in series in place of R2. Other than that I kept to the tutorial.
"Other than that"?
You changed 75% of the circuit, so I'd rather express it as "I kept 25%"
To find the optimum resistance value, you need to measure the entire setup as it will be used, over a dark area
and over a light area (in the direction where you don't get an over-range) and the two values you get, is then used to find the best value of the resistor.
Your choice of R1 only gives half the current of what can be safely handled into the LED and this will decrease the distance it will cover.
The photo diode will be more critical towards the resistor value.
I connected vout to the analog input pin of my arduino and ran a few tests. When the photodiode and the emitter face each other the current drops to 0v and when they are shielded from each other it jumps to 5v.
Can someone explain why this seems to be working?
When you use them for line sensing or obstacle detection, they only see reflected light, which will be extremely weak compared to your test set-up, so you need to test it in-situ, to see if they'll work for you at all.
When you shine an IR LED directly into them, they will conduct pretty hard, pulling to ground and while they don't see (enough) light, they'll be off (like if you cut the wire) and then the resistor(s) pulls toward +5V.