-
• #2
You want your input to be in the 3.3V range for the Espruino, but your mic wants 4-10V, per the oh-so-detailed specs :). I would compute a voltage-divider for the mic input to bring the signal into your target voltage range.
You could try feeding the mic with 3.3V off the Espruino too, but you'll probably get very poor response from the mic that way.
-
• #3
@RandyHarmon thanks for the detail on the proper voltage for the ADC inputs. I didn't realize they were limited to 3.3V on the Pico. On this page the diagram doesn't actually label the ADC ports as 3.3V tolerant like the legend would suggest they should. But I just looked at the standard Espruino board page and that label is indeed there.
Would you be able to offer any guidance on how I can test the mic with a voltmeter to help me better understand its operation? I looked at the specs, but being new to these small electronics I wasn't able to completely understand what voltages to expect coming out of the mic.
Thanks for the quick tips!
Cheers. -
• #4
The ADC pins are 5v tolerant, but ADC readings above 3.3v are ~1, full scale is Vcc.
-
• #5
If it was me, I'd probably put a tone-generator/tuning-reference-pitch sorta app on my phone and put that right next to the mic, to get a fairly constant high-input signal to test with the voltmeter. Realize that the mic has to represent sound waves electrically, so you won't get (average) values in the 9V range.
I'd also probably generate an e.g. 440Hz tone, sample it as fast as possible for around 1s/220 or 5ms using a simple Espruino program (triggering the capture on button press, for example), and examine that data stream, hoping to see it vary through 0.0 - 1.0 (of 3.3V) and back down to 0.0 on a fairly smooth curve, then repeating. I'd spit out that data to the console and plot it on a graph to see things like:
- How much headroom you have (if you don't reach near 1.0) for extra-loud noises,
- Your average voltage, which should correspond to your Voltmeter's reading from the same signal
- Whether you're getting clipping (many samples at ~1.0) to suggest you didn't voltage-divide it sufficiently or that you're just feeding it a signal too close to the mic, and/or
- Whether you're getting any positive bias that prevents you from getting low-range values (at the bottom of the waveform) near 0.0 - a possible source of signal-quality problems.
Once you're able to see some of these attributes in the signals you sample by direct examination, you should then be able to write some logic to process the signal in a way meaningful to your application.
For instance, you could detect a large stream of measurements above a threshold like 0.95 and turn on the LED to indicate clipping. When not clipping, you could detect signals in the 80-95% range and use partial intensity on the LED to indicate the signal strength. Or you-call-it, because I have no idea how you're wanting to use the mic for your project. :)
- How much headroom you have (if you don't reach near 1.0) for extra-loud noises,
-
• #6
NB 1s/220 should give you two cycles of the 440Hz signal.
I'm trying to figure out how to wire up a basic electret microphone element from Radioshack:
http://comingsoon.radioshack.com/electret-microphone-element-with-leads/2700092.html
I'm not sure how to wire it up to A5 on my Espruino Pico to monitor audio. I'm using a 9V battery as a power source on a breadboard and placing the output on the A5, and then also supplying BAT_IN with the same power source and GND to the negative terminal on the battery. When wired up, I get constant values so I must be doing something wrong.
Here's the code I'm using: