Transimpedance amplifier design using STM32G484 with integrated opamp - Page 1
Forum section: electronics / projects

author: Matthew47
author_rank: Newbie
timestamp: April 06, 2025, 08:08:51 pm
content: Hi,I am working on a robotics project, and I have a need for 4 transimpedance amplifiers that will be used in object detection sensors. The STM32G484 contains several integrated opamps, so I will not have to use external ones for this project.The following article helped me decide on the values for the compensation capacitor and feedback resistor; however, I would like to get a second opinion on the design before ordering parts for testing.https://www.osioptoelectronics.com/media/pages/knowledgebase/b954012b64-1675100541/an-photodiode-parameters-and-characteristics.pdfNotes:1) I chose the 27500 Ohm resistor such that the typical reverse light current (60uA) will create a 1.65V signal on Vout of the opamp.2) The expected signal will be modulated in the KHz range, and will be digitally filtered by the MCU to reject ambient lighting.Photo diode:https://www.digikey.com/en/products/detail/vishay-semiconductor-opto-division/BPW24R/1681148MCU: file:///C:/Users/Matthew%20Komitsky/Downloads/stm32g484ce-9.pdfI would appreciate any thoughts on things I have missed, or areas of improvement!-Matthew

author: TimFox
author_rank: Super Contributor
timestamp: April 06, 2025, 08:18:38 pm
content: The datasheet shows 11 pF (typical) capacitance at 0 V bias, so your 8 pF (8.2 pF is a standard value) seems reasonable.That capacitance could be reduced to 3.8 pF (typical) at 5 V reverse bias, but the dark current will go up to 5 nA (typ) at 60oC: is this acceptable?Of course, 8 pF and 27.5 k\$\Omega\$ (standard value 27 k) would give a low-pass filter -3 dB at 720 kHz (probably OK: how many kHz is your modulation?).

author: Matthew47
author_rank: Newbie
timestamp: April 06, 2025, 10:35:36 pm
content: I chose the photovoltaic mode of operation, so I don't need to reverse bias the photodiode --> I don't have a negative voltage supply on this project.~30KHz is the modulation frequency, but this can be easily tweaked in software.Another resource I forgot to mention:https://www.analog.com/en/resources/technical-articles/stabilize-transimpedance-amplifier-circuit-design.htmlI was unable to reproduce their example calculations, so there might be a typo (or I am misinterpreting something) --> I calculated 12.2pF, and they got 15.6pFMy theoretical knowledge on this subject is limited, so it might be more worthwhile to experiment considering there will be unknown variables with the PCB design.

author: TimFox
author_rank: Super Contributor
timestamp: April 06, 2025, 10:39:56 pm
content: If you invert the diode, you can use a positive reverse bias and invert the input polarity.Does that work with your modulation scheme?

author: Matthew47
author_rank: Newbie
timestamp: April 06, 2025, 10:57:19 pm
content: That's possibility; however, I simply don't how much of a difference photovoltaic mode vs photoconductive mode will make in this application. My understanding is that the difference will primarily lie in response time.Here's the context: These sensors (aimed sideways) will be used to center a robot moving down a walled path at >2 meters/second. Faster signal stabilization will allow me to spend less time reading the ADC, and more time processing the data.

author: TimFox
author_rank: Super Contributor
timestamp: April 06, 2025, 11:10:44 pm
content: Quote from: Matthew47 on April 06, 2025, 10:57:19 pmThe two differences are capacitance (reduced by photoconductive mode with reverse bias) and dark current (increased in photoconductive mode, increasing drift and noise somewhat).The datasheet shows little difference in sensitivity.You can model the response time question in Spice (or its derivatives), modeling the diode as a current generator (photocurrent) in parallel with a capacitance and either a resistor (voltaic) or DC current (conductive).In conductive mode, the I-V curve has a finite slope going through zero. In voltaic mode the equivalent parallel resistance is very high, but there is the leakage (dark) current.Both the parallel resistance (in voltaic mode) and dark current (in conductive mode) are strong functions of temperature.

author: tggzzz
author_rank: Super Contributor
timestamp: April 07, 2025, 09:43:37 am
content: Quote from: Matthew47 on April 06, 2025, 08:08:51 pmThank you for providing a decent explanation of your thinking, plus links. Too few people manage thatThe PD characteristics document is a good starting point.It is unwise to rely on any "typical" value, especially one that is temperature sensitive.The mean output voltage will depend on the ambient light intensity - and that will, of course, change as equipment moves.Have you assessed the relative intensity of the modulated light vs ambient light + dark current, over a range of conditions? Possible contexts: analogue saturation, required ADC resolution, and your device's ADC's ENOB.

author: RobertBarnes
author_rank: Newbie
timestamp: April 09, 2025, 10:59:41 am
content: I am just replying here so that I can keep track of this thread.

author: Matthew47
author_rank: Newbie
timestamp: April 10, 2025, 04:20:54 am
content: I was able to get a waveform with no overshoot by tinkering with the value of the capacitor. However, it is much larger than what I initially calculated, so there might be something wrong in either my understanding and/or the model I created.Photos of the waveform and the Excel calculation based on this article are attached:https://www.analog.com/en/resources/technical-articles/stabilize-transimpedance-amplifier-circuit-design.htmlNote: The model isn't using the exact opamp I am using, so that might be an issue, but the Spice model and calculation are so disconnected that I can't help but think I am missing something fundamental.What am I missing here?

author: electron_plumber
author_rank: Regular Contributor
timestamp: April 10, 2025, 01:51:51 pm
content: On my way out the door, so I can't walk through your math but... you definitely need to use an op amp with the same bandwidth/gain for the math to work out. If there isn't a spice model available, build one in ltspice and match the datasheet's OL gain. Additionally, it may be the case that the analog article is solving for a gain margin of 45 degrees or something, which will result in some overshoot by definition.Try out the TIA calculators on Michel Gallant's website:https://www.jensign.com/transimpedanceamp/index.html

author: Matthew47
author_rank: Newbie
timestamp: April 15, 2025, 03:33:31 am
content: I spent some time with that article, and it did help me get closer to understanding this.My simulations lookmorecorrect now (using a model closer to the actual OPA), but I would need to spend more time with a pencil and paper learning the mathematics to make more sense of the theory. Perhaps a more careful experiment with a precision opamp would be in order to practice with...In the meantime --> My plan is to build the circuit with a feedback capacitor in the 8pF range, and see how it performs. The opamp in the STM32 seems to range from GBW ranging from 7MHz to 13MHz, so it would influence the calculations quite a bit.

author: dietert1
author_rank: Super Contributor
timestamp: April 15, 2025, 08:55:52 am
content: In order to use the opamp properly i would turn around the photo diode. You want negative feedback from the opamp output and all your supplies are positive, so the diode should produce a negative voltage (cathode at opamp input). At least that's what i remember from our pulse oximeter circuits. For linear and temperature stable output the diode is better running near zero voltage, so the positive opamp input should be at Gnd.Regards, Dieter