# Choosing the right capacitors and resistors for transimpedance circuit

I'm designing a circuit for a pulse watch. Therefore I naturally have an operational amplifier and a photodiode in my circuit.

The job that I want the transimpedance amplifier to carry out is to respectively amplify the signal which is picked up by the photodiode D1 and furthermore remove noise that I would otherwise get at V_OUT.

The intention is to connect V_OUT to an analog port on my Arduino, on which I then should be able to read the current fluctuations (or is it voltage - since an transimpedance doesn't translate current).

I'm a total beginner at this, but I think that I succeeded in mapping this correctly.

However, I'm unsure that the values I gave my resistors are correct..

Let me give you my reasoning for choosing the values I chose:

Since I don't have any "negative current" in my circuit, I raised the non-inverting voltage to 2.5v by dividing the voltage with R5 and R8 - I believe that's a reasonable voltage, since I then have plenty of headroom and wouldn't cause the wave to "clip".

Next, I plan to add an ATtiny85 MCU, which (as far as I can read) has a "typical" current of 30mA per I/O pin.

There is though a place in the datasheet where it says "Analog comparator input offset current", which has a max of 40mV, but I don't really know what the parameter means.

However, I decided to put a 200Ω resistor before the V_OUT, because then at maximum output I would get something like 5/0.2=25mA. Which should be okay, and thus allows for a finer granular reading opposed to if I had e.g. a 1kΩ resistor, which would yield a maximum current of 5mA.

The photodiode I'm planning to use is: http://www.farnell.com/datasheets/8765.pdf?_ga=2.139995315.1420390384.1543406751-57595970.1536135582

And this is where things gets tricky for me. Especially, because I don't know which value to give R6, as the current across the photodiode will be dynamic.

Furthermore, I'm unsure about the capacitors.

My rationale tells me that C3 should have a relatively large farad value, as I obviously wouldn't want any noise from the gnd wire.

Also, my gut feeling tells me that I should just go with 0.1µf for both C1 and C2, but that's obviously not "optimal" in terms of limiting as much noise as possible.

To sum up:

• Is this circuit correct? i.e. are my assumptions correct too?

• How do I decide the values for C1, C2, R6 and C3?

And lastly, which DIP type amplifier would you choose for this job?

• This isn't something you approach by "gut feeling." This document from NXP gives you a collection of tips and equations for designing a pulse oximeter.
– JRE
Nov 29 '18 at 19:56
• And please rotate IC1 to point to the right. It will look better, and make it easier to draw the conbnections to it.
– JRE
Nov 29 '18 at 19:57
• I kind of get the feeling that you copied this circuit from somewhere and trying to make sense out to it. This OPAMP setup is a transimpedance amplifier with an integrated low pass filter. It transforms the input current of the diode D1 into a low pass filtered output voltage with some additional gain. So yes, your circuit seems to be topologically ok, but your reasoning is not. Nov 29 '18 at 20:03
• The comparator bit is if you use the built in (analog) comparator of the ATTiny. It is a cousin to an opamp, and like opamps, it will have an input offset voltage (not current as it is given in millivolts.) Input offset is the voltage difference you have to apply between the plus and minus terminals for the output to go to ground. Ideally it should be zero.
– JRE
Nov 29 '18 at 20:11
• The current per pin of the ATTiny is the supply current - how much current you can get out of it. As an input, it will draw next to no current.
– JRE
Nov 29 '18 at 20:12

• First is background knowledge.

You mention that you had already seen it. I suggest you take a closer look. It goes into the design process for selecting the circuit and parts. It also has finished suggestions based on certain assumptions that come from knowledge about the subject.

You say you want to understand what it does and how it works - that document explains it, and goes into the science of what you are doing.

• Parts

Let's take a look at just the transimpedance amplifier - that's the part you asked about.

Here's the transimpedance amplifier from the NXP document:

It explains how to calculate the expected output voltage from the diode current.

The expected current can be found in the datasheet for the photodiode you are using.

The datasheet gives you the expected current for a specific illumination intensity which will probably be higher than what you will get through a finger. From that you can figure a resistor to start with. Prototype with that value and see if you get enough voltage. Expect to have to change it to get more voltage.

The NCP document explains how to calculate the cutoff frequency for the low pass filter that is part of the transimpedance amplifier - and gives an example. You will need to calculate the proper capacitor depending on the feedback resistor you selected for your expected current.

The selected cutoff wasn't chosen randomly. NXP later mentions a bandpass filter that is implemented in software, and it has a similar cutoff on the high side.

It then details circuitry for cleaning up the signal. It explains as simply as possible how to calculate the values used in the filters, and why each stage is used.

• Calculations

NXP details how to calculate the oxygen saturation of the blood:

It sounds like you only need the pulse, in which case you don't need two different LED colors. One is enough.

From each LED color, you get a signal like in that example. The ratio of the two color signals gives you the oxygen saturation.

The signal from either signal contains the pulse. Use the ATTiny comparator input and a timer to count time between pulses. From time interval to pulse rate should be an easy calculation.

The most critical of the parts you asked about are C1 and R6. Those are covered above.

The others are decoupling capacitors. Anything from 100nF to a few uF will be fine.

C2 in particular, though, should be placed right up close to the opamp power pins. As physically close as possible, and with the shortest connections possible. This is needed to help keep noise from the digital section (AATiny) from getting into the opamp.

So, take a good look. Everything you need to know is in that document from NXP.

If the equations don't make sense, ask about them here (a new question.) Most of them are basic equations that you will need for general work with electronics.

• Thank you for your answer @JRE. One quick, yet probably complicated question to answer... How do they find these frequencies to filter out? from music production i know how it works, but often you need to listen in order to grasp where to cut certain frequencies. I know the wave is different here, in that it doesn't lead to a tone we can hear, but why is 60hz a golden frequency to do a nudge? Nov 29 '18 at 22:16
• 60Hz is the frequency of the AC power in the USA. It causes flicker and interference through the lights (picked up by your photodiode.) Long wires on high impedance circuits can also pick it up. From your name, I'd expect you need to be more concerned about 50Hz interference from european power lines.
– JRE
Nov 29 '18 at 22:23
• And, you can hear 50Hz if you have a good speaker.
– JRE
Nov 29 '18 at 22:24
• Denmark, so yes its 50hz :-) Wow, thats pretty useful! So it's basically to filter out external lighting. The weird thing is though, that in the example circuit, they have a low pass filter, and then afterwards a high pass filter. They say that the high pass filter seeks to filter out the DC signal, but yet, we use this signal to calculate the SpO2? isn't that strange? Nov 29 '18 at 22:35
• Nope. You use the AC signal to calculate SpO2. The ratio doesn't care about DC, and DC just represents a constant light level. Filtering out DC gets rid of the influence of daylight or non-flickering house lights. The 50 (or 60) Hz notch filter reduces intereference from flickering lights.
– JRE
Nov 29 '18 at 22:45