Thanks a lot to everyone who contributed to my question. I appreciate all your suggestions!
I'm by no mean a professional EE engineer so please bear with me if I ask a dumb question
.
I should provide more scope to my original question.
The signal you're seeing is from an IR receiver.
The transmitter and receiver pair are approximately 3cm apart.
They are used to detect a small and fast-moving subject.
My goal is to generate an interrupt signal to the MCU (which is sleeping to save battery) every time the subject moves across the transmitter-receiver pair.
I tried using an inverting comparator with hysteresis where I set my reference voltage to be slightly larger than the input voltage when there are no pulses.
The input signal is subject to ambient light, i.e. signal amplitude will vary within around 200mV. That's why I can't use a fixed reference voltage.
Do you know how I can make the reference voltage adapted to the ambient light?
Thanks again.