Forum Rule: Always post complete source code & details to reproduce any issue!
Page 7 of 7 FirstFirst ... 5 6 7
Results 151 to 160 of 160

Thread: Teensy Microphone Module

  1. #151
    Senior Member Davidelvig's Avatar
    Join Date
    Aug 2015
    Location
    Wisconsin
    Posts
    232
    I'm going to cherish the few Neutronned mics I have!

  2. #152
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    107
    I tried to follow this thread to a point, but I think I must have missed something (never tackled with mics and ADCs before).

    If we are talking about this module (electret mic + Max9814):
    https://learn.adafruit.com/adafruit-...ifier-max9814/

    would it not suffice to set the analog ref voltage for Teensy ADC to 3.3v (easy, since it has a 3.3v out pin), in order to capture the voltage range of the module without issues?
    Or even better, setting the aref to 2.0v should allow the ADC to exploit the full range of the module (0 - 2Vpp, 1.25V DC bias), right?
    So why the need for the alternate PCB?
    Please help me understand: I'm adding (low quality) voice notes to a project of mine (Teensy 3.5) and I was taking the linked Adafruit module into consideration for the job.

  3. #153
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    107
    Anyone, please? Sorry if it's a trivial question, just can't wrap my head around it.

  4. #154
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,006
    Quote Originally Posted by XFer View Post
    Anyone, please? Sorry if it's a trivial question, just can't wrap my head around it.
    from the description
    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.
    sure you can do it.
    you have two options on Vref (internal: 1.2V, or external: 3.3 V, or own voltage on AREF (IMO should be 2.5V for 1.25V bias), but needs good quality)
    if using 3.3V (default-external) you need to correct for bias shift from 1.25V to 1.65V)

  5. #155
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    107
    Thanks for chiming in!
    So the important point, to get good (recorded) audio quality from that mic, is having a good, stable, noiseless 2.5V AREF. Which indeed is not trivial.
    Not sure I get the point "need to correct bias 1.25->1.65 if using 3.3V AREF".
    In this case I would not exploit all the ADC range (only 0-2.0V over 0-3.3V, so upper bits would be always 0), but why a correction is needed?

  6. #156
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,006
    Quote Originally Posted by XFer View Post
    Not sure I get the point "need to correct bias 1.25->1.65 if using 3.3V AREF".
    Let's assume you the MIC has 0V which would be presented to ADC as 1.25 V.
    now, the ADC interprets the 1.25 as -0.4 V as the expected bias for 0V is 1.65V.

  7. #157
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,789
    Quote Originally Posted by XFer View Post
    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/40468...l=1#post130425
    https://forum.pjrc.com/threads/54022-ADC-questions

  8. #158
    Senior Member
    Join Date
    Oct 2015
    Location
    Roma (IT, EU)
    Posts
    107
    Much clearer now!
    Thanks to WMXY and manitou.

  9. #159
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,006
    Quote Originally Posted by manitou View Post
    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/40468...l=1#post130425
    https://forum.pjrc.com/threads/54022-ADC-questions
    but it is trivial to change in input_adc.cpp
    Code:
    	analogReference(INTERNAL); // range 0 to 1.2 volts
    to
    Code:
    analogReference(EXTERNAL); // range 0 to 3.3 volts
    otherwise, the reference thread is indeed valid.

  10. #160

    HAR a little frequency counter...in a plastic box.

    I whacked out a little tutorial for my kid on sunday afternoon......I used the T3.2 and a few components.....

    https://www.ebay.com/itm/Electret-Mi...le-Gain-2-4-5V


    https://www.ebay.com/itm/4-Digit-Sev...lay-Red-TM1637

    I didn't bother to adjust the gain on the mic.....Maybe I'll try this mic module........


    https://www.ebay.com/itm/MAX9814-Ele...plifier-Module

    Anyway, My kid needed to tune an instrument so... I put it in a box...

    https://www.ebay.com/itm/Hammond-1591ASBK-ABS

    with this code.... and it all fits in the little box....

    Code:
    #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
    }
    It is simple/and usable for a kid....

    maybe I'll post a pic....later....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •