Am I missing a resistor in my "zero power" microphone amp circuit - Page 1
Forum section: electronics / beginners

author: yesORno
author_rank: Newbie
timestamp: January 26, 2021, 09:24:21 pm
content: Hi,I'm trying to make a (hundred) clap-switch tealight that are powered from a single CR2032 coin cell.I was able to find a really nice mems microphone that operate at 10uA when the sound pressure is under a certain level.So I designed and (jlcpcb) manufactured a PCB of a circuit consisting of:Microphone (VM1010)A rail-to-rail opamp for amplificationAn atmega 85 for clap detection and microphone control.Please take a look at my hand-drawn circuit drawing.I assembled the circuit piece by piece. First thing I noticed was that my super duper low power opamp with 14kHz bandwidth is not able to amplify anything above 1kHz.Then it was time to connect the "Vout" microphone output to the non-inverting opamp amplification circuit. Vout is the analog output of the microphone and has a 0.7V DC component that it oscillates around. This output was connected through a SMD (ceramic?) capacitor to remove the DC-offset. The expected output of the opamp circuit is a positive-only amplified version of the analog microphone output.However this is not what happened: There was no signal on the + opamp input. I desoldered the capacitor, and I could just occasionally get analog output of the microphone that I saw before connecting it to the opamp circuit.The microphone (VM1010) datasheet says something about "driving capability: 100pF". My capacitor was probably in the uF range.What happened?Should I have put a large value resistor between the mic and the capacitor?Should I have used a 100pF capacitor, but no resistor in series?

author: Zero999
author_rank: Super Contributor
timestamp: January 26, 2021, 09:37:24 pm
content: 14kHz is the gain bandwidth product, meaning the frequency, when the gain falls to unity, so it probably doesn't have enough gain for 1kHz.There's not DC bias point for the op-amp, which is why it's not working properly. Connect the non-inverting input to a potential divider, say two 1M resistors, to bias it at half the supply voltage.It's a good idea to AC couple the lower part of the feedback divider to 0V.EDIT:Awhile ago, audioguru did schematic showing the inverting and non-inverting op-amp configurations, both DC and AC coupled. Here's my version, showing the differential configuration too. You want the non-inverting single supply configuration. The recommended resistor values are selected to ensure the DC impedance seen by the inputs are virtually equal and is important for a bipolar op-amp, with high bias currents. In your case, it's probably a CMOS op-amp, with a massive input impedance, so it's less critical.

author: iMo
author_rank: Super Contributor
timestamp: January 26, 2021, 09:38:21 pm
content: What opamp do you use?

author: yesORno
author_rank: Newbie
timestamp: January 26, 2021, 10:04:52 pm
content: What opamp did I use?https://www.digikey.com/en/products/detail/microchip-technology/MCP6041T-I-OT/529846Zero999:Thank you so much. I really appreciate it. I will sit down and study it tomorrow after work. Really glad I joined this forum.

author: yesORno
author_rank: Newbie
timestamp: January 27, 2021, 09:07:35 pm
content: Thanks again Zero999, but I think I may not have made it clear how I wanted the circuit to behave. Your circuits are probably great for mic pre-amp use cases. I want to detect claps, by detecting short bursts of really loud sounds.The idea was to amplify the positive part of the microphone signal.A: First remove the DC offset with a series capacitorB: Do non-inverting amplication, resulting in half-waves with large amplitudeC: Detect if the half-wave amplified version goes over the 1.1V voltage reference the uC has. This is going to be how claps are detected.Mic datasheet:https://www.mouser.com/datasheet/2/960/vesper_tech_06182019_VM1010-1605563.pdfWhat does "driving capability: 100pF" mean? Does that mean that the series capacitor should not have been more than 100pF? Should I have put a series resistor between the mic and the capacitor to limit inrush current?

author: gnuarm
author_rank: Super Contributor
timestamp: January 28, 2021, 01:45:33 am
content: Quote from: yesORno on January 27, 2021, 09:07:35 pmI'm not certain I understand your circuit, but it sounds like it will detect any loud sound, not just claps. I remember when I was a kid they sold a "clapper" on TV. It took two claps to turn something on or off. It would also activate on setting down a glass sometimes.QuoteThat spec is for the digital output signal, which would appear to be the "wake-up" signal. You don't need to worry about it on the analog output. The capacitor is not your load. You will need a resistor to ground on the MCU input to assure the signal is ground referenced. But be aware it will also drive the input negative possibly causing damage.It might be better to add an op amp with a diode in the circuit to rectify the signal. You can find that circuit anywhere.https://www.google.com/search?client=firefox-b-1-d&q=op+amp+with+a+diodeYeah, if you use the cap to remove the DC your AC component will drive any input below ground which can cause damage. You might be able to find an op amp that will tolerate this, but it may be hard to find one.Another way is to use the op amp as a subtractor by feeding mic signal to the - input of the op amp setting the resistors to the gain you want. Use a low pass filter of the mic signal to the + input with a matching resistor divider. The output will be ground referenced with positive peaks. With the component values shown the approximate cut off frequency is 100 Hz. Above that the signal will trigger the MCU. Below that the signal will be significantly attenuated. The cut off is not at all sharp. Louder sounds at lower frequencies will still set it off.Use a smaller cap to increase the cut off frequency. Reduce or increase R2 and R4 (always matching) to reduce or increase the gain.

author: Zero999
author_rank: Super Contributor
timestamp: January 28, 2021, 08:39:50 am
content: Quote from: yesORno on January 27, 2021, 09:07:35 pmThe original circuit has the non-inverting op-amp input floating. In order for an op-amp to work, it needs both of its inputs connected to a DC point, to provide a path for the bias currents. The inverting input is already connected to the output, via the feedback network, but the non-inverting input is just connected to a capacitor. Connect it to 0V, via a resistor, say 1M.QuoteIt's the maximum capacitive load it can drive without oscillation, i.e. biggest low series resistance capacitor which can be connected to its output and it still be stable. AC coupling capacitors aren't an issue, because they have a resistive load in series, which dominates the capacitive component.More reading:https://www.ti.com/lit/ug/tidu032c/tidu032c.pdfhttp://rohmfs.rohm.com/en/products/databook/applinote/ic/amp_linear/opamp/gpl_opa_osc_load_capa-e.pdfhttp://www.st.com/resource/en/application_note/cd00176008-operational-amplifier-stability-compensation-methods-for-capacitive-loading-applied-to-ts507-stmicroelectronics.pdfhttps://www.analog.com/media/en/analog-dialogue/volume-38/number-2/articles/techniques-to-avoid-instability-capacitive-loading.pdf

author: iMo
author_rank: Super Contributor
timestamp: January 28, 2021, 09:45:06 am
content: Quote from: yesORno on January 27, 2021, 09:07:35 pmYou would need a more complex schematics for that. First you have to amplify the clamp "burst" and rectify it in order you get a single pulse during a clap. Then you need a comparator set somewhere into the middle of the typical clap amplitudes to make a digital "clean pulse" out of it in order to count it properly.The 100pF "driving load" means the capacitance between the mic chip output and the ground. The input of the opamp is not the ground.

author: yesORno
author_rank: Newbie
timestamp: January 28, 2021, 08:15:46 pm
content: Quote from: gnuarm on January 28, 2021, 01:45:33 amThanks gnuarm! That circuit looks perfect. I will of course do software magic to only make sure that putting down a glass won't trigger it. And if it does, then worst case is that a small candle is litI tried your circuit in the falstad online circuit simulator, and it seems to work great there. I don't have access to a lab because of corona.2 questions:How do I calculate the cut-off frequency of the filter? 1/(2*pi*R4*C1) ? Do I need to consider R3? I think it may depend on the mic, PCB and mic-placement where on the frequency range its easiest to detect claps.In low power mode, the output of the mic is 0V. In the circuit simulator this causes a high output of the opamp. I'm therefore concerned about the power drawn due to R5. Any reason of having such a low resistance, could I increase to 1M with no change of behavior?Zero999:I see what you mean. Thanks for the links! I'll definitely have a look at thoseimo:I realize that now. gnuarm had a nice circuit that I will prototype as soon as possible.

author: gnuarm
author_rank: Super Contributor
timestamp: January 29, 2021, 03:11:49 am
content: Quote from: yesORno on January 28, 2021, 08:15:46 pmThe mic is near to a voltage source (1 kohms) so it is treated as a ground for calculating impedance in the RC. You can add it to R3 if you want to be more precise. Then use the parallel resistance equivalent of R3 and R4. This is because they are acting as a voltage divider. The Thevenin equivalent is the voltage at the R3,R4 junction in series with the paralleled resistance. If you are not familiar with that search on Thevenin and there are tons of resources. That is the resistance to use with the C to get the corner frequency. But it won't be a sharp rolloff because the output is 1 - A*Vin. Even if it was direct it wouldn't be sharp, but this is different still. Since you don't know the dominant frequency of a clap it will be experimenting anyway. With the components given the corner is about 200 Hz.QuoteYou may not need R5, but the output won't stay driven high when the mic goes to ground. R5 is there to assure the output goes low when the input is trying to drive it below ground. Op amps can do funny things as the output goes to the rails. Often their drive capability is limited, so the pull down.Your simulation has to wait for the cap to discharge, then the output will also go to ground and no more current in R5. But you can make R5 bigger. The only rule is when you modify the gain setting resistors, keep R1=R3 and R2=R4. That's not actually a hard requirement, but it makes the circuit easy to analyze. Different values in the same ratios R1/R2 = R3/R4 give the same output but present different resistance at the op amp inputs (to balance the input offset current impact) but that's not important in this circuit. Different ratios give a different gain for the two inputs which will mess with the operation of the circuit.Ignoring that the inputs to the op amp are both connected to the mic consider them separately. The output of the circuit without the cap is just G * (A-B) where G is the gain (R2/R1) and A and B are the voltages at the two inputs (where the mic is connected). So with both inputs connected the output would be zero. When the cap is included the A input gain drops at higher frequencies. At DC both inputs are the same so the output is zero. At frequencies well above the corner frequency the A gain is zero making the circuit just G * B. Since the bias point (DC gain) is zero, the AC signal is centered at ground. Without a negative supply that means the signal is positive only.So make sure you pick an op amp that is ok driving the output to ground. Don't go by the part number on the schematic. That's just one I picked from the LTspice library that worked. First I had to go through a bunch that didn't work!

author: yesORno
author_rank: Newbie
timestamp: February 09, 2021, 09:06:55 pm
content: Hi,I made a prototype PCB with your circuit gnuarm. And it worked great.This is how the analog part of the circuit ended up, using the component names from gnuarms circuit:MIC: VM1010R1=R3=11kR2=R4=180kC1=100nFR5=500kOpamp=MAX9910The amplification is not enough, so claps from 1 meter doesn't always work.The rest of the circuit is an arduino programmed attiny85, some bypass caps, LED and resistor for the LED.The attached GIF show how setting down a glas doesn't turn it onCables are only used for power and programming the arduino, they will be replaced by CR2032.Gif upload din't work. Giphy:https://giphy.com/gifs/hrSyGjQotqgIRLEBOmAnd thank you guys/gals! Really appreciate it

author: gnuarm
author_rank: Super Contributor
timestamp: February 09, 2021, 09:33:48 pm
content: Good to hear. To get more gain increase the values of R2 and R4. This will impact the filter coefficient too, but that is not likely to be a significant issue. Only way to find out is to try it. They have to remain equal for the circuit to remove the DC, so don't change that.

author: Zero999
author_rank: Super Contributor
timestamp: February 09, 2021, 10:18:34 pm
content: Just reduce the value of C1 by the same factor, so if R5 & R4 = 560k, which is about 3 times as big as 180k, make C1 a third of 100nF, which is 33nF.

author: gnuarm
author_rank: Super Contributor
timestamp: February 10, 2021, 12:26:37 am
content: Quote from: Zero999 on February 09, 2021, 10:18:34 pmThat is not correct. The resistance to be paired with C1 is the parallel combination (or Thevenin equivalent, however you wish to term it) of R3 and R4 which is not much different when R4 is changed from 180K to pretty much any larger value. At R4 = 180K the parallel value is 10.37K and the upper limit is 11K at R4 being an open circuit.

author: Zero999
author_rank: Super Contributor
timestamp: February 10, 2021, 09:05:58 am
content: Quote from: gnuarm on February 10, 2021, 12:26:37 amYes, you're right. I stand corrected. In other words R3 & R4 form a potential divider, who's output impedance is equivalent to both of their values in parallel, of which R4 being the lower dominates. Increasing it by a factor of three will make little difference, much so than the tolerance of a capacitor. In other words: don't change the capacitor value: 10nF is fine, irrespective of R2 & R4.