# Signal hole detector using op amp, comparator

#### glorimda

Joined Oct 12, 2011
17
I'm designing a circuit doing role of detecting signal drop from the microphone. This is purposed to do some range test of product. By receiving the signal through the microphone, while receiving the signal, outputs 5V, if there's no signal or signal drop outputs 0V.
I'll put the 1Khz sine wave to microphone, amplify the signal and make it to square wave at comparator. Then through peak detector, it keeps that output fixed at 5V while there's signal, and if signal is dropped more than certain period, it goes to 0V.( This period is determined my adjusting the value of peak detector components and current circuit has around 250ms).
In the simulation program, I can get the right and intended result. But in real, sometimes it works well sometimes not. When I stop putting the signal, it sometimes still stays at 5V. So I looked into each part and I figured out that when the output is 5V even without signal, there is voltage rise at R11. So postive input of comparator(U3) is getting higher than negative input and it outputs 5V. But when it works right(no signal and 0v output), there is for sure voltage drop at R11.
I can't seem to find any reason myself and 'm stuck in here for a while.
Can anybody give me any idea or help about that?

P.S. pulse(v3) and Switch(S1) is to give some signal off time. So you don't need to care about it.

#### Attachments

• 5.6 KB Views: 18
• 110.8 KB Views: 34

#### praondevou

Joined Jul 9, 2011
2,942
When there is no input signal to U1 it's output will be the same as it's input voltage (+- input offset error), i.e. 2.5V. The inverting input of U3 is also at 2.5V. That's why it sometimes works and sometimes it doesn't.
Once the comparator's output is HIGH and there is no microphone input signal the output will stay HIGH because the non-inverting input is being pulled higher than the inverting input through R8.

IMO you should make sure that with no mic signal the voltage at the inverting input is a bit higher than at the non-inverting input. You could do this by simply connecting it to an unbalanced voltage divider instead of Vbias.

If you also increase the hysteresis resistor R8 you could maintain the voltage difference at the additional voltage divider to a minimum, so you would be able to work with smaller mic input signals.

#### Attachments

• 6.6 KB Views: 21

#### glorimda

Joined Oct 12, 2011
17
praondevou, I really appreciate your reply. I got the point you're trying to say and tomm I'll post the result after trying that, cuz I don't have it now.
BTW one thing I'm not clear is,
'Once the comparator's output is HIGH and there is no microphone input signal the output will stay HIGH because the non-inverting input is being pulled higher than the inverting input through R8.'
How can the non-inverting input be pulled higher than the inverting input? and inverting input through R8? Did you mean R9? cuz inverting input is not connected to R8.
I don't understand 'being pulled' part. Could you explain it again?

#### praondevou

Joined Jul 9, 2011
2,942
Set Tdelay of V3 in the simulation to e.g. 7.5ms.
The comparators output will be HIGH at this moment.
If at this moment the microphone voltage goes to zero (which will happen in the simulation) the comparator output will stay HIGH because the non-inverting input is pulled to a higher voltage level compared to the inverting input (through R8).

Inverting input is now at Vbias. Non-inverting input is at a voltage higher than Vbias, i.e. output continues HIGH.
This wouldn't happen if the voltage at the inverting input was maintained higher than the voltage on the non-inverting input.

So wether your current circuit works or not depends on the state of the comparator at the moment where the Mic voltage gets too low.

You could also amplify the signal much more, then pass it through a fullwave precision rectifier (2 opamps) and after that pass it to a comparator.

Last edited:

#### glorimda

Joined Oct 12, 2011
17
Wow, now I'm cleared. That's so kind of you. I just put the pulse signal making signal off when the output of comparator is high in simulation software, the output of whole circuit stayed at 5V as I experienced in real. So I know the reason and can fix it. You really helped me a lot. I'll bring the result later.
Thank you.!

#### glorimda

Joined Oct 12, 2011
17
Sorry for late bring the result back. have been pretty busy to find way of that problem.
As you said, when the signal goes off with 5V of output at the comparator, the output pull the positive input high and even if there's no signal, positive gets higher than negative and this was the reason. So I put another voltage divider from Bias Voltage(U2) to negative input higher than positive when signal goes off. So I've solved this basically, got another problem though.
BTW, when I use comparator, do I have to always care about this situation? (status of output)
I'm attaching the modified picture.
Thanks for helping praondevou!

#### Attachments

• 113.1 KB Views: 29