I'm building a circuit that sends TTL level signal to uP whether AC signal exists or not. The schematic is as follows:
Actually, the circuit almost works as I expect; however, there occurs some coupling effect on the emitter side of phototransistor; which cause a delay at the output signal. I also added SPICE simulation of Vout and Vb of BC847B.
Green is Vout, and blue is VbQ1. Vout of the circuit is directly connected to I/O pin of my uP. Two questions arise here:
1) How can I prevent this coupling effect? (I've already tried to couple Vcc to emitter pin of optocoupler.)
2) What is the reason of periodic 90mV increase observed on the output signal? I don't think that it will affect the low-level sensing of uP (Vol = 0.3Vcc); however, it is better to supply a clean zero volt to the uP, I suppose.
Thanks in advance.