I would like to use a photodiode with an atmega328 to detect pulses of light from a toothed disk (illuminated by IR from the far side) at around 1MHz. Its to detect mechanical jitter in the rotation so I intend to time each 'illuminated' period with the atmega, the periods will be about 100 microseconds long so for 1% resolution I need to be able to detect them at about 1MHz.

I have not used photodiodes at a high speed before and it looks like its not as simple as I assumed - I need to use a transimpedance amp as the current is small and the speed high, and the capacitance of the photodiode causes problems as I understand it.

The device is meant to be battery operated at low current and 3v, and while I guess its possible to find an op amp to do this it seems like overkill, even though apparently split rails can be avoided - all I need is to detect the presence of a few tens of uA at 1MHz with a digital IO pin, seems like a quite basic requirement. Therefore I am looking at transistor transimpedance amp designs like this one in another answer. I realise many peoples instincts are to reach for a suitable op amp but thats not what my question is about today.

But there's no actual info there on what performance can be expected, and whether this circuit is optimised for digital operation. I don't need a swing of 10V but just enough to trigger the digital in pins of the atmega. I do need quite high speed considering the current available, which this answer says is achieved with low resistor values. But how to calculate the actual cutoff frequencies or gain at x frequency? Theres plenty of info on the web to do this with op amp circuits but I can't find the same for these simple transistor circuits.

Could one use a darlington type of approach for higher voltage / gain if the single transistor is not enough? Ideally since I have stocks of the the 2n3904/6 transistors would be usable.

I haven't chosen a photodiode yet - I do have a few TPS703(F)s around, which are fairly fast at 100ns, but I can order others.

Since its battery operated, I obviously don't want to run the illuminating LED at too high a current meaning the photodiode current won't be at the top end of its rating (ideally), but needs must. If the only way to get it to work is to illuminate the photodiodes strongly then that can be managed, its just not as optimal as a midrange light level.

  • \$\begingroup\$ Is your goal to have 1 microsecond accuracy or 1 MHz bandwidth (350 ns rise time)? Those are very different things. I recently built an optical system for tracking ~10 KHz mechanical motion with a goal of ~ 100ps accuracy. I used a 25 MHz photodiode, which was plenty fast to sample a 10 KHz signal with good oversampling. Timing accuracy is about SNR moreso than bandwidth. \$\endgroup\$ Commented May 19, 2023 at 0:24
  • \$\begingroup\$ The key thing to decide is how much photocurrent you're starting with. Assuming 1 MHz bandwidth and 1A/watt responsivity, that photodiode into 3500 ohms will generate 3.3V for an illumination power of less than 1 mW without an amplifier. If you were ok with a 1 microsecond risetime (probably still better than you need), then you could use 10k ohm and would only need ~330 uW onto the photodiode. If your system isn't too optically lossy then you might skip the amp entirely while not using very much power on the LED. \$\endgroup\$ Commented May 19, 2023 at 1:53
  • \$\begingroup\$ I'd be tempted to try something very simple: driver your LED at some reasonable current, maybe 20 mA and put a small lens to focus onto the photodiode. Then reverse bias the diode at 5V, and add resistance in series with the diode (to turn photocurrent into voltage) until your MCU detects the edges. Since your system will be essentially noiseless, even a very slow rising edge will have very little jitter. You may find that a simple 100k resistor and one of those spare diodes is all you need to solve this problem. \$\endgroup\$ Commented May 19, 2023 at 1:56
  • \$\begingroup\$ Look up Phil Hobbs. He has a book, Building Electro-Optical Systems: Making It All Work, on the topic. But also a paper titled Photodiode Front Ends: The Real Story that you can find and read. Also Getting Photodetection Right. His style is a matter of taste, but since I worked with him for a few years decades ago, he's my recommendation. \$\endgroup\$ Commented May 19, 2023 at 8:27
  • \$\begingroup\$ @user1850479 I've been trying to figure out how you got those numbers but finally realise, I think you're using a figure for current per watt of light thats 100 times higher than the photodiode I mentioned, maybe you could confirm this? The linked datasheet mentions around 1uA at 0.1mW/cm2 as far as I can tell. Does the rest of your comment still stand for those figures - or have I read the sheet wrong - or am I interpreting it wrongly? Theres such a difference in value that I wonder if I am missing something. \$\endgroup\$
    – Pete
    Commented May 19, 2023 at 17:09

1 Answer 1


While I don't have a complete answer to my question I think the comments above have filled in the gaps in my understanding enough to go forward now.

It will take me a while to try out the suggestions and my own ideas from increased understanding now, in the mean time rather than leave this question open I felt I should answer it (for now).

As @user1850479 suggested I can try a direct input to the atmega with some variable reverse bias and a resistor to develop some voltage. The papers suggested by @periblepsis also provided some circuits, although probably of a greater quality than I need - I believe I understand it more now and after making a few circuits in spice I believe for my application if the direct input approach does not work I can try feeding the reverse biased diode into the base of a NPN, using a 10k load resistor and sampling the voltage (omitting the resistor from base to collector from the linked answer schematic).

We will see but thanks for the comments.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.