Minimal hardware for tiny Audio/Visual project

Hello all,

I am trying to find the the minimal hardware configuration for my Audio/Visual project. I am using an ATTiny85 with Adafruit_NeoPixel lib to drive some WS2812 and want to use a electret microphone to make it respond to sound. I know of the max4466 but thats already too complex.
I used the attached circuit with the analog input and it kinda works but I see fluctuations in the ‘silent’ value: sometimes analogRead() averages around 480, or 508, or other values
By looking at the circuit I don’t even understand how analogRead() settles around the midpoint of the 10bit range. Am I even using this circuit right?

Thanks in advance,
Markus

Leaky capacitor?

You need a voltage divider after the capacitor, to set a reasonable DC offset for the ADC. You might try 47K/47K, but the values aren't critical.

What type of microphone are you using? With a piezo the resistor should be on the output side and to GND.

The output has no DC bias if you've just connected it to a high impedance input like an analog input pin. You need something like a 1M/1M voltage divider between Vcc and ground, with the center tap connected to the input pin.

You're right that it won't settle around the middle without that.

10k is a pretty high value mic bias resistor for a 5V supply, should be more like 4.7k or 2.2k.

1 Like

Thank you! I tried 4.4K and it has the desired effect of putting it at 512.

What is the 'optimal' value for the resistor? I remember something about the internal resistor of the ADC. Does that play a role?

That value has no direct bearing on the input value - it's just an amazing fluke! The mic load resistor only controls the bias of the mic, not the Arduino input.

The optimum value depends on the mic, you need to check the mic specs.

The internal resistance of the ADC is so high, that it plays little or no role in the input circuit calculations in this case.

Did you, or did you not, add the input resistor divider? Without it, the input value will drift with temperature, time, the phase of the moon etc.

Yes, I used 4.4k. Attached is the mic specs, maybe you can take a look?
Thanks!
mic-cmc_5044pf_a-1776689.pdf (1.8 MB)

Sure, after you answer my other questions. The mic bias circuit isn't as important as the resistive divider. But notice that the published specs are based on a choice of 2.2k for load resistor with a 2.0V supply. A simplistic extrapolation would suggest a load resistor of about double that for a 5.0V supply. FET biasing is never super critical - the devices themselves have huge variations from device to device.

Most real world FET biasing is done by trial and error until the right resistor value is found. The right value is the one that puts it roughly in the middle of its transfer curve.

Again, skip that for now and focus on the resistive divider. Your question concerns the output DC bias, which is actually isolated (except for leakage current) from the mic bias circuit, by C1.

The circuit you have posted is designed to drive an input that already has its own DC bias circuit to establish a quiescent point around zero volts. The analog input lacks that, and also requires a non-zero bias voltage.

Coming back to my original circuit: I set RL = 10K , C = 1uF and the voltage divider to 4.4k . Reading your answer and taking the specs into account I should set RL to 5/2*2.2 = 5.5k, correct?
And with the voltage divider I have to find the value iterative?

It depends what values you have on hand. 5.5k or 4.7k would be fine. Regards the divider, its purpose is only to provide a DC bias, you do not want it to load the mic circuit very much. So it should be at least 100k. I have no idea what you mean "iterative". The chosen value actually should depend on the ADC input characteristics, which are in the data sheet. There is a minimum and a maximum, but it's not super critical. That's why I suggested 1M. But upon some reflection, it's better to present a lower impedance to the ADC than that. Hence, I suggest 100k or so.

To be fair, the circuit will work with any value between about 2k and 10k for RL. That is just a fine point. It will only alter the gain and dynamic range of the mic.

1 Like

I will try it with 4.7k -- I looked up the ADC input characteristics for ATTiny: Analog Input Resistance 100M Ohm.

It's unfortunate that this simple wiring on a breadboard gets very sensitive, slightest touch to a wire makes things jump around. I will solder it now.

I use RL=5.1K and 1M divider now and getting clear readings. This seems solved now.

The issue with the sensitivity turns out to be another problem: Since I am also driving LEDs from the same 5V I get small voltage drops which are impacting the mic reading.
I guess I have to add a 3.3V voltage regulator for the mic and ATTiny - I don't like it as it's increasing complexity again.
Are there any simple alternatives?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.