Electronic – CMOS circuit design: How to implement an interrupt circuit that detects minimum or maximum peak

analogcircuit-designdetectiondigital-logicinterrupts

I have an input signal sine wave like but comes with a little distortion. I need to give an interrupt when it reaches to minimum or maximum value with an acceptable tolerance.

res1

this graph is from a fading sine wave, what I want to do here is to detect the first minimum right before or right after rising again. So I can discharge or recharge it when it reaches its peak. But, as I told before there is a little distortion on the signal that may lead to false detection.

res2

I can tolerate a little timing here, interrupt may give signal a little time after peak point.

So, how can I do this in transistor level? I know I can use an ADC but I need this to be a transistor level solution.

Best Answer

Use some filtering to get rid of the majority of false flats and then use an analogue differentiator (CR high pass filter circuit) to produce zero crosses on the remaining flats.

This can feed a comparator that rises or falls depending on the signal direction change. Then, use an exclusive OR gate and a small RC time constant to convert the comparator output to pulses each time it changes polarity and these feeds the interrupt: -

enter image description here

Then exit that interrupt early when you see that the waveform is still heading south or north i.e. it hasn't reached max or min flat.

Because this problem is under-constrained and only the OP can really identify situations that this might not work I'm not going to get into lengthy discussions about this scenario or that (as yet unspecified) scenario.

If it is still seen as bad to generate an interrupt and leave it early on a false peak detection then use another little micro to do this bit of the analysis.