Question: I have the following circuit with a photodiode and an LM358P where I intend to blink an LED at around 20kHz. I want to work on it. I have made a calculation through 1/(2piRC), and got something around 33khz. Is this correct? Will this circuit work with a 20kHz frequency ?

[![enter image description here](https://i.stack.imgur.com/j4in2.jpg)](https://i.stack.imgur.com/j4in2.jpg)

Answer: 
> 
> *got something around 33khz. Is this correct? Will this circuit work
> with a 20kHz frequency ?*
> 
> 
> 

It's nearer 34 kHz but yes this will do the job adequately with some rounding of the output signal.

However, the output signal will clip at around 3 volts typically with an LM358 and, that op-amp will introduce some extra low pass filtering due to its small bandwidth and slew rate limitations on the output: -

[![enter image description here](https://i.stack.imgur.com/V9YI2.png)](https://i.stack.imgur.com/V9YI2.png)
It can work if your LED generates enough right wavelength light to the diode. I suspect that other lights disturb the function substantially. To avoid it you should use a circuit which doesn't amplify DC and the flicker of mains AC operated lights. For good sensitivity you should have a filter which removes unwanted signals. It should be placed in front of the actual amp if your LED is weak compared to ambient light. 47kOhm resistor is quite small, but that can well work in strong light or with sensitive diode.

BTW your capacitor causes lowpass filtering which doesn't help at all against low frequency nor continuous disturbing lights.