# Using photodiode to measure onset of screen refresh

Background: I currently have an ATmega AVR microcontroller development board and hope to use it to measure the moment a screen changes from black to white to determine the time when a screen refresh occurred. This is in the hopes to accurately determine when someone sees something for EEG research. My ideal is to attach the dev board and breadboard to the back of a computer monitor and just have a photodiode attached to the corner of the display via cables. I purchased a bunch of OP950 side-view flat photodiodes (http://optekinc.com/datasheets/OP950.PDF) to lay flat against the screen.

Question: My question is how do I properly use this photodiode? I read the spec sheet forward and back and researched how to use these, but I feel like I'm missing some crucial aspect to make sense of it all.

From what I've read so far:

1. I want it reversed biased for speed.
2. I need to determine the resistance based on it's reverse light current.
3. I might need an OP AMP to boost the signal (although I only really want a binary response of no light vs. light)

I know this is a pretty general question, but after looking through books, learning about semiconductors and photodiodes at a micro level I still don't know what exactly I'm looking at with the spec sheet.

In my attempt to solve this alone, I've come up with this:

1. The spec sheet lists 60V as the reverse breakdown voltage, which I want to stay away from since it would result in damaging the diode.
2. The spec sheet lists Reverse Dark current as 60nA Max, which is the current it always has when connected due to leakage.
3. The spec sheet lists Reverse Light current as 8μA-18μA, which is the range of current that is created by shining light on the photodiode when provided a 5V reverse voltage.
4. The resistor needs to come between the 5V pin on the arduino and the negative pin on the photodiode.
5. The resistor needs to account for the reverse light current and the 5V power supply.

I assume many of my assumptions are incorrect, and researching others' similar questions were too divergent to make sense of my component's spec sheet. Also, I would include a diagram, but I feel very uncertain how it would look and would prefer to think this out with better information from anyone who can help.

Thanks in advance for anyone's support!

• Some background reading: www.ti.com/lit/an/sboa035/sboa035.pdf, www.linear.com/docs/16998 You will need to start looking at circuits, and these are a good start to understanding the requirements. We can help, but currently the question is so broad it risks being closed; try to choose a topology and narrow the question. Commented Mar 6, 2016 at 18:01
• Thank you Peter, I will check these out. I was afraid this was too broad a question, but really needed guidance in how to address the problem(s). Those readings will certainly help, thanks! Commented Mar 6, 2016 at 20:47
• Does it matter that the OP950 is an IR photodiode? Wouldn't you be best served by visible photodiodes? Commented Mar 6, 2016 at 21:59
• Yes, you are correct Sredni. When I ordered it the spec sheet didn't explicitly say it was an IR photodiode (I was more interested in it being a side-view component). Now looking back it does show it's peak light frequency is in the IR range, but it is capable of being triggered by white light so it is still a feasible component for my purposes. Thanks for this notice though, I'll keep it in mind in the future. Commented Mar 8, 2016 at 4:03

You probably think that your circuit should look like this

simulate this circuit – Schematic created using CircuitLab

and ultimately this may be possible.

For now your circuit should look like this

simulate this circuit

In principle, this should provide you with a voltage swing of about 1.6 to 3.6 volts, and respond within 2.5 usec. In both cases the voltage developed by the dark current will amount to about 12 mV. BUT

"3.I might need an OP AMP to boost the signal (although I only really want a binary response of no light vs. light)" Well, you need to define just what "no light vs light" means. It's sort of saying you want a binary response to sound - loud or not. What constitutes enough brightness, and what does not? Once you get some experience with your display, you'll be able to decide that, but for now you simply don't know enough to make the necessary decisions.

1.The spec sheet lists 60V as the reverse breakdown voltage, which I want to stay away from since it would result in damaging the diode.

Either circuit will do that.

2.The spec sheet lists Reverse Dark current as 60nA Max, which is the current it always has when connected due to leakage.

But note that this leakage occurs when the diode has 30 volts across it. The leakage current will be less at lower voltages.

3.The spec sheet lists Reverse Light current as 8μA-18μA, which is the range of current that is created by shining light on the photodiode when provided a 5V reverse voltage.

Yes, but only when it is exposed to a light power level of 1 mw/sq cm. How much light does your screen put out? Until you know that, you really have no way of knowing what the diode will do.

4.The resistor needs to come between the 5V pin on the arduino and the negative pin on the photodiode.

In either circuit the photodiode is reverse-biased, so the negative lead (the cathode) is tied positive.

5.The resistor needs to account for the reverse light current and the 5V power supply.

As long as the 60 volt limit is not applied, the current through the diode will be pretty much independent of the voltage. Not perfectly, but very close.

There is another issue you have not dealt with - speed. Just how fast a response do you need? As I mentioned, the op amp circuit will respond in 2 or 3 microseconds. Is that fast enough?

Using the second circuit will allow you to play around with the feedback resistor to find out how much you need at the light levels you actually encounter. If you object to 15 volt supplies, you can use +/- 5 volts as long as you us an op amp like the TLC2272, which can handle those voltages. In fact, as long as you use a rail-to-rail op amp, you can connect the op amp - supply to ground and use only a single +5 supply. You still want the -5 volt supply to bias the photodiode.

• Ignore that^^ Thank you so much WRB, this was most everything I've been wondering. I was thinking of a circuit that is as simple as the first. This is my attempt at recreating that: link (excuse me if I'm screwing it up, I'm still very much a noob with circuitry and schematics). When I did this and read values from the analog pin it was sensitive enough to detect changes from black to white in a fairly binary manner (0-black on screen, anything >0 for white on screen). I used two 100kOhm resistors in place of a single 200kOhm, hopefully that was also done properly. Commented Mar 6, 2016 at 20:44
• As far as speed is concerned, a typical monitor refreshes at 60hz (sometimes more, but we usually get 60hz). By that logic, my measuring speed needs to be as fast as 16.66~ms or faster to detect when the screen refreshes. I'll set it to poll at 1ms and that should be fine (although talking about microseconds makes me wonder if I can get to that precise microsecond measurement reliably). If you wouldn't mind checking my circuit and determining that it is safe from any sort of damage, I'll happily mark this solved! Commented Mar 6, 2016 at 20:45
• Note that screens have a finite response speed; average LCD monitors will take 5-10ms to change from white to black. Commented Mar 6, 2016 at 20:55
• @pjc50 - That looks OK. Notice that you can play around a bit, and use larger or smaller resistors as you see fit. For instance, a single 100k resistor will give you 1/2 the amplitude as two, and it's up to you to decide if that voltage level is adequate. Also, I don't think LCDs have a vertical blanking period, so you might want to look into that. Blanking periods were necessary with CRT screens, but not with LCDs. Analog video waveforms do have blanking, but I don't believe that applies to the actual LCD drivers. Just saying. Commented Mar 6, 2016 at 21:07