So I'm playing around with my Giga and the microphone.
I purchased a TRRS microphone, and no matter what I do, I don't read any input from A7. Is there something hardware wise I need to do?
Here is the sample code
#include <Arduino_AdvancedAnalog.h>
AdvancedADC adc(A7);
uint64_t last_millis = 0;
void setup()
{
Serial.begin(9600);
adc.begin(AN_RESOLUTION_16, 8000, 32, 64);
}
void loop()
{
if(adc.available())
{
SampleBuffer buf = adc.read();
// Process the buffer.
if((millis() - last_millis) > 200)
{
Serial.println(buf[0]); // Sample from first channel
last_millis = millis();
}
// Release the buffer to return it to the pool.
buf.release();
}
}
But, you need a preamp. Microphones put-out a few millivolts and they always need a preamp.
And, since the microcontroller's ADC can't read the negative-half of the AC audio waveform, the signal normally has to be biased. That's not always necessary if you jus want to get "loudness" and you don't care about getting an undistorted audio signal but you also have to protect the microcontroller from negative voltages.
And, assuming you have a "computer microphone", they are usually electret condenser mics which require power. Computer and phone mic jacks supply 5V to the microphone.
The easiest solution is to use a Microphone Board which will have a preamp and a biased output.
"I've heard" that the Giga has a built-in op-amp so you could build your own biased mic preamp.