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

Thread: Can I put an audio shield on this setup?

  1. #1
    Junior Member
    Join Date
    Mar 2020

    Can I put an audio shield on this setup?


    I'm new to microcontrollers and I'm quite impressed with the Teensy 4.

    I'm working on an audio visualization project, where I have four INMP441 microphones connected to the Teensy's two I2S interfaces and an Adafruit ILI9340C 320x240 display on SPI (see ASCII & PNG images). I'm glad that so far everything works fine.

                         +---------------------------------- SCK--| I2S1
                         |  +------------------------------- WS---| (2x INMP441)
                         |  |                             +- SD --|
                         |  |                    +-----+  |
                         |  |                    |     |  |
       +-----------------|--|--------------------|--+  |  |
       |  V  G  3 23 22 21 20 19 18 17 16 15 14 13  |  |  |
       |  i  N  V                                   |  |  |
       |  n  D  3                                   |  |  |
       |                                            |  |  |
       |    Teensy 4.0 MCU                          |  |  |
       |                                            |  |  |
       |  G                                         |  |  |
       |  N                                         |  |  |
       |  D  0  1  2  3  4  5  6  7  8  9 10 11 12  |  |  |
       +-----------|--|--|--|--------|--|--|--|--|--+  |  |
                   |  |  |  |        |  |  |  |  |     |  |
                   |  |  |  |        +--|--|--|--|-----|--+
                   |  |  |  |           |  |  |  |     |
                   |  |  |  |           |  |  |  |     +-- SCK---| TFT
                   |  |  |  |           |  |  |  +-------- MISO--| (Adafruit
                   |  |  |  |           |  |  +----------- MOSI--|  ILI9340C
                   |  |  |  |           |  +-------------- CS----|  320x240)
                   |  |  |  |           +----------------- DC----|
                   +--|--|--|----------------------------- RST --|
                      |  |  |
                      |  |  +----------------------------- SD----| I2S2
                      |  +-------------------------------- SCK---| (2x INMP441)
                      +----------------------------------- WS----|
    Click image for larger version. 

Name:	breadboard.jpg 
Views:	5 
Size:	180.0 KB 
ID:	19478

    For diagnosis & latency measurements, I would like to add audio output to this setup. I have an Audio Shield which works well on its own but I'm reluctant to just plug it on top of this setup since the audio shield seems to need most of the pins I already use for the hardware currently connected.

    So: will putting an audio shield on top of the Teensy work as long as I only use the audio shield's headphone and/or line-out ports for output?

    If this is possible, is there anything I should be aware of when doing so?

    Thanks for taking the time reading this!

    PS: if anyone is inclined to answer, I have a few follow-up questions that
    don't seem to deserve their own thread:

    1. Do I risk to fry the teensy, audio shield or display if I plug them in incorrectly (As long as I power the teensy using USB and make sure to only use the Teensy's 3.3V output for powering any peripherals)?
    2. Should I connect the display's only unused input port (SD Card Chip Select) to anything?
    3. Is there any chance to use SD storage later on (via audio shield or display)? If yes, which SD card reader (audio shield or display) would be preferrable?
    4. The display's brightness drops significantly in the first second when powered via USB. Would a different power supply be preferrable? (I don't do PWM backlight control, I just power the display with the Teensy's 3.3V output pin in the hope that I don't exceed the 250 mA stated in the documentation.

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Ayer Massachussetts


    A few minor thoughts. Note, I am not an expert on this:

    The Adafruit ILI9340C display can take 3-5v power on VIN. You could hook the VIN pin to the display instead of the 3.3v pin. This would bypass the Teensy's 3.3v regulator and pull more directly from the main power source (note it still will go through the 500ma fuse the Teensy has been VIN and VUSB, but it should give you a little more breathing room).

    There exist I2S output devices that you could hook up. You would need to connect pins 21 (BCLK1), 20 (LRCLK1), 7 (OUT1A), and VIN/GROUND. For mono sound including an amplifier, I've used ( For stereo sound that needs an external amplifier (

    The Teensy 4 does have 5 pins to use for I2S inputs and outputs (besides the common MCLK1, BCLK1, and LRCLK1). Right now these are pin 6 (OUT1D), pin 7 (OUT1A), pin 8 (IN1), pin 9 (OUT1C), and solder pad 32 (OUT1B). IIRC, you can change what these pins do by diving into the I2S internals.

    The Teensy 4 audio shield does have 2 inputs with 4 pins (R/G and L/G). Perhaps plug your two inputs into that instead of using separate I2S inputs.

    An alternative for sound output that is recently enabled in the 1.52 beta 1 is S/PDIF (pins 14/15). I don't know anything about this. I think FrankB is the expert.

    I suspect using the SD card on the display would be simplest. That would allow you to explore other alternatives than the audio shield. You would hook up the SD card pin to any open digital pin. I would hope that the display has the necessary pull-up resistors to allow both the display and SD card to be used on the same SPI bus at the same time. An alternative is to use one of the breakout boards to be able to use the SD breakout solder pads on the bottom of the Teensy. Note, you will need to do some small scale (1mm) soldering to connect things.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Good news, 1.52-beta1 supports 4, 6 and 8 channel I2S input. More good news, the BCLK/LRCLK ratio is 64 (unlike Teensy 3.x quad I2S) so you can use it for those mems mics.

    So you can connect all this stuff to the main I2S port. In your code, just change AudioInputI2S to AudioInputI2SHex. It will still receive the first 2 channels on pin 8, from the audio shield. Then you would connect your first 2 mics to pin 6 and the other 2 to pin 9. Of course, also use the normal I2S stereo output, which transmits to the audio shield using pin 7.

  4. #4
    Junior Member
    Join Date
    Mar 2020


    Thank you guys so much!

    It took me a while to implement, but now everything works great! I went with the I2SHex version after cloning the current version of the Audio repository.

    I use PlatformIO, so I had to download and extract Teensyduino and replace the older core/ directory provided by PlatformIO with the newer one from Teensyduino.

    @Michael, your post helped me realize that I can supply the same clock lines to all four microphones - this saves me two wires which is great. The breadboard looks a lot cleaner now as well.

    Click image for larger version. 

Name:	breadboard.jpg 
Views:	2 
Size:	177.7 KB 
ID:	19488

    The brightness-issue resolved itself after changing the wires to the display. I assume, I had a flaky connection somewhere.


Posting Permissions

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