Davidelvig
Well-known member
I'm going to cherish the few Neutronned mics I have!
Anyone, please? Sorry if it's a trivial question, just can't wrap my head around it.
sure you can do it.The ouput from the amp is about 2Vpp max on a 1.25V DC bias, so it can be easily used with any Analog/Digital converter that is up to 3.3V input.
Let's assume you the MIC has 0V which would be presented to ADC as 1.25 V.Not sure I get the point "need to correct bias 1.25->1.65 if using 3.3V AREF".
Anyone, please? Sorry if it's a trivial question, just can't wrap my head around it.
As I understand it, the need for the PCB for the mic input is that the Teensy audio lib (AudioInputAnalog) expects the audio input range to be 0-1.2v. Paul provides a suggested circuit in the AudioInputAnalog URL, which is also discussed in threads:
https://forum.pjrc.com/threads/4046...io-Lib-results?p=130425&viewfull=1#post130425
https://forum.pjrc.com/threads/54022-ADC-questions
analogReference(INTERNAL); // range 0 to 1.2 volts
analogReference(EXTERNAL); // range 0 to 3.3 volts
#include <Arduino.h>
#include <TM1637Display.h>
// Module connection pins (Digital Pins)
#define CLK 19
#define DIO 18
// The amount of time (in milliseconds) between tests
#define TEST_DELAY 2000000
//done flag aray of segments
const uint8_t SEG_DONE[] = {
SEG_B | SEG_C | SEG_D | SEG_E | SEG_G, // d
SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F, // O
SEG_C | SEG_E | SEG_G, // n
SEG_A | SEG_D | SEG_E | SEG_F | SEG_G // E
};
//ready flag aray of segments
const uint8_t SEG_READY[] = {
SEG_C | SEG_D | SEG_E | SEG_F | SEG_G, // b
SEG_E | SEG_F | SEG_D, // L
SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F, // O
SEG_G // -
};
//sound flag aray of segments
const uint8_t SEG_SOND[] = {
SEG_B , // b
SEG_E, // _
SEG_B , // b
SEG_E // _
};
TM1637Display display(CLK, DIO);
/* FreqMeasure - Example with serial output
http://www.pjrc.com/teensy/td_libs_FreqMeasure.html
This example code is in the public domain.
*/
#include <FreqMeasure.h>
enum
{
IDLE_ST = 0,
READY_ST,
MEAS_ST,
DISPL_ST,
DONE_ST
};
//timeout values for the states defined
const long int MaxIdleT = 1000;
const long int MaxReadyT = 1000;
const long int MaxMeasT = 5000;
const long int MaxDisplT = 7000;
const long int MaxDoneT = 1000;
//initialize the state variable
int SysState = IDLE_ST;
//initialize the max timeout.
long int Exit_time = millis();
void setup() {
Serial.begin(57600);
FreqMeasure.begin();
//update the exit time for idle state
Exit_time += MaxIdleT;
//set the display to full and zero.
display.setBrightness(0x0f);
}
double sum = 0;
int count = 0;
int k;
int idx;
void loop() {
uint8_t data[] = { 0xff, 0xff, 0xff, 0xff };
uint8_t blank[] = { 0x00, 0x00, 0x00, 0x00 };
// do something different depending on the State value:
switch (SysState) {
case IDLE_ST: // initialize the sequence variables
if (millis() > Exit_time) {
//Serial.println("IDLE_ST");
Exit_time = millis() + MaxReadyT;
SysState = READY_ST;
}
break;
case READY_ST: // signal the user to start tone
display.setSegments(SEG_READY);
if (millis() > Exit_time) {
k = 0;
idx = 0;
//Serial.println("READY_ST");
Exit_time = millis() + MaxMeasT;
SysState = MEAS_ST;
}
break;
case MEAS_ST: // measure the tone
if (FreqMeasure.available()) {
// average several reading together
sum = sum + FreqMeasure.read();
count = count + 1;
if (count > 30) {
display.setSegments(SEG_SOND);
float frequency = FreqMeasure.countToFrequency(sum / count);
//
k = int (frequency);
if (k > idx) idx = k;
// Serial.println(k);
// display.showNumberDec(k, true); // Expect: 0xxx
sum = 0;
count = 0;
}
}
if (millis() > Exit_time) {
//Serial.println("MEAS_ST");
Exit_time = millis() + MaxDisplT;
SysState = DISPL_ST;
}
break;
case DISPL_ST: // display the value
display.showNumberDec(idx, true); // Expect: 0xxx
if (millis() > Exit_time) {
//Serial.println("DISPL_ST");
Exit_time = millis() + MaxDoneT;
SysState = DONE_ST;
}
break;
case DONE_ST: // post new sample request to user
// Done!
display.setSegments(SEG_DONE);
if (millis() > Exit_time) {
//Serial.println(" DONE_ST");
Exit_time = millis() + MaxIdleT;
SysState = IDLE_ST;
}
break;
}
///////end of states
}
This microphone module posted on the PJRC website long ago, but never a followup to the forum.
Here's the link.
https://www.pjrc.com/max9814-microphone-module-for-teensy/