Clap switch with latching relay

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hi Parkera, just seen your post. Have no spec on mic but it does seem to be working much better in this new circuit. Can you see any problems with the circuit?
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Parkera to better answer your last post, I have decided to use the LM358 op amp on a 5v supply.
I'm not going to use a voltage regulator as power supply puts out an exact 5v DC.
Get what your saying about changes in mains voltage effecting output but think I'll go with small value cap instead, think 0.1mf should do.

Not certain but the mic looks very like a electret type. I think they require a voltage level from 4v to 10v and a resistor from 1k to 10k, so ok with both values.
That's all I have on it, would prefer to work with it for now and only replace if I really need to.

Also I've got an oscilloscope and signal generator if needed.
 

Parkera

Joined May 3, 2016
106
Hi copey84 - If the output of the supply is clean and the noise remains less than 10mV p-p from 0 to the full load you will be drawing (25ma?), then bypass capacitors alone should be OK. The power supply voltage is now cast in concrete at 5V and the design will center around an LM358, also cast in concrete.

Like I said, we will take this one step at a time. We will optimize the microphone bias resistor first. Everything else should be disconnected from the mic.
#1 - Using only the powered microphone and the bias resistor you selected (please confirm it is 1K 5%), what is the DC voltage on the output of the mic in a quiet room?
#2 - Set your signal generator for 1kHz (into a SINGLE speaker) at a distance/volume that DOES NOT cause any clipping of either the positive or the negative half of the waveform. (If you can produce a triangle wave, that will make clipping much easier to see). What is the p-p voltage at the output of the microphone?
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hi Parkera, had sometime this evening so i measured the power supply with oscillascope.
Results with 0.1mF ceramic cap across supply.
5.12V mean with Vpp drifting from 240mV - 160mV. No change with 28mA load, couldn't get exact 25mA.

With Vpp being off recommended 10mV I used L7805cv voltage regulator to try and improve supply but it only reduced Vpp to 80mV, it also reduced mean voltage to 4.24V.

Although supply isn't to recommendations from previous post I went ahead anyway and used the supply with ceramic cap. Placed a 1K resistor to bias the mic and measured the voltage across it at 4.81V in a quiet room.
Mic V drop = 5.12 - 4.81 = 0.31V.

No time to do any more Parkera, will get rest of results soon though.
 

Parkera

Joined May 3, 2016
106
Hi Copey84 - I assume the bypass cap was 0.1 microfarad, not millifarad. The usual text abbreviation is uF. I only guessed at 25 mA. The key is that the ripple does not get excessive with the full load applied.

The big complaint about switching regulators over analog regulators is that they are noisy. From your readings of a 5.12V mean (DC) and 80 mV P-P noise/ripple, that is just the characteristic of a switching supply (perfectly OK for battery charging). It is also OK to power an opamp and CMOS ic's. It is too much noise to be used as a threshold reference or to power the microphone though, but that can be dealt with easy enough. The fact that the 5.12 volts did not change from 0 to 28 ma means that it is a regulated supply. I'm sure we can work with it.

When you hooked the L7805 up and the voltage dropped to 4.24V with the same amount of noise/ripple, that just means that the 7805 was not in regulation. That IC typically needs about 2.5V across it to remain in regulation (an input voltage of at least 7.5V). If you did have 7.5 volts input, the noise would drop way down, probably to less than 1 mV.

The internal circuit of the microphone is a simple 1-transistor common source (common emitter but with a FET) amplifier, with the output is taken at the junction of the "bias resistor" and drain of the FET. The typical electret "bias current" is around 1 mA. For maximum dynamic range and lowest distortion, the voltage at this point should be slightly higher than 1/2 the supply voltage. Since you are measuring 0.31 volts, the FET is biased near saturation. The current is 4.81V/1K = 4.81 mA. As a starting point, you need to increase the value of the bias resistor so that the DC voltage is between 2.5 and 3 volts.

Fine tuning of the resistor value will be done with a sine (or triangle) waveform feeding a speaker. The goal is to achieve the maximum P-P signal without clipping or significant distortion of either the positive or negative portions of the waveform. I predict that as you increase the maximum signal (volume) you will start to see the top of the waveform begin to compress (distort) and the bottom of the waveform clip fairly hard. It becomes a judgement call where the best operating point is. The final value is not "critical", but you want as clean and undistorted waveform as you can. I will guess the resistor will be between 2.2K and 4.7K, but the waveform and DC voltage will be the determining factor.

Let me know what you arive at for resistor value, DC voltage and the maximum P-P signal. Post a waveform screen shot if you can. Also, what is the frequency or repetition rate of the power supply ripple?
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hi Parkera, the cap was definitely a 0.1micro farad used, have gradually increased value up to 2200 micro farad's to try and eliminate the ripple but no change.
I even replaced power supply with another 5V type that outputs at 9V when not under load to allow voltage regulator to operate correctly. Used same voltage regulator and connected load.
Results with load - Vpp@320mV - mean@4.56V - load now reads 25mA because of voltage change.
Even with changing cap values I can't reduce ripple, not sure what else to do, maybe different voltage regulator?
Also the frequency of ripples are under 10Hz.

Moved on to mic bias resistor and decided to place a 10k pot to adjust voltage level to 2.5V.
Was able to produce a 1kHz triangle wave form but not sure about amplitude.
How exactly should I set this up? Got a small 8ohm half watt speaker and when I apply the triangle wave @ 1v 1KHz I get a tone as expected. Not sure what else to do.
 

Parkera

Joined May 3, 2016
106
Hi Copey84 - I'm not surprised increasing capacitance didn't make a change in the Vpp at the current levels we are working with, but it is a perfectly normal thing to try. (I've tried it countless times during my 40 year career and I think it only fixed a ripple problem once because of a bad cap.) It actually helps confirm things are OK.
  • I noted the noise/ripple is very different in value between the 5V and the 9V supply. This suggests the source is the supply (in both cases).
  • Not being able to remove/reduce the ripple with the linear regulator suggests the noise is probably being radiated by the supply into the "environment". The 'receiving' antenna is most likely the loop antenna formed by the scope probe, circuitry and the scope ground lead.
    • The way to tell is to clip the scope probe to its own ground lead (not connected to anything else). If you still see the noise, it is being picked up by the probe. You can also confirm the source by moving the probe close to the supply.
  • The 10 Hz ripple frequency, if coming from the supply, suggests a switching supply running in "discontinuous mode". Typically these kinds of supplies are designed for 500mA to 1000mA. 25mA is nothing for them.
Assuming most of the points above are correct, I'm not worried about the noise right now, although it could rear its ugly head later. Let's move on with the 5V supply as planned with a 0.1uF bypass capacitor close to where the supply attaches to the breadboard.

Using a 10K pot is a good idea; it will make fine-tuning the value easy. The purpose of the triangle wave is to give a quick indication of linearity and to positively indicate saturation or clipping (dynamic range) of an amplifier. A sine wave is traditionally be used, but it is more difficult to see linearity and exactly when clipping occurs (most people won't notice less than 25% distortion with a sine wave, but will notice 1% or 2% with a triangle wave). What we are going to do is feed the speaker with the triangle waveform. The microphone will be placed close to the speaker (a few inches). The microphone will pick up the triangle wave sound. The O'scope will show how "faithfully" the microphone picks up the sound. Because the speaker also adds distortion, the sound levels will be kept as low as possible - you also won't want to listen to it at high volume for very long either.

I lifted this waveform from Sonic Website. When graphed, you will notice that the rise and fall of a triangle wave are a straight line and abruptly change direction at the positive peak and again at the negative peak. Any curvature of the rise and fall lines indicate nonlinearity distortion. At some volume level, the FET amplifier in the mic will saturate (the bottom of the waveform where it can't go any closer to ground) and/or run out of "head room" and clip the top of the waveform. The difference between the saturation and clipping points is the "dynamic range" of the microphone. The goal is to maximize the dynamic range.

The room needs to be quiet for this test. It would be a good idea to put a 1K resistor in series with the 10K pot as a 'safety' to prevent the FET from burning out if you accidentally adjust the pot to zero resistance.
  • Adjust the 10K pot until the mic has 1.5 volts DC at the output.
    • If you can't reach 1.5V, increase the value of the pot, perhaps to 20K or 50K, but I will refer to the pot as a 10K pot below.
  • Place the mic about 2 inches from the speaker.
  • Feed the speaker with the 1 kHz triangle waveform at a low volume.
  • Look at the output of the mic with the O'scope. Adjust the volume until the mic output is about 0.5Vpp. The waveform should closely approximate the ideal triangle waveform.
  • Slowly increase the volume and notice any changes in the shape of the triangle wave, particularly at the top and bottom.
    • At some point, the bottom peak of the waveform will begin to clip or distort (deviate from linear). Do not adjust the volume any further.
    • This is where the FET is saturated and can't lower the output voltage toward ground any more.
  • Adjust the 10K pot up and down and notice how you can clip either the top or the bottom of the waveform.
    • Adjust the 10K pot until the waveform is centered between the top and bottom clipping points.
  • Increase the volume by a small amount. Notice the Vpp will increase.
    • Adjust the 10K pot until the waveform is centered again between the clipping points.
  • Slowly increase the volume and adjust the 10K pot until both the top and bottom of the waveform clip at the same time.
    • It is likely that the top will clip sharply, but the bottom will "mush" into saturation. This is a subjective "clipping point".
    • This is your ideal bias point for the mic. It gives you the maximum dynamic range that the mic is capable of.
    • Measure and record the maximum mic output Vpp.
    • If you can, post a screen shot of the waveform where it is slightly overdriven and looks about like the waveform I posted above.
  • Turn the sound completely off.
    • Measure and record the DC voltage at the mic output.
    • Measure and record the series resistance of both the 1K 'safety resistor' and 10K pot.
Wow, this reminds me of my days as a student in tech school when I created new laboratory tests for the school.
 
Last edited:

Thread Starter

Copey84

Joined Jul 27, 2015
198
Got the power supply set up with the 0.1uF ceramic cap across supply, output voltage as mentioned is 5.12V.
Just to note the power supply is rated at 200mA, was used for a blue tooth headset.
Did try connecting scope probes together and there was a Vpp as suspected, it was around 80mV

With supply sorted for now I moved on and set up circuit with the pot and 1K resistor.
With the mic voltage adjusted to 1.5V I applied the 1KHz triangle signal to the speaker and held it 2inchs from mic. I then varied the volume from 1V to a maximum of 20V but I couldn't get the signal up on oscillascope.
The oscillascope probe was placed across mic but all I got on screen was a fuzzy line.
Maybe volume needs increasing further, not sure, my signal generator only goes up to 20V.

Anyway if your not totally sick of this post by now Parkera and want to advise further i'd appreciate it.
Thanks.
 

Parkera

Joined May 3, 2016
106
Hi Copey84 - No, I'm not sick of this post, in fact I kind of enjoy it. You seem like a good technician. I do have to limit how much time I spend making posts because I have an antique car I need to paint parts of, assemble and test for a show August 5.

As I understand, you can adjust the DC output of the mic with the 10K? pot. That means the FET in the mic is not dead. I assume that you can also hear the waveform easily. Once you have the DC on the mic adjusted, you may have to put the scope into AC coupling. That way you can increase the scope gain. The mic output may only be a few millivolts of P-P audio signal.

The next goal is to obtain a measurable output from the microphone. We need to prove the mic is good. Try AC coupling the scope and also adjust the 10K pot if needed to get some sort of output from the mic. Once we have that, we can move forward again.
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hello Parkera, apologies for delay in reply busy weekend.
Good to hear your not feed up with this yet, hopefully get it figured out soon.

I can adjust the DC output to mic via the now 50k pot and I can hear the 1KHz signal.
Was able to get the triangle wave form on scope by shifting the setting of the scope probe from X10 to X1.
With the speaker 2inches away from mic the signal is a fuzzy line measuring 600mV.
Have tried adjusting scope probe at mic to improve signal but no real change.
Not sure what to do next, will have another look at it tomorrow.
If you can think of anything let me know, only if you got the time though.
 

Parkera

Joined May 3, 2016
106
Hi Copey84 - I too was busy on the weekend, kind of normal this time of year. I'm not sure what you are looking at on the scope. Are you seeing the waveform at the speaker or at the mic? What is the sweep rate of the scope? I assume the scope is set for auto triggering. What is the mic DC voltage right now? Are you able to post screen shot of the scope is needed? (future reference)

To look at a 1 kHz waveform, a suitable horizontal sweep rate would be 0.5ms / division. Start by looking at the waveform across the speaker, just to get the scope set up correctly. You should have a stable waveform showing about 5 cycles. From there, look at the mic, but only adjust the vertical sensitivity and/or AC/DC coupling. You should also see 5 cycles.
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
1498155033803544303522.jpg 14981550724261123715710.jpg 14981556171732130164144.jpg 1498156621796-1854228550.jpg 1498156731072-939934611.jpg
Hi Parkera, I'm having trouble getting the waveform at the mic to show clipping when volume is turned up.
Increasing the volume increases the amplitude of mic signal, can't see any clipping.
I've included some photos. Scope is set to AC couple with sweep rate starting at 500micro sec.
 

Attachments

Parkera

Joined May 3, 2016
106
Hi Copey84 - Looking at the first photo - The triangle wave looks good; 150mV P-P. Is that the output from the microphone? The 1.53V on the meter, is that the DC voltage on the microphone? I don't know what I am looking at in photos 3, 4 or 5 so I can't make comments.

In future, please identify what the probes are connected to and the basic equipment settings (i.e. Ch1, top trace, AC coupled, 50mV/div, 500uS/div. Meter: DC at microphone output).

If the output of the microphone is in the 50-100 mV range, it will be very hard to clip the waveform from volume if the bias is anywhere near correct. If the output of the microphone is 2-3 volts, then clipping will be easy and the bias setting becomes more critical. This is kind of where I'm heading, but I want to take it one step at a time. We are also qualifying the setup too.
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
First photo shows the triangle wave from signal generator on Channel 1, Channel 2 shows output at mic as signal is feed from speaker. DMM shows the voltage level at the mic.
Since the signal from mic in first photo is only fuzzy line I have tried adjusting to get a triangle wave.

Rest of photos are just my attempts to improve triangle wave from mic. Went to 10mV 25uS and was able to get a resemblance of triangle wave, however when I increased the volume at Sig generator all it did was increase the amplitude, there was no clipping of wave form.

Last two photos signals look more distorted due to camera, I only included Sig generator photo so you could see the set up.

Have tried adjusting the pot increasing the voltage level up to 2.5v 3v then max at 4.8v but all it seems to do is again increase the amplitude of signal, no clipping of wave.
Not sure what else to do.
 

Parkera

Joined May 3, 2016
106
Hi Copey 84 - I have been doing some reading on electret mics (I wasn't that familiar with them). While mics are available in different sensitivities, you can expect the output will be in the low millivolts with normal speech levels. In other words, don't expect any clipping from the triangle waveform at the output of the microphone. With that in mind, we want to adjust the bias resistor for about 0.5 mA of current. That should put the resistor about 4.7K. The DC output should be about 2.65 volts, referenced to ground with a 5V supply.

The mic output photos show a lot of noise riding on the 1 kHz triangle waveform. Whiteboard construction was originally developed for TTL-type digital circuit experimentation, not for low noise analog circuit experimentation. But they are so damn convenient that everyone uses them anyway. In order to minimize noise pickup you have to abandon the long pre-made wires. Use #22 solid wire bent into sharp cornered "U"s kept close to the board. This is a photo of the technique. (It is actually the remains of an old power supply inverter circuit I worked on a few years ago, but I used the components in the final version.)
upload_2017-6-23_9-20-48.png

For the most part I use bare buss wire, but where there is the possibility of a short, I will use insulated solid wire or I will put a piece of teflon tubing over the bare buss wire. Keep the leads of components short also and the bodies of the components close to the board. Keep the overall stage layout as compact as possible. This kind of construction can be used reasonably well up to about 1 mHz, but there is a lot of capacitance.

All test equipment grounds should be connected to the ground buss at a single point where the power supply connects. Use a short piece of buss wire to clip the grounds to if needed. Keep the ground leads absolutely as short as possible, especially for the scope.

With the speaker about 2" from the mic, subjectively adjust the volume to approximate that of a normal speech volume. Since we are not used to listening to pure waveforms, one way to approximate that level is to hook up a radio to the speaker and look at the average P-P level (typically about 2/3 the absolute P-P level). Your scope can probably measure the average too. Connect the generator and adjust its output to give the same P-P level. It is not a critical measurement so don't go crazy. You just want something that is reasonable and repeatable.

With this new setup, post a photo of the "speaker" waveform and the mic waveform as you did in your 3rd photo. (500us / div). You probably will need to set the mic channel to 5 mV/div. Use a 1X scope probe. If there is still a lot of "high frequency" noise, try connecting a 0.0022uF capacitor from the mic output to ground. That should give a 15 kHz rolloff and make things easier to see.
 

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hi Parkera, made changes to breadboard. Did find that the 4.7k resistor left voltage higher at the mic, around 3.8V. I changed back to 1K with 10K pot and adjusted to get 2.65V at mic. Have noticed the mic is very sensitive now picking up noise 5m away, can't have it false triggering all the time. I'm thinking this can be adjusted though.

As i've no way of connecting the speaker to a radio can you give me a rough idea what I should set the Sig generator to instead.

Thanks
 

Parkera

Joined May 3, 2016
106
Hi Copey84 -
As i've no way of connecting the speaker to a radio can you give me a rough idea what I should set the Sig generator to instead.
As a number, 60 dB SPL. Of course if you don't have a sound level meter that won't do you much good. Since listening to sounds are completely subjective, try your best to make the level about that of normal conversation. Like I said in my last post - something reasonable and repeatable.

It is good that you noted an increase in mic sensitivity. That means we are getting close. What you want is to achieve the maximum signal output from the microphone; that will make processing the signal easier. Again, nothing magic or sacred - electrets have a wide operating range that is acceptable.

The target we are looking for is the best compromise of the bias resistor. On the one hand, as the current through the FET increases (by decreasing the bias resistor), its transconductance (gain) increases. On the other hand, as the bias resistor increases, stage gain increases. The overall gain is the product of transconductance and load resistor. As one goes up, the other goes down. You are looking for the "crossover" point (if you actually graphed each gain - which we are not going to do) where you obtain the maximum "microphone gain", a.k.a sensitivity.

For further experimenting, let's standardize on a 1 kHz SINE Wave, although we will probably use the triangle wave again.

What I would like you to do next is determine (experimentally) what value of bias resistor gives the most sensitivity from the mic. That is why it is important to have a consistent sound level at the microphone. You are going to adjust the bias resistor to give the most AC-coupled signal at the output of the mic. Measure the distance from the speaker to the microphone and the AC voltage across the speaker; these are needed for consistency. I don't need to know them, but you do. Please report the total bias resistor value, the P-P mic output, the DC output of the mic. Post a screenshot of the waveform also, hopefully it should be a slightly noisy 1 kHz sine wave.
 
Last edited:

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hi Parkera, i set up circuit as described and varied the resistance at pot to see changes in 1KHz sine wave signal. I found that with the speaker 2inches away from mic the sine wave was replicated fairly well, much better than triangle wave. I turned the volume up to 7V, after that the signal began to distort. From this level I adjusted the pot and was able to get max Vpp @51mV, pot was close to max and with the 1K in series resistance is close to 11K. Included photos.

At this setting the mic is at its most sensitive which could be a problem with false triggering.
Plan to wire mic remote from circuit and close to where I will be sitting in room. So if I keep pot in circuit I can easily adjust to suit final location. Will even set up temporarily again to see how it works. Important thing is to avoid false triggering.
1498507738210-1973421785.jpg 14985079118091198658985.jpg
 

Parkera

Joined May 3, 2016
106
Hi Copey84 - Don't worry about false triggering right now. There is NO NEED to experiment with remotely locating the microphone away from the rest of the circuit in an attempt to lower the sensitivity of the mic. (Trying that will likely induce a lot of 50 cycle(?) hum into the waveform.) The trigger threshold is set in later stages of the circuit. The important thing now is to get the most signal out of the microphone with a given acoustic input. By doing that, the circuit will have the greatest signal to noise ratio and will ultimately make triggering much easier and more reliable.

With 7 volts across the speaker, the distortion is likely the speaker distorting. Your breadboard layout looks good. The waveform looks pretty good too. From your test it seems the microphone likes a 10K bias resistor with a 5V supply.

  • With a 10K total resistance, what is the DC output of the microphone in a quiet room?
  • It looks like the noise level is increasing from ~5 mV P-P at the left to ~12 mV P-P at the right of the screen. Was there other acoustic noise or sounds in the room at the time?

We have a couple more "baby steps" to go before moving on to the next part of the circuit, so be patient.
 
Last edited:

Thread Starter

Copey84

Joined Jul 27, 2015
198
Hi Parkera i now have only 10K resistor in place and in a quiet room there is still some noise on scope.
When the 7V sine is on the signal is again replacated on scope. Included pics so you can see all measurements.
Thought I'd note the camera makes signals look worse than they are, bit of ghosting.
1498675329696-958314090.jpg 1498675388949-1325562312.jpg
 
Top