This is a follow-up question to this one.

I am trying to modify a transimpedance amplifier in a way that its TTL output is inverted: 0V instead of 5V and 5V instead of 0V (like adding a NOT gate to its output).

I will first describe the original circuit and then switch to the inverted one with the question.

Original circuit

This is the basic schematic diagram of the original transimpedance amplifier. I know a capacitor is missing in parallel to Rf to avoid oscillation, but that is not the problem I am dealing with here.

original schematic

Those are the original data sheets for the main components:

I point a laser diode (1mW) to the photo diode that is pulsed with UART data. The laser pointer is just millimeters away causing significant changes in light intensity.

At the kathode of the photo diode we can measure this signal. The pulse width of the narrow pulses is around 833ms which fits the UART speed of 1200bauds. When the laser is OFF ("Idle"), the voltage level is 620mV and it drops when the laser is ON to -260mV.

original kathode

At the output of the circuit we measure this signal. A very well-behaved signal between 920mV (OFF) and 5080mV (ON), ready to be fed as a TTL signal into a micro-controller.

original output

Inverted circuit

In the original question, Olin Lathrop suggested this circuit (I hope I interpreted his suggestion correctly). We basically flip the photo diode and connect (+) of the opamp to 5V instead of 0V.

inverted schematic

At the anode of the photo diode we measure this signal. When idle (laser OFF), we measure 4.64V. When the laser is turned ON, we measure 5.41V. Makes sense regarding the schematics.

enter image description here

But on the output of the opamp we just measure fixed 5V, no matter if the laser is ON or OFF. Changing the size of the resistor Rf does not change anything. What am I doing wrong?


As I said in the answer suggesting the circuit with the diode connected to the 5 V supply:

In the above circuit, the opamp can be powered from the same voltage as at the top of the diode only if the opamp's common mode range extends all the way to its positive supply.

The opamp you chose does not meet that condition.


The input common mode maximum value of the LM358 op-amp is Vcc - 1.7 V. http://www.mouser.com/ds/2/308/LM358-D-106278.pdf

For your circuit, the voltages at the non-inverting and inverting inputs of the op-amp must be below 3.3 V for the op-amp to behave normally (i.e. have a large voltage gain).

You should consider:

  1. Switching to an op-amp that allows for rail-to-rail inputs
  2. Biasing the non-inverting terminal 1.7 V or more below the power-supply rail of the LM358.
  • \$\begingroup\$ Great! Do you have by any chance a suggestion for a type of op-amp for rail-to-rail inputs that is widely available? \$\endgroup\$
    – Phil
    Jan 1 '18 at 20:37
  • \$\begingroup\$ Digikey has a filter for rail-to-rail within the parts browser. There are so many options that it does not make sense for me to suggest one. I would need to have a better understanding of your system specifications. \$\endgroup\$
    – ljk07
    Jan 3 '18 at 13:20

To make the original circuit work you need to raise the voltage on the non-inverting input with a voltage-divider. Right now you are trying to pull the voltage on the inverting input to ground because the non-inverting input is tied to ground; and that is not possible because you don't have a negative supply.

The same is true for the second circuit you tried but just in the opposite direction.

To inverte the circuit simply put the diode on the non-inverting input instead and replace it with a resistor from the inverting input to ground.


simulate this circuit – Schematic created using CircuitLab


What you want to do is this:


simulate this circuit

Now you have a "transimpedance amplifier" that will put 0v over the diode and convert the current to a voltage AND "invert" the signal so it is un-inverted as you wanted.

Actually if the op-amp you had used was a rail-to-rail type you could have actually just flipped the diode arround on your original circuit and it would have worked AND been "inverted". But the problem with the circuit you have is that both ways you configured it the op-amp is trying to pull the output below gnd or above vcc.

Just be aware that your output voltage is going to be offset by ~0.7v so no light/zero current = 0.7v out of the op-amp.

Ask if you want me to explain in more detail what I did.

  • \$\begingroup\$ This runs the diode in open circuit voltage mode, whereas the original circuit ran it in short circuit current mode. This causes a number of problems. \$\endgroup\$ Jan 2 '18 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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