Experiment 13: No Loud Speaking - Make: More Electronics (2014)

Make: More Electronics (2014)

Chapter 13. Experiment 13: No Loud Speaking!

The culmination in this series of audio projects is a device that goes back to the concept of using sound to switch something on and off. I showed how this could be done in Experiment 10, but I’m going to take it much further, now. This project was inspired by a story about one of the pioneers of analog integrated circuits.

Background: The Widlar Story

A legendary engineer named Bob Widlar did a lot of the early development work on op-amps during the first semiconductor boom period of the 1960s. He was an important figure at early Silicon Valley startups such as Fairchild and National Semiconductor, where he was memorable not just for his breakthrough designs but for his bad behavior. He had a lifelong love affair with alcohol, and was described by coworkers as paranoid, reclusive, and impossible to deal with—although they dealt with him anyway, because he was such a brilliant engineer. In those days, an unstable, abrasive personality would be tolerated in Silicon Valley, because electronics was still a field for mavericks, and human resources departments had little control over the hiring process.

Widlar’s intolerance for defective parts and malfunctioning prototypes was so intense, he was in the habit of destroying them with a sledge hammer. This came to be known as “widlarizing” them. He was also very intolerant of noise, and installed a device that emitted a piercing whistle if a visitor in his office raised his voice and shouted at him. A Fairchild engineer told me that the gadget was known in the company as “The Hassler.”

I’m going to call it the Noise Protest Device, and I’ll show you how to build your own version of it. Since Widlar achieved his reputation by designing op-amps, it seems appropriate that this project is built around an op-amp.

Step by Step

I’ll go through the process of designing and building this circuit in steps, to give you an idea of the procedure that you might follow if you were designing it yourself.

Maybe the idea of circuit design seems intimidating. Like—where do you start? But so long as a circuit can be broken down into sections, and you can make them communicate reliably with each other, and you can test them one at a time, the design process doesn’t have to be too difficult.

Of course, the initial attempt at designing a prototype may not be totally successful. But that’s what you should expect from a prototype.

The first step is to think about what the circuit has to do, and make a list of components that may be able to do it. For the Noise Protest Device, my list looks like this:

1. A device to detect noise and turn it into an electrical signal. That would be an electret microphone.

2. A preamplifier for the signal. That’s an LM741 op-amp.

3. A current amplifier. We can use the same 2N2222 transistor as before.

4. When voltage or current exceeds an adjustable limit, it has to trigger something. Not sure what this will be, yet.

5. The triggered device has to make a noise in protest. I’ll call this the Protest Output. I could use just a 555 timer running in astable mode at an audible frequency.

Sensing

The key to making this work is the fourth step, above. How can this be done?

Well, let’s think how a 555 timer works when it is running in astable mode. It starts itself as soon as it receives power, and it stops when the power is interrupted. But this isn’t the whole story. It also has a reset pin. When the reset pin receives a positive input, the timer is enabled. When the reset pin is pulled low, the timer is interrupted.

Maybe I can convert the output from the op-amp to drive the reset pin. This sounds plausible:

§ When the electret microphone doesn’t pick up any noise, the output from the op-amp will be low, and a low input to the reset pin will prevent the timer from creating its Protest Output.

§ When the electret microphone hears someone shouting, the output from the op-amp will go high, and a high input to the reset pin will enable the timer and its Protest Output.

The only problem is, the output from the op-amp is AC. How about if I put it through a coupling capacitor, biased to negative ground, so the output just varies relative to ground, as in Experiment 10? Then I can add a smoothing capacitor to remove the ripples from the signal—somewhat, at least.

If you read Make: Electronics, a smoothing capacitor is typically placed between the signal and ground, to smooth out the peaks and dips. The result might be clean enough to work the timer’s reset pin.

Time to check the 555 datasheet. It says that the reset pin stops the timer when the potential is 1VDC or lower. Otherwise, it allows the timer to run.

So, if I can process the output from the op-amp to be greater than 1VDC when someone is shouting, but less than 1VDC when no one is shouting, the timer should react appropriately.

Will It Really Work?

At this point, I could create a simulation in software such as SPICE, showing the interaction of components. But since I’m using quirky analog signals, really I’ll have to put the components together to find out whether they will do what I want them to do.

The first part of the Noise Protest Device circuit is shown in Figure 13-1. It’s very similar to the upper half of the circuit from Experiment 12, shown in Figure 12-2. The primary difference is that the feedback resistor has been changed to a 1M potentiometer so that I can vary the sensitivity. A 10K resistor has been added below the output coupling capacitor, between the output and ground, to bias the capacitor.

The first step in constructing a noise-against-noise circuit.

Figure 13-1. The first step in constructing a noise-against-noise circuit.

The next step is to check what actually happens in the circuit. Here again an oscilloscope would be useful, but since you probably don’t have one, I’m not going to use one either.

Assemble this circuit and make sure that the 1M potentiometer is providing maximum resistance between the op-amp output and the noninverting input, to minimize the negative feedback and maximize the gain.

Now do the “Aaah” test, or whistle, while you check the voltages at points A, B, C, and D in the circuit, with your red probe touching the places indicated by the arrows and your black probe touching negative ground. You should get voltages like those listed inFigure 13-2. (You may wonder why the table lists a point E, even though there is no point E in Figure 13-1. There will be a point E when the circuit is extended downward.)

Voltage readings at points in the circuit, showing how a very small alternating signal is amplified and converted to a usable DC output.

Figure 13-2. Voltage readings at points in the circuit, showing how a very small alternating signal is amplified and converted to a usable DC output.

If your readings aren’t exactly the same as mine, this may be for several reasons. You may not be making the “Aaah” sound as loudly as I did (or, you may be making it louder). Your microphone may be more or less sensitive than mine, or your meter may take longer to stabilize, or it may measure AC differently. Either way, small deviations are not important.

Initially, the microphone generates around 30mVAC at point A, when you speak loudly into it. This value remains the same at the other side of the capacitor, at point B, because it’s an AC value. But the DC voltage has been reset to 4.5V by the voltage-divider resistors. Continuing on down, the output directly from the LM741 at point C is amplified to approximately 2.5V AC when the microphone is picking up noise. There’s still a DC component of 4.5V at point C, but the output coupling capacitor blocks the DC, so at point D, we now just have an AC reading, which changes from 0V to 2.5V when you make noise. So far, so good. A swing from 0VAC to 2.5VAC looks promising.

Now check the next version of the schematic, shown in Figure 13-3. I have added a transistor, which provides more power, and a 100µF smoothing capacitor. Why 100µF? Experience suggests that this will be about right, for audio frequencies. But I’ll have to try it to make sure and change it if necessary.

The second step in building the Noise Protest Device.

Figure 13-3. The second step in building the Noise Protest Device.

In the circuit in Figure 13-3, the transistor allows current to reach point E with very little resistance when it is “on.” But when the transistor is nonconductive, its effective resistance becomes high relative to the 10K resistor, so the voltage at point E goes low.

This is an emitter follower configuration, because the voltage at the emitter follows the voltage at the base (with a small deduction imposed by the transistor). Of course, the transistor also amplifies current.

If you swap the transistor and the 10K resistor, the effect is reversed. This is suggested in Figure 13-4, which shows that a transistor can either pass along a voltage transition or invert it, depending on the configuration.

By tapping the emitter or the collector side of a transistor, in conjunction with a resistor, you can obtain an output voltage that goes from lower to higher or higher to lower when the current at the base goes from lower to higher.

Figure 13-4. By tapping the emitter or the collector side of a transistor, in conjunction with a resistor, you can obtain an output voltage that goes from lower to higher or higher to lower when the current at the base goes from lower to higher.

I’m going to digress into this topic, because the technique has so many applications.

Background: Voltage Translation

If you want to see this for yourself, you can do it very easily using just one transistor and two resistors.

In Figure 13-5 you’ll see some actual meter readings that I obtained when taking output from the collector side of a 2N2222 transistor. In each schematic, the base resistor is 1K, and it is connected first with negative ground, and then with the positive side of the power supply. Energizing the base changes the transistor from its “off” (nonconducting) mode to its “on” (conducting) mode. The transistor is shown gray when it is nonconductive.

Actual values measured with a transistor configured to deliver output from the collector side. All figures rounded to one decimal place.

Figure 13-5. Actual values measured with a transistor configured to deliver output from the collector side. All figures rounded to one decimal place.

The numbers are all rounded to one decimal place, so the actual highest output with 9VDC power will be a fraction less than 9VDC:

§ When you tap into the collector of a transistor in this way, you invert the input.

But bear in mind:

§ The actual performance will depend on the device attached to the output from the circuit. The numbers were measured with a meter, which has a very high impedance. If you use a different device, the numbers will change. On the other hand, many devices, including op-amps, comparators, and a lot of digital chips, also have a very high input impedence.

§ The numbers are obtained with the transistor in saturated mode. If the current through the gate is lower, the outputs will be different.

§ Care must be taken to treat the transistor kindly without exceeding its maximum values. When the transistor is conducting, you should not sink excessive current through it. Check the datasheet to make sure!

Now turn to Figure 13-6. Here I have swapped the position of the 10K resistor relative to the transistor, and I tapped into the emitter side of the transistor. In this emitter-follower configuration, the transistor does not invert the voltage anymore. The voltage follows the polarity of the input, but the spread of the output voltages isn’t quite as wide. Once again, they are rounded to one decimal place.

Actual values measured with a transistor configured to deliver output from the emitter side.

Figure 13-6. Actual values measured with a transistor configured to deliver output from the emitter side.

You can still adjust the voltages in each case by adding a resistor on the other side of the transistor. The resistors will form (you guessed it) another voltage divider.

Naturally, in every case, the transistor still functions as a current amplifier.

Noise Protest, Continued

The complete circuit for the Noise Protest Device is now shown in Figure 13-7, with a photograph of the breadboarded version in Figure 13-8.

The complete preliminary circuit for a Noise Protest Device.

Figure 13-7. The complete preliminary circuit for a Noise Protest Device.

This breadboarded version of the Noise Protest Device circuit is designed to run from a 9V battery. The yellow wires at the bottom of the photograph are connected with a loudspeaker (not shown).

Figure 13-8. This breadboarded version of the Noise Protest Device circuit is designed to run from a 9V battery. The yellow wires at the bottom of the photograph are connected with a loudspeaker (not shown).

In case the basic concepts are still not entirely clear, a flow chart illustrating the logic of the thing is shown in Figure 13-9.

This diagram illustrates how each section of the Noise Protest circuit communicates with the next section.

Figure 13-9. This diagram illustrates how each section of the Noise Protest circuit communicates with the next section.

You should go ahead and finish your own version of the circuit to find out if it works. Once again, remember to avoid using the kinds of jumper wires that have a plug at each end. They will create a tangle of loops of wire that will interact with each other electromagnetically, causing noise and erratic behavior in general. Op-amp circuits should always be built with wires that are as short as possible, and you should keep the components as close together as possible.

First check the voltages into and out of the op-amp. Compare them with the table in Figure 13-2. If they are comparable, the next step is to make sure that you have the 555 wired correctly. Unplug the connection to pin 4, and you should hear an annoying, high-pitched whistling tone from the loudspeaker. This is the 555’s Protest Output. If you don’t hear anything, you need to track down your wiring error(s) before continuing.

Now when you reconnect pin 4, the whistling tone should stop, although there may be a short delay while the 100µF capacitor is discharging. Adjust the 1M trimmer for maximum feedback resistance, and speak loudly into the microphone. There may be another short delay while the 100µF capacitor is charging, but then the timer should start whistling until you stop speaking loudly.

This is how the circuit is supposed to work. Indeed, my version works—but only just, and only with a good benchtop power supply. When I substitute a 9V battery, the behavior of the circuit becomes erratic.

This is very disappointing, but as I said at the beginning, the first version of a prototype doesn’t necessarily work properly.

So, I have to figure out what is causing the trouble. By testing with my meter, the answer seems very obvious: the voltage range at point E was fine so long as point E wasn’t connected with anything other than a meter, but as soon as I fed its output to the reset pin of the 555 timer, everything changed.

The 555 datasheet didn’t tell me everything. I assumed the reset pin would have a high impedance, like the input of a logic chip, but—apparently not. Also, I think the 100µF smoothing capacitor is inadequate. It allows ripples or spikes in the current, which are sufficient to raise the voltage on the reset pin of the timer. This allows the timer to continue emitting a noise even when there is very little sound being detected by the microphone.

Either way, the output from the transistor turns out to be incompatible with the timer. What to do? In this kind of situation, there are two options:

§ Fiddle around, trying to make it work.

§ Try something completely different.

The first option always seems as if it should be quicker than rebuilding everything from scratch. Of course, often it isn’t quicker, but I tried it anyway. I adjusted the voltage on the reset pin by adding yet another voltage divider. Its resistors are labelled “F” and “G” in the schematic. To determine the values of these resistors, I didn’t use any calculations. I tried various values experimentally.

This helped, but I still don’t regard the performance of the circuit as bulletproof. I found myself hearing clicking noises from the loudspeaker, or a rapid series of beeps. I also heard a scratchy version of the whistling tone, which suggested to me that it was being modulated by ripples in the signal from the transistor. I tried substituting a 330µF capacitor for the 100µF capacitor, but that just created oscillations. I also tried a 47µF capacitor. You can experiment with these values yourself to see if they make the circuit perform better, or not.

Power Problems

It’s really annoying when a circuit doesn’t work, but as always, you have to be methodical in your search for the answer.

I assume that you are powering your circuit with a 9V battery. Disconnect pin 4 of the 555 timer again so that the speaker starts making its annoying sound. Attach the black probe of your meter to the negative ground bus of your breadboard, and the red probe to point “B” where the two 68K resistors meet. Remember, this is where the circuit creates the reference voltage, which the op-amp compares with the microphone input. Set your meter to measure DC volts.

Check the voltage, and now disconnect the wire that provides positive power to the 555 timer. When the timer is deprived of power and its noise stops, I’m betting you will find that the reference voltage changes. The reason is that even though the 555 timer doesn’t take much power while it is beeping (maybe 20mA), this is enough to pull down the voltage from the 9V battery, and that may change the reference voltage just enough to upset the output from the op-amp, which will reduce the voltage at point E, shutting down the timer. But when the timer stops whistling, it is using less current, so the power from the battery goes back up, and the timer starts whistling again—which is why you may get oscillations.

Even if you don’t observe this problem, you are likely to encounter it (or scratchy noises in the circuit, or a beeping that won’t stop at all) when your battery’s voltage gradually drops during its normal lifetime.

Here are some possible fixes. I’ll tell you right now, none of them appeals to me very much—but these are the easy options:

1. Always use a proper power supply instead of a little battery. My version of the circuit works quite reliably from a regulated benchtop power supply, and works with only a bit of hesitation from a RadioShack multivoltage AC adapter.

2. Use two 9V batteries, one for the top half of the circuit and the other for the bottom half. The positive side of one battery powers the op-amp, while the positive side of the other battery powers the timer. However, both batteries must share the same negative ground.

3. Use a higher-voltage power supply (12VDC or more), which then passes through a 9V voltage regulator. This should compensate for fluctuations in power consumption.

4. Increase the series resistance with the loudspeaker. But, wait a minute—this will reduce the volume from the speaker, and the whole idea was to make a loud noise when someone speaks loudly!

You know, we shouldn’t have to fuss around with a circuit like this to make it work properly. As I said before, it should be bulletproof. I decided that I had made a mistake, fiddling with the circuit to make it work. I should have tried something completely different.

Fail?

Does this mean that my circuit is a failure? No, I don’t like that word, because it implies that something is worthless. In reality, almost every successful person has tried strategies that didn’t work. People usually become successful because instead of giving up, they learn from their experience.

If something works outstandingly the first time, we learn very little from it. If we have problems, that’s when the learning process really begins. So what have you learned, here?

§ You have seen the instability that can occur in a circuit which contains amplification. Undesirable feedback and oscillations are common.

§ You have seen that the power supply is not just a passive source of current. It is an active part of the circuit, and a battery has limitations which are not shared by an AC adapter.

§ You have seen that you must verify the performance of a circuit using different options (such as different types of power supply), instead of just saying, “It works with my equipment, so if it doesn’t work for you, that’s your problem.”

§ You have seen that if one section of a circuit is only barely compatible with another section, this probably isn’t good enough.

Just One More Little Thing

While I was tinkering with the circuit, something happened that I haven’t even mentioned yet. I happened to leave the loudspeaker close to the microphone. Can you guess what happened next? Audio feedback, of course! When the loudspeaker made its Protest Output sound, the microphone picked this up. The microphone isn’t smart enough to tell the difference between the Protest Output and someone shouting, so the circuit continued to be active. The noise went around and around and would never stop.

This is a conceptual problem, not a hardware problem. The concept of a device that responds to a shouting person by making a noise that is even louder was flawed from the start. The circuit ended up shouting at itself!

Did you foresee this, when I wrote out the specification? I didn’t see it, because I had tunnel vision, which is a very common problem when a new device is being designed. I was focusing on the goal (in this case, making a noise in response to someone shouting) and forgot the larger picture.

Often you don’t discover an obvious problem until a prototype is up and running. Then you feel embarrassed, because everyone will say, “That should have been obvious!”

This is another valuable learning process. No matter how experienced you are, you may fail to foresee an “obvious” problem. To take a random, classic example: the story goes that Steve Jobs was carrying one of the first iPhone prototypes around in his pocket for a couple of weeks, using it experimentally, less than two months before the product went into production. He found that the plastic screen on the phone became scuffed and scratched during that short period of time. Well, he should have expected that. It should have been obvious, right?

Perhaps the iPhone designers had assumed that plastic was the only way to go, because glass would break too easily. But when Jobs saw his scuffed screen, he wanted it to be changed to glass, even though the phone was almost in production, and the kind of thin, extremely strong glass that he needed was not even available in sufficient quantities. He had encountered an “obvious” problem that no one had really thought about, and instead of shrugging and accepting it, he initiated a huge redesign effort to fix it.

With this in mind, I am not going to just shrug and say, “Well, we can turn down the Protest Output so that the device won’t retrigger itself, and that will just have to do.” And I’m certainly not going to say, “The Noise Protest Device didn’t work properly, so let’s forget about it and move on.” I’m going to do what you would do if you were developing a product that turned out to have a defect. I’m going to fix it.