Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: ICS43434 I2S Digital Microphone and Teensy 3.2

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    12

    ICS43434 I2S Digital Microphone and Teensy 3.2

    I have a ICS43434 I2S Digital Microphone (look here https://www.tindie.com/products/oneh...al-microphone/) and wired it as described:
    On the Teensy 3.2, pin 11 goes to the breakout board CLK (clock), pin 12 goes to the breakout board WS (word select), and pin 13 is the serial data out.

    If I use the example "PeakMeterMono" and set the input to I2S
    AudioInputI2S i2s1;
    AudioAnalyzePeak peak1;
    AudioConnection patchCord1(i2s1, peak1);

    or other examples (SpectrumAnalyzerBasic, FFT), I got no values from the microphone.

    Is the wiring correct?

    Is there any example, that's using the ICS43434 Microphone?

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,864
    Teensy Audio uses 16 bits and that mic :: outputs I2S audio as a stream of 24-bit

    opps ... See below ... there was a work around
    Last edited by defragster; 01-09-2018 at 04:40 PM.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    Quote Originally Posted by walpre View Post
    Is the wiring correct?
    Nope, that's definitely wrong. (the info on that product's page is incorrect) EDIT: OneHorse fixed his page. It now shows correct wiring suggestions.

    CLK connects to Teensy pin 9 (BCLK). WS connects to Teensy pin 23 (LRCLK). At least you've got the output right, it goes to pin 13.

    LR can be connected to GND or 3.3V, but it's not supposed to be left unconnected. Which way you connect LR determine whether the mic's sound will appear on the first or second output of the I2S. The AudioConnection you gave uses the first one only, giving you a 50-50 chance.

    Obviously GND and 3.3V need to be connected to GND and 3.3V on the Teensy, so the mic gets power. Use GND, not AGND.

    Documentation on the I2S connections can be found here (right side panel):

    https://www.pjrc.com/teensy/gui/?info=AudioInputI2S
    Last edited by PaulStoffregen; 01-09-2018 at 05:23 PM.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    Also make sure you have a recent version of Teensyduino. Click Help > About in Arduino (or Arduino > About on a Mac) to check.

    The I2S code was changed a while back specifically for compatibility with these MEMS mics. Older versions used a BCLK to LRCLK ratio of 32. This mic requires a ratio of 64, which is what the newer versions implement.

    If you have the older software where BCLK/LRCLK=32, this mic would never work no matter how to wire it up.

  5. #5
    Junior Member
    Join Date
    Dec 2017
    Posts
    12
    Thank you Paul, I've got the microphone running with these pin connections.

    I'm using the following code, to detect frequencies of tones. Frequencies approximately up to 15 kHz are detected right. If I set the output frequency to more than 15 kHz (e.g. 18 kHz), the detected value is ca. 5 kHz.
    The microphone should detect up to 20 kHz. Do you mean, this is a software or a hardware problem?

    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    
    // GUItool: begin automatically generated code
    AudioInputI2S            i2s1;           //xy=177,216
    AudioSynthWaveformSineHires sine_hires1;    //xy=183,212
    AudioEffectEnvelope      envelope1;      //xy=405,206
    AudioMixer4              mixer1;         //xy=637,227
    AudioOutputAnalog        dac1;           //xy=889,228
    AudioAnalyzeNoteFrequency notefreq1;      //xy=418,374
    AudioAnalyzeRMS          rms1;
    AudioConnection          patchCord1(i2s1, 0, notefreq1, 0);
    AudioConnection          patchCord5(i2s1, 0, rms1, 0);
    AudioConnection          patchCord2(sine_hires1, 0, envelope1, 0);
    AudioConnection          patchCord3(envelope1, 0, mixer1, 0);
    AudioConnection          patchCord4(mixer1, dac1);
    // GUItool: end automatically generated code
    
    void play_tone(float tone_frequency) {
      AudioNoInterrupts();
      sine_hires1.amplitude(1.0);
      sine_hires1.frequency(tone_frequency);
    
      // define envelope
      envelope1.attack(75);
      envelope1.hold(250);
      envelope1.decay(10);
      envelope1.sustain(0);
      envelope1.release(50);
    
      mixer1.gain(0, 1.0);
    
      envelope1.noteOn();
      AudioInterrupts();
    }
    
    void setup() {
      Serial.begin(9600);
      AudioMemory(30);
      dac1.analogReference(EXTERNAL);
      notefreq1.begin(.15);
      delay(1000);
    }
    float note, prob;
    elapsedMillis fps;
    void loop() {
      if (fps > 2000) {
        fps = 0;
        play_tone(15000);
      }
     if (notefreq1.available()) {
            note = notefreq1.read();
            prob = notefreq1.probability();
            Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob);
      }
      if (rms1.available()) {
            float volume_level = rms1.read() * 100.0;
            //Serial.printf("Volume level: %3.2f", volume_level);
            //Serial.print("Volume level: ");
            //Serial.println(volume_level);
      }
     
    }

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,355
    I sent an email to OneHorse. He has updated the product page with the correct wiring info.

Posting Permissions

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