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

Thread: Teensy 4 i2c FFT -> no data

  1. #1

    Teensy 4 i2c FFT -> no data

    Hello! I recently encountered a bit of a problem while trying to get audio visualization work. When I bought the Teensy 4 I did not know the extend of the audio library coverage. Because the ADC is not set up for the Teensy 4, I ordered a SPH0645 I2S MEMS Microphone Breakout Sensor Board. It came in the other day, but I can't seem to get anything out of it. Furthermore, I can't seem to get FFT out of a sine wave mixed into the same signal, so I'm not sure what is happening.

    What I have:
    1. Teensy 4.0 (and an UNO for testing)
    2. SPH0645 (I also have a electret BOB)
    3. Lots of extra parts.

    I have tried:
    1. Looking for posts with these pieces of hardware. All of the results seemed to be with a different Teensy board, or using the audio shield.
    2. This code with the hardware connected like this.
    3. The same sketch with and without the sine wave. All readings are 0.00.
    4. The same sketch with if(fft256.available()).

    Design requirements:
    1. It needs to be small, so the audio shield is not an option.
    2. FFT data does not need to be precise. Audio input does not need to be precise.

    Please let me know if you have any ideas on how to get this all working. I tried to put down everything that might be relevant, but if I missed something I can add it. Thanks a bunch for taking a look at this!

  2. #2
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    7,065
    You have no Audio Memory in your Sketch.

  3. #3
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,488
    You also haven't set the amplitudes of the three inputs to the mixer.

    Pete

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,488
    Try adding these at the beginning of the setup() function:
    Code:
      AudioMemory(8);
      mixer.gain(0,0.5);
      mixer.gain(2,0.25);
      mixer.gain(3,0.25);
    Even if there's not much contribution from the i2s input, the sine wave should definitely show up - if you've chosen the correct range of bins to print.

    Pete

  5. #5
    Whoops! I added:

    AudioMemory(8);
    mixer.gain(0, 1);
    mixer.gain(1, 1);
    mixer.gain(2, 1);
    mixer.gain(3, 1);

    to the setup line and I seem to be getting some data now. Thanks for the help!

    edit: It looks like there is data from the sine wave, but no data coming from the i2s. It's too bad I can't use the basic analog mic.
    Last edited by MSO; 03-14-2020 at 02:50 AM.

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,488
    The sine wave is probably going to be very loud compared to audio from i2s. You would also be best to make the sum of the amplitudes in the mixer equal to one as I did - i.e. 0.5+0.25+0.25.
    You don't need to set an amplitude for input 1 on the mixer because you haven't connected anything to it.

    Try reducing the amplitude of the sine wave into the mixer and increasing the i2s. Try this:
    Code:
      mixer.gain(0,0.2);
      mixer.gain(2,0.4);
      mixer.gain(3,0.4);
    Pete

  7. #7
    Thanks for the help. I've toyed around with a few values and using the values suggested I get output, but when I reduce the gain of the sine wave to zero there output drops to zero. I don't want to have a sine wave in the final output, but I just wanted to make sure that the FFT was working at all. I've been digging through the documentation for the board and I've tried tons of wire configurations. I'm hoping I don't have a dud of a mic, but it's hard to rule out.

  8. #8
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,488
    I haven't used an I2S MEMS microphone so I can't help with that.
    I notice in your photo that you are using the jumper wires with round ends. It has been my experience that those are not particularly reliable and the end which fits into the breadboard is actually too narrow to make a good connection. If you have some thicker wire, it would be a good idea to rewire all the connections.

    Pete

  9. #9
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,898
    Your I2S MEMS is connected wrong for T4.0.
    It seems you used the suggested pins for T3, that are different to T4

    From T4 pin card I deduce

    LRCLK to Pin 20
    BCLK to Pin21
    DOUT to Pin8

  10. #10
    That did it! I didn't know what to look for on the card. Thanks for take a look for me. I appreciate it.

Posting Permissions

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