Track My Order
Frequently Asked Questions
International Shipping Info
Mon-Fri, 9am to 12pm and
1pm to 5pm U.S. Mountain Time:
Chat With Us
I’m having some trouble using the detector with a strip off ws2801 LEDs. I’m triggering the LEDs from the gate output. When the LEDs are plugged in it seems to cause feedback to the sound detector. I’m not sure how. Probably need an o-scope to debug this. I tried adding a cap on the led power lines but it didn’t change anything. Anyone have a suggestion why this might happen?
please, somebody knows which is the electret microphone model of the sound detector? does exist the frequency response curve of it in some datasheet? Thank´s!!!
hey i was wondering if you could help me, I havent worked much with circuits but i am in the process of making a guitar and wanted to add lights that turned on when i play, can you lead me in the right direction, as to what supplies i would need and how to go about it thank you!
This may sound stupid, but is there any way to turn this into a direct input to a computer while still being able to use the built in speakers?
Can you describe what you’re doing in a little more detail? I’m not sure I follow what you’re doing, as the Sound Detector doesn’t have any speakers.
Would it be possible to hookup a potentiometer to this circuit to make it adjustable for the sensitivity?(instead of populating/depopulating resistors) If so, what would you recommend, and where would I hook that up in the circuit.
I’m trying to use this circuit to design a clap-on/clap-off type of device, if you will. Having the ability to adjust the sensitivity to the input sound would add a ton of value for me. I’m considering a digital potentiometer too - something that is programmable using a MCU i2c bus or similar. Any advise on one of those would be great too.
Take a look at the rotary switch pot hookup guide.
To have the sound detector behave reasonably, it requires a reverse-log taper potentiometer, which can be hard to come by. The above tutorial walks through building one with a rotary switch.
i’ve purchased the sound Detector from a local electronics store here
i was wondering how can i use it with raspberry pi
When analyzing the oscilloscope output under “Three Outputs?”, I couldn’t quite figure out why the envelope signal seemed to “follow” the raw audio signal so poorly. That is, the peaks in the envelope signal seemed mysterious and very loosely correlated to the actual envelope of sound. Finally, I noticed that the peaks mostly correspond to where the oscilloscope shows the raw audio dipping below (or coming very close to) 0V.
The output of stage 1 is biased to Vref/2 (2.5V in your case), so I’m wondering if there’s a bug in the envelope follower circuit. As the pseudocode says:
if(Vin > 0)
Vout = 0;
Vout = Vin * -2.2
Shouldn’t the pseudocode (and the circuit) be comparing to Vref/2 to actually rectify the DC-biased signal?
I think there are several things at play here that might be confusing things overall.
When that hookup guide was written, I didn’t have a scope capable of capturing a diagram like that - the minimum time base was too fast to capture audio bursts like that, and I only had 2 channels. So I used an LTSPICE simulation to generate the diagram, using the output of a different simulation as a substitute for actual audio input, and adjusting the display parameters to make things line up – in the algebra in the top line, you’ll notice that the audio signal has been multiplied by 5 and offset by 2.5V. It doesn’t actually drop below 0V – it’s just been scaled to be a little more visible against the other signals.
The signals in the picture approximate what you’d see if you put a 3 channel scope on the 3 outputs of the Sound Detector, where the audio output is indeed DC-coupled, similar to our Electret Mic Breakout. With the DC bias, it’s easier to interface with a microcontroller.
But that’s not the signal that’s fed to the input of the rectifier - it’s AC-coupled via C4, removing the Vcc/2 offset. The 0 in the pseudocode is correct – correct for the canonical output of the rectifier – which feeds the lowpass filter of R8/C1. This lowpass obscures some of the detail in the peak-tracking behavior of the rectifier, but results in a better behaved signal at the input to the Schmitt trigger.
Ah, thanks Byron! The algebra in the signal names escaped my notice and I completely missed C4 coupling the output of stage 1 to the input of stage 2.
Is R9 just acting as a way for C1 to discharge through? If so, then I take it that by increasing the resistance one could have the envelope tracked more closely?
Yes, R9 bleeds the cap back to ground. If you want it to discharge more quickly, reduce either the resistor or the cap.
If you want to play around with the sim, there are LT Spice files in the GitHub repo. “Sound_detector-wav.asc” allows you to use a .wav file as simulated input.
Thanks, Byron! For anyone reading this in the future, I replaced R7 with a 3.3K instead of 33K and replaced the 100K R8 with a straight jumper and the circuit seems to work perfectly at 5V, in both bar and dot modes. It works equally well at 9V (since I’m using a less sensitive opamp). With 9V, the input signal has a bit more range, so I adjusted R7 and R9 so the reference high voltage wouldn’t only be 3.4V. I figured it’d be nice to be able to change the sensitivity based on how loud the environment is, so I then replaced the 2.2K R9 with a 1.5K resistor, and the 3.3K R7 with a 5K POT. This lets the high voltage range from about 1.25V up to 5.4V, while keeping the LED current between 9-11mA. Seems to work well with a range of volumes.
At this point, you’re in deeper than I am - that project was pretty hastily tossed together. Your theory seems correct, for the most part.
It could be that I miscopied resistor values (33K for 3.3k?), and compensated with an additional resistor.
So with 33K, I overshoot on Vref - we can’t reach 20V on a 13V supply, so it’s probably nearer 13V, but still really high in comparison to the Sound Detector output.
The trick comes in that 100K - The Rhi pin isn’t HiZ, but rather the top end of the internal resistor ladder for the comparator chain. Page 17 of the LM3916 datasheet indicates the chain adds up to 10K. So it looks like I really overshot on the reference voltage (by about a factor of 10), then put a 100K resistor at the top of the ladder to scale it back down (by a factor of about 0.1).
Maybe if I hadn’t botched the Vout, it would have been happier on a lower supply…I’ll leave that exercise for the reader.
For my breadboard test, I just created the first half of your Sound Detector (mic preamp and peak detector) using the two halves of an LM358. (I figured I don’t need the buffer opamp since the input is just going into pin 5 of the 3916, and the 358 has a wide input range). Jimbo’s 3914/3916 guide uses 5V throughout, and sets the 3916 Ref_out (pin 7) to 3.2V (using a 2.2k and 3.3K resistor, also tied to R_hi). Here you’ve connected R_hi to Ref_out through a 100K resistor (or to be less sensitive, suggested 10K or lower), but I don’t quite understand the effect of those resistors? I’m assuming pin 6 is very high impedance so what does the extra 100K do? Also, by using a 33K resistor instead of a 3.3K between Ref_adj (pin 8) and ground, doesn’t that set the Ref voltage to 20V rather than 3.4? Or is this where that 100K/10K resistor alters that? Thanks again for all the info!
I think I initially followed the same line of thinking - power everything off the same, low voltage power supply.
Powered off 5V, the LM3916 was misbehaving, as I remember. Some segments wouldn’t go out, or it was in some flaky halfway state between dot & bar modes. Switching it to the 13V supply solved it, and I didn’t dig much deeper.
At this point, I don’t recall why it was 13V, or if there’s any specific magic to that value. 9V might be fine.
The op amp at the heart of the sound detector is the first constraint against higher voltages. The LMV324 is rated to an absolute maximum of a 6V supply. A 5V supply leaves some margin for error.
If you’re designing your own board, you could use an LM324, which is pin compatible rated to 36V max. You’ll also want to use caps rated to higher voltages.
Alternately, there are also smaller regulators - the 78L05 is the little brother of the 7805 in a TO92 package, there’s also an LM317L.
I just noticed on the schematic that you designed this board. Very cool. I feel almost like I’m asking Hans Camenzind about his 555 timer. :)
Okay, so with a clean enough power supply, I’m curious about the analog LM3916 example. I have it working as you boarded it (and had done other circuits with the 3914 and 3916), but I don’t understand why the 3916 needs 13V in this case? I’ve read the datasheet as well as the SparkFun 3914/3916 guide, and I see the first datasheet example suggests 12-20V in order to support a 10V signal. But in this case, isn’t the signal only going to be about 1V? Couldn’t the 5V also supply the 3916 (even in bar mode) as long as V+ is at least 1.5V higher than the top of the input signal? Alternatively, wouldn’t the Sound Detector and LEDs work just as well with a 13V input rather than regulating it down to 5V? It looks to me like all the should support a voltage range?
I ask for practical reasons - I’d like to etch a portable version of this circuit, so I’m trying to figure out if I should power everything from a 9V battery, or maybe 4 AAA batteries, or 2 LiPo batteries, giving me a range of 6-9V. Would any of these voltages work equally well for powering both the Sound Detector circuit and the 3914 without creating two separate supplies? (I also have plenty of 7805 and 317 chips so could create the separate supplies, but I’d love to understand why its helpful.)
Thanks again for all the insight. Hopefully this will be interesting to someone else as well.
There’s certainly an aspect of this that boils down to understanding what your tools are capable of, and having a gut feeling of when they’re telling you something unreasonable. There’s a chance that your meter just reads 1.5mV, even when the actual input is less than that. A millivolt is pretty tiny.
If you want a really readable guide to using meters and scopes, and knowing when to suspect the results they yield, Bob Pease’s Troubleshooting Analog Circuits book is great. Pease is extremely knowledgable about electronics, and also a good (if opinionated) writer.
I wasn’t able to stabilize that bench supply by throwing caps at it - trust me, I tried, and eventually gave up, opting for the LM317 solution (with appropriate caps on I and O pins).
Have you tested the Sound Detector with any of the batteries or supplies you mention? At the end of the day, the proof is in the results. As mentioned in the tutorial, 0.000 VAC is an ideal goal - perhaps somewhat hard to attain. 10 mV seemd to be the threshold above which they detector got twitchy.
Thanks, Byron. I really appreciate the info. I’m not an engineer, but I suspect I’m pushing the limits of my inexpensive equipment ($50 multimeter and $400 oscilloscope), or perhaps the RF noise in my garage. The ExTech 330 shows 0.003V (or 3.6 mV) AC touching the leads together, although touching the leads to a 9V battery I did get the AC to drop down to 1.5mV. The Rigol DS1102 shows 4-6mV peak to peak if I connect the probe to its own ground, and 0-2mV peak to peak touching the terminals of a 9V battery. With the bandwidth filter off and the probes at 1X I get the most sensitivity, although the frequency of those noise shows up at about 100MHz, which is supposedly the speed of the oscilloscope. Touching the probe to the built-in square wave test signal it seems to be a few tens of millivots above 3V, i.e. closer to 3.1V sometimes than 3.0V, although that may just be as precise as they’ve made the test signal since its designed just to adjust the variable capacitors to get as square of a wave as possible when in 10X mode, right?
Anyway, thanks again, hopefully this setup is clean enough for using an electret mic, or that it will be when I use a 9V battery on the final version. Otherwise I’ll try using a voltage regulator to get to 9V to see if that’s cleaner. In general, are there a set of caps you recommend for cleaning up a cheap bench power supply?
There are several pieces this discussion - I’ll step through each in turn.
The first is the measurement method - when you’ve got the measurements leads just floating in the air, they’re antennas, and they’ll pick up interference from all over the place, including AC radiated from power lines. With my scope and meter leads just dangling, I read about 15 mVp-p on the scope, and 43mV on the meter. If I grab the wires, I get much higher pickup.
For reference, the scope is a Tek TDS2024 with 200MHz/10MΩ probes - the meter is a Fluke 115. The VAC range on the Fluke is only specified up to 1KHz - if I’ve got high-frequency noise on the supply, it won’t register - but the scope will show it clearly.
If I short the leads together (red-to-black with the meter, clipping the alligator on the scope probe right to the tip), the high-impedance antennas just become wire loops, and the noise is greatly reduced. The scope input is still noisy - even with no probe connected, I get 10mV or so - but the meter registers no voltage - 0.000 VAC.
A good neutral reference isn’t with the leads floating, but with the inputs shunted to ground. If your meter doesn’t read 0 VAC with the inputs shorted, it may indicate that the meter has some internal issues. Many meters are designed to be useful working on household wiring - millivolts AC may not be it’s primary selling point. Many scopes have a switch or option to short the input to ground for verification purposes.
So to start, you need to characterize the test equipment a bit - I know that my scope is noisier than my meter, therefore I use the meter to make small VAC measurements, within it’s frequency limits.
Moving on, and using said meter to measure AV noise from some different supplies on my bench (and verifying their sanity within the abilties of my scope), here’s what I see:
It’s this cheap bench supply specifically that I wanted to account for in the hookup guide. For powering a small microcontroller, the bench supply is fine. But it makes the sound detector unusable - the noise on the supply is coupled into the microphone output, and the Schmitt trigger wiggles around, also, making it almost impossible to set the sensitivity to anything useful…the light just flickers, regardless of ambient sound.
If nothing else, it’s worth testing with the noisy supply, so you can see the difference when you move to a more stable one. The difference is immediately obvious.
So how to handle it? I used an external voltage regulator to clean it up. The demo board I’ve got handy used a LM317, strapped for 5V. It gets the noisy ~10 V input from the bench supply, and scales it down to a clean 5V. LM78xx regulators are also useful - LDO and switching regulators might work, but I haven’t characterized them in this application.
I’m curious how to get such a clean power supply? You write that it should ideally read 0.000V AC and definitely be less than 10mV, which I understand given how tiny the microphone’s signal is, but I’m not sure how to get there, or if my measuring equipment is just too noisy? Using an Extech 330 multimeter in AC mode, I get 0.003V or 3.9mV with the leads not connected to anything! I get a similar reading on a DS1102E oscilloscope with the probe in 1X mode and not even connected to anything. If I attach 2 AA batteries, it still reads 3-4mV, even using the half-inch spring as a ground clip rather than the separate 4" cable. Connected to my (cheap) bench supply, I get about 6mV, which I can bring down to about 4mV if I add various capacitors in parallel. This is true from DC voltages ranging from 2V to 18V (all I tested). With the bench supply, I can see the ripple is steady at 60Hz, so I assume it’s from the mains source, but I get the same amount of noise (just not repeating) if I disconnect the leads / probes or attach them to various batteries. I assume the disconnected noise is from RF interference, but what can I do about it? Do I need to add inductors or ferrite somewhere or somehow? Thanks for any thoughts.
If you've found a bug or have other constructive feedback for our tutorial authors, please send us your feedback!
Forgot your password?
No account? Register one!