If I didn’t make it clear with my scoreboard display adventure, I love a good surplus shop. I love turning weird electronic nonsense into something useful (or entertaining, at least), and surplus stores are a great way to pay very little money for lots of stupid things. For example, this stupid thing:

A small, brown circuit board in the bottom left corner of the image, held in one hand against a background showing a hand-drawn electrical schematic with the title “Clap Switch,” and bold text stating a price of 50 cents.

Sitting below the sign in the photo was a banker box filled to the brim with these hideous little circuit boards. Many of them were visibly damaged, with capacitors snapped off, or potentiometers cracked in two. But hey, fifty cents!

What’s a Clapper?

A little history for those who either aren’t from the US, or who are too young to have heard of these: The Clapper is a goofy gadget that rose to notoriety in the US in the 1980s. Its aggressive TV marketing campaign put a catchy jingle in millions of American living rooms. The unlucky souls who actually bought the things discovered they were more of a silly novelty than a useful appliance.

The goal of the Clapper was to allow you to control household electrical things by clapping. Clap twice to turn on your bedside lamp, clap twice again to shut it off. Although it was marketed as a device to control everything from lights to TVs, the Clapper was probably more effective as a device to scare pets and amuse guests.

Early versions of the Clapper were deeply flawed. Accoring to contemporary accounts, they were much too sensitive. Even when you managed to dial in the sensitivity, they were extremely unreliable.

You know how Siri/Google/whatever randomly starts talking sometimes, totally unprompted? Imagine that, except now your dog can set it off. Or loud footsteps. Or someone putting away the dishes.

Another problem with early Clappers was that they used triacs instead of relays to switch the attached devices on and off. This might have been necessary since the click noise of a relay could very easily have been registered as a clap. Combine a relay click with a CRT TV tick, and you could easily end up in a situation where the Clapper turns itself on and off infinitely. However, triacs introduced substantial noise/transient issues that a relay wouldn’t have brought to the table. Some sources mention that the Clapper occasionally killed TVs. Although I did not find a firsthand account, I believe it.

You might be thinking “who in their right mind would plug their TV into something like this???” Remember that TVs worked differently in the 1980s, and not everybody had a remote. More importantly, ads for the Clapper routinely encouraged the use of the Clapper as a means of turning a TV on and off. Nowadays, it seems like people know they shouldn’t plug electronic devices into power-switchy things, and I wonder if the Clapper had to do with that.

If you want to know more about the Clapper, this Technology Connections video is a wonderful explainer.

What’s the deal with this clapper?

It’s a weird little board, that’s for sure:

Picture of the top of the circuit board, showing a large sensor surrounded by small discrete components. The board is tan fiberglass with rough edges.

Picture of the bottom of the circuit board, showing bare copper traces on a plain fiberglass substrate.

The surplus shop provided a schematic, which was very helpful in figuring this thing out. They also showed an example load with a normally-closed switch, implying that this circuit can clap “on,” but not “off.” More on that in a bit. Here’s the schematic, redrawn in Kicad:

Schematic diagram of the circuit.

In the above diagram, pin 1 is the power rail, and pin 3 is the ground rail. Pin 2 is the circuit’s output signal, but as I found out, it needs a bit of help to do its job.

Understanding the Schematic

We’ll start from the left side of the schematic, and work our way to the right.

The first two parts we encounter are C1 and C2. Ignoring the rest of the circuit, this is just a just a capacitive voltage divider. C1 is much smaller than C2, so virtually the entire voltage drop would exist across C1. Therefore, at steady state, pin 2 would be very close to 0 volts, and very little charge would exist across C2.

Moving slightly further to the right, we find a thyristor. Under the hood, thyristors are really just two transistors wired together in a funny way, but the end result acts like a diode in series with a switch. Initially, that switch is open, and no current flows through the diode. When current gets sucked through the thyristor’s gate, that switch closes and the diode passes current.

Here’s the thing, though - we already know that the voltage across C2 is basically zero, not even close to a diode’s threshold voltage. So, even if the thyristor is switched “on,” no current will pass through it. Unless we somehow manage to charge C2, this circuit won’t do anything!

With that in mind, let’s tweak the schematic a bit:

Schematic diagram of the same circuit as before, with a 10k ohm resistive load added.

Okay, now we have a resistive load that will charge that capacitor. Great! Why am I using a 10kohm load? No real reason, I just have a lot of 10k resistors laying around. As an added bonus, a 10k resistor with a 100uF capacitor gives us a very tidy RC time constant, τ = 1 second.

Moving further right on the schematic, we find R1, R3, C3, and T1. It looks like C3 is probably just filtering out noise from the thyristor’s gate, so we can ignore it. R1 is just limiting current to the right side of the circuit, so it’s not doing anything exciting either.

That transistor has a Motorola logo, and is marked “U9630.” Motorola was even nice enough to write its pinout on the case:

Close-up of the 9630 transistor, showing its markings.

Not much information exists about this exact transistor, but it seems to be quite the antique. As far as I can tell, it’s an everyday NPN bipolar transistor that was obsoleted by the BC546, which itself has mostly been supplanted by the 2N3904, which has in turn fallen out of favor because MOSFETs fill many of the same roles more efficiently. Suffice to say, this board is probably very, very old.

Transistor Shenanigans

This circuit takes advantage of two core principles of transistors. We’ll start with the simpler one: The higher the gate voltage is, the more current will be able to flow from the collector to the emitter. Since the collector is connected to the thyristor’s gate, that means that a certain voltage on the transistor’s base will cause the thyristor to switch into its “on” state.

Now for the fun part: That variable resistor, R3, sets the circuit’s sensitivity. Raising the resistance of R3 reduces the sensitivity, and lowering R3 increases sensitivity. This works because the forward transconductance of an NPN transistor varies with the collector current, which then affects the transistor’s effective DC current gain.

That’s probably gibberish even to a lot of people who’ve made it this far, so here’s the gist. You already know that higher base voltages allow more current flow into the transistor’s collector. But, how much more?

The “how much” part is the transistor’s gain - that is, the ratio of the collector current versus the base voltage. Gain’s first derivative is transconductance, and transconductance varies with the collector current. It’s incredibly weird. The current through the collector is a function of the gate voltage and… the current through the collector. Isn’t calculus fun?

This principle is why you’ll see graphs in transistor datasheets that look like this:

Graph from a transistor datasheet, relating DC current gain to collector current.

As more current is allowed through the collector, the gain rises. As you approach the transistor’s max current rating, the gain starts going back down again.

That’s how this “sensitivity” resistor does its job - when you adjust the resistance of R3, you change the amount of current that can pass into the collector, thereby altering the transistor’s gain, and thus its sensitivity to claps.

The Clap Sensor

I’m not totally sure what’s inside of the actual “clap sensor.” In retrospect, I should have bought a broken board so I could justify destroying the sensor to see what’s inside. I’m assuming it’s a piezoelectric disc, so that’s how I’ve represented it in the schematic.

At R3’s lowest resistance, the thyristor always switches on immediately, which indicates to me that R2 is responsible for biasing the base voltage slightly, in addition to limiting current into the sensor.

The voltage across X1 (the sensor) fluctuates when you clap. This fluctuation affects the voltage at the transistor’s base, activating the transistor/thyristor contraption we’ve just dissected.

Putting it to the Test

We’ve covered a lot of ground, so in summary:

Pinout:

  • Pin 1 is connected to power.
  • Pin 3 is ground.
  • Pin 2 is the output signal, and it must be pulled up to the supply voltage in order for the circuit to work.

Behavior:

  1. When the circuit is first powered on, pin 2 is driven low while C2 charges.
  2. The voltage on pin 2 slowly rises as C2 charges up.
  3. When a clap is detected, the transistor T1 amplifies the signal from the sensor, latching the thyristor D1.
  4. When the thyristor is activated, it acts like a diode. C2 discharges through this diode, causing the voltage at pin 2 to drop rapidly.

I found that the circuit seems to be quite happy running at 4.5 volts, although the surplus shop’s sign said it can operate at up to 9 volts. Here’s an oscilloscope reading of pin 2 with the 10k resistor I selected for RL:

Oscilloscope screenshot. The voltage slowly ramps up, sharply dips downward, then ramps up again.

As we discerned from the beginning, C2 slowly charges through the resistor. Then, you can see a large dip when I clap. When the large capacitor is mostly discharged, the current through the thyristor drops below its threshold, the circuit resets, and the capacitor starts charging again. Nice!

As it turns out, though, we got really lucky with that 10k load resistor. If I use a 1k resistor instead, something different happens:

Oscilloscope screenshot. The voltage slowly ramps up, sharply dips downward, and stays at a lower voltage.

The resistor charges up much more quickly this time. Then, when I clap, the voltage shoots down to 0.7V, and stays there. I’m pretty sure the smaller resistor is passing enough current into the thyristor to keep it saturated without the help of the large capacitor. As a result, the circuit gets stuck in its “clap detected” state!

Every thyristor has a “holding current” - that is, the amount of current necessary to keep it stuck in its diode-like mode. The MCR101 used in this circuit is rated for a 5mA maximum holding current at 7 Volts. My 4.5 Volt supply is in the same order of magnitude, so the holding current is probably something nearby that 5mA rating.

Using our 4.5V supply voltage and the 0.7V drop across the thyristor (and ignoring the huge capacitor that needs to be charged - this is an approximation), the 10k RL would pass only 380μA through the thyristor, an order of magnitude less than the 5mA rating. However, by replacing the 10k resistor with a 1k resistor, that same calculation yields 3.8mA, which is pretty close to 5mA. It seems like we’ve probably found the culprit!

Looking back at the surplus shop’s diagram, I now understand why they showed a normally-closed switch in series with the load - they probably put a heavy-ish load on the output, causing the thyristor to get “stuck” in its “on” state. This would be quite easy to do by accident, especially if they were using a higher supply voltage than I am.

This circuit has a very delicate load tolerance. On one hand, RL needs to pass enough current to charge the capacitor at a decent rate. On the other hand, if RL passes too much current, the thyristor gets stuck in the “on” state, and the whole circuit stops working.

Let’s get Digital

You could take this circuit’s swooping analog output curve and shove it directly into an input on a 5V microcontroller. After all, it drops as low as 0.7V, which means the microcontroller’s digital input pins will (should?) register claps as 0, and non-claps as 1. That said, it’s pretty easy, and quite fun, to turn this analog signal into a tidy digital signal. All we really need is a comparator, built out of an op-amp and a voltage divider:

Schematic diagram of the circuit with the external load resistor from earlier, plus an op-amp comparator circuit

Yes, I know: I mirrored the whole clapper schematic from the previous drawings. Sorry if that bothers you. I think the old orientation made sense for reverse-engineering, and this orientation makes more sense now that we’re building out additional circuitry.

The potentiometer sets the comparator’s threshold voltage. If I set the threshold voltage a little low, I get short pulses each time the sensor detects a clap (I also added an LED for demonstration purposes):

If I raise the threshold voltage, the pulses get longer:

Note that the potentiometer’s 10k total resistance is totally arbitrary - you could use basically any potentiometer here, though I probably wouldn’t go above 1M ohm.

Notice what happened near the end of the second video: when I gave the circuit multiple “claps” in rapid succession, all of the claps got squished together into a single output pulse on the comparator. If we simply want to detect periods of “clapping,” this might be a desirable behavior. However, if we want to accurately count individual claps, we’ll have to get clever.

Upgrades, People. Upgrades!

The op-amp chip I’m using for the comparator actually has two op-amps on board, which gave me an idea: what if I used one op-amp as a “clap detection” comparator, and the other one to create a “timeout” signal?

This would be pretty simple - just make two comparators, one with a higher threshold voltage than the other one. The comparator with a high threshold will be called the “timeout” comparator, and it will be responsible for determining when the user starts and stops clapping. Meanwhile, the comparator with a low threshold will be called the “clap” comparator, and it will show us exactly when each clap occurs.

If we add a simple counter chip, stick the “clap” signal into its clock input, and the “timeout” signal into its reset input, we get a device that counts claps, and resets after a few seconds of no clapping:

The “clap” comparator and the “timeout” comparator work together to drive the counter chip, resulting in the clap-counting behavior you see above. Here’s what happens when I clap once:

Oscilloscope screenshot showing the two comparators.

When I clap, the timeout comparator goes low, which allows the counter to exit its “reset” state. At the same time, the clap comparator pulses. The falling edge of that pulse increments the counter. Then, a little less than a second later, the timeout comparator goes back to a logic “1,” causing the counter to reset back to zero.

Here’s another example, but I clapped twice this time:

Oscilloscope screenshot showing the two comparators, again.

You get the idea. In summary:

  1. The timeout comparator goes low to enable counting.
  2. The clap comparator pulses as many times as you clap.
  3. The timeout comparator goes high again once it thinks you’ve stopped clapping.

This is pretty fun on its own, but at this point it’s easy to throw a 7-segment display decoder into the mix, giving us a more human-friendly interface:

Here’s the complete schematic:

Schematic of the complete clapper circuit, with counter and display driver chips.

U1A is the timeout comparator, and U1B is the clap comparator. The two 1N4148 diodes set the clap comparator’s threshold voltage to about 1 Volt, which results in a nice, short pulse each time a clap is detected. A potentiometer in series with the diodes sets the timeout comparator’s threshold. By putting the potentiometer in series with the diodes, the circuit guarantees that the timeout pulse is never shorter than the clap pulse. Move the potentiometer one way, and you will have several seconds to feed claps to the circuit before it resets. Move the potentiometer the other way, and you’d better clap fast.

Pin 2 feeds the timeout comparator’s positive input, but it feeds the clap comparator’s negative input. That’s why the timeout comparator goes low while claps are detected, while the clap comparator goes high. This choice makes the comparator outputs compatible with the 74LS90 counter chip. Its reset pins are active high, so the timeout comparator needs to output a logic “1” when no claps are detected. Meanwhile, the 74LS90’s clock pins trigger on the falling edge of the clock signal. For other counter chips, you may have to change the polarity of the comparators.

Oh yeah, I also bumped the supply voltage up to 5V to make the TTL logic chips happy.

Making an Actual Clapper

We’ve successfully counted claps. The 5K potentiometer adjusts the circuit’s sensitivity to claps, and the 10k potentiometer changes how fast you have to clap to avoid the counter resetting. But, the actual Clapper toggles things on and off when given particular combinations of claps.

The logic would work something like this:

  1. Start when the timeout comparator’s output goes low.
  2. Increment the clap count each time a falling edge appears on the clap comparator’s output.
  3. When the timeout comparator’s output goes high again, stop counting claps.
  4. If two claps were counted, toggle outlet one.
  5. If three claps were counted, toggle outlet two.
  6. Repeat.

It’s feasible to implement this logic with discrete components, as I’ve done with the rest of the circuit so far. It’s hellishly complex, though, and the design is still a work in progress. Hint: it involves a third comparator, a couple D flip-flops, and a bunch of NOR gates.

A simple microcontroller-based implementation, although not nearly as fun, is a lot easier to throw together for demonstration purposes. In practice, the added bonus would be that you only need one 8-pin microcontroller instead of several larger discrete logic chips. Here’s that in action (loud noise alert!):

Here’s the Arduino code - it’s nothing special.

A Standing Ovation

This is a really goofy board, but it’s good fun! I might go ahead and implement a complete Clapper-like circuit using discrete logic, but that would be a whole blog post in itself.

Picture of the clapper circuit board with various test leads hooked up to it. The board is sitting on a black table.

I had a lot of fun reverse-engineering this thing, and building up a proper circuit around it. There are a couple of snags I didn’t mention earlier, which have been laid out in the footnotes in case any unhinged soul decides to follow in my footsteps.

By the way, this project has started to get really messy:

Picture of several breadboards, a mess of wires, an Arduino, and a couple LEDs on a desk.

Footnotes

I’ve noticed that this clap sensor is a lot less sensitive than I would have expected. You have to clap very hard and the sensitivity potentiometer almost needs to be maxed out for claps to register from any significant distance. Perhaps this is due to the board’s age, or perhaps it’s a low-quality knockoff, or perhaps it was never meant to be used as a Clapper in the first place. Maybe it’s a combination of the three. I’ll experiment with different supply voltages to see if that makes a difference.

When I added the Arduino into the mix, I started having debouncing issues on the clap comparator. I solved this problem with a simple RC lowpass filter placed between the board’s signal line and the comparator inputs.