So now you have a “clap” waveform with a high peak voltage that tapers off to a comparatively low voltage within a few tens of milliseconds. Let’s say we feed this directly into a comparator with a 2.7 volt threshold. In the simulated waveform there are two peaks that are above 2.7 volts, which would cause multiple triggers, separated by about 1 millisecond. This would turn the light on and 1 millisecond later it would turn off. Clearly, this is not acceptable. You could raise the threshold to say 3.3 volts. That way you would only have 1 trigger per clap. Unfortunately, this is at a very high level and would be difficult to clap loud enough to ensure 1 trigger, but soft enough to not get multiple triggers. You would find that one of the two situations would happen for just about any threshold level you set.
What is needed is a circuit with a rapid charge and a controlled discharge time. One that can essentially follow the envelope shape of the waveform. In the circuit below C2 is rapidly charged through D1 by the highest peak of the “clap” waveform. C2 is then slowly discharged through R5 and D2. The discharge rate is predominantly set by the value of R5 and the value of C2 (T = RC).

In order to keep C2 relatively small, make R5 = 1Meg. You don’t want to make this resistor to much larger because then the input bias current of the opamp could become significant and affect how the capacitor discharges. Make C2 = 0.1uf.

The green trace is the output of U1. The blue trace is the voltage across C2. Notice how the capacitor charges to about 3.0 volts, even though the peak voltage is 3.6 volts? This is because of the drop across D1. By using a slightly higher gain (larger R4), some of this voltage loss can be partially compensated for. That is why I choose R4 to be 47K instead of a closer 39K. I increased the total “sweep time” to 1 second so that the full discharge characteristic can be seen.
Add D1, D2 R5 and C2 to your circuit. There are many possible diodes that will work in this circuit. The 1N4148 (or 1N914) were chosen because they are common silicon switching diodes possessing a low leakage current and reasonably fast speed. If you don’t have them, feel free to try something else. Even a 1N4004 would probably work, but the charge voltage on C2 could be different.
Reproduce the waveforms on your scope with the circuit values shown and post the results. The vertical should be 0.5v/div. The sweep rate should be at a rate that will show 1 second of the waveform (100 ms/div?). Trigger the scope on the output of the opamp using channel 1. Simultaneously look at the voltage across C2 with channel 2. Put the ground for each channel at the bottom graticule. Trigger the scope on the 1st horizontal graticule.
Play with the values of C2 (anywhere from 0.001uF to 1uF) and R5 (anywhere from 10K to 1Meg), observe how different values changes the voltage across C2 with time. With R5 = 1Meg, double the value of C2 (put a 2nd 0.1uF in parallel). Measure and report how long from the trigger point it takes for the voltage to drop to 1 volt. Post that waveform also.
What is needed is a circuit with a rapid charge and a controlled discharge time. One that can essentially follow the envelope shape of the waveform. In the circuit below C2 is rapidly charged through D1 by the highest peak of the “clap” waveform. C2 is then slowly discharged through R5 and D2. The discharge rate is predominantly set by the value of R5 and the value of C2 (T = RC).

In order to keep C2 relatively small, make R5 = 1Meg. You don’t want to make this resistor to much larger because then the input bias current of the opamp could become significant and affect how the capacitor discharges. Make C2 = 0.1uf.

The green trace is the output of U1. The blue trace is the voltage across C2. Notice how the capacitor charges to about 3.0 volts, even though the peak voltage is 3.6 volts? This is because of the drop across D1. By using a slightly higher gain (larger R4), some of this voltage loss can be partially compensated for. That is why I choose R4 to be 47K instead of a closer 39K. I increased the total “sweep time” to 1 second so that the full discharge characteristic can be seen.
Add D1, D2 R5 and C2 to your circuit. There are many possible diodes that will work in this circuit. The 1N4148 (or 1N914) were chosen because they are common silicon switching diodes possessing a low leakage current and reasonably fast speed. If you don’t have them, feel free to try something else. Even a 1N4004 would probably work, but the charge voltage on C2 could be different.
Reproduce the waveforms on your scope with the circuit values shown and post the results. The vertical should be 0.5v/div. The sweep rate should be at a rate that will show 1 second of the waveform (100 ms/div?). Trigger the scope on the output of the opamp using channel 1. Simultaneously look at the voltage across C2 with channel 2. Put the ground for each channel at the bottom graticule. Trigger the scope on the 1st horizontal graticule.
Play with the values of C2 (anywhere from 0.001uF to 1uF) and R5 (anywhere from 10K to 1Meg), observe how different values changes the voltage across C2 with time. With R5 = 1Meg, double the value of C2 (put a 2nd 0.1uF in parallel). Measure and report how long from the trigger point it takes for the voltage to drop to 1 volt. Post that waveform also.
Last edited:















