Skip to content

I2S ADC for Line-In

If you want the best experience, then Line-In using I2S will give the best quality. As you are getting a clean audio feed, then the squelch value should be set to 1

Looking to add line-in with I2S support? You might want to try I2S ADC boards that use one of these chips: * CirrusLogic WM8782 * CirrusLogic CS5343 * AKM AK5720 (datasheet) * Ti PCM1808 or Ti PCM1802 * ES8388 * WM8978

Many I2S ADC boards expect an additional MCLK signal ("Main Clock" aka "System Clock" aka "Master Clock" aka "Memory Clock"). MCLK is sometimes labelled SCLK for "system clock". For these boards with 4 data pins, use our Generic I2S with MCLK input driver, and connect MCLK pin to GPIO pin 0, 1, or 3 on ESP32.

Pmod I2S2

https://digilent.com/reference/pmod/pmodi2s2/start

   

Buy: AliExpress

  • Remove jumper from MLCK
  • DIP SWITCH - SLAVE

TI PCM1808

   

Buy: Amazon or AliExpress

Top side: Right audio input, Audio Ground, Left audio input.

Right side: The I2S connections -

  • BCK = I2S SCK
  • OUT = I2S SD
  • LRC = I2S WS
  • SCK = I2S MCLK (master clock)
  • Ground
  • 3.3v input

Left side: Format, Mode selector 0, Mode selector 1, ground, 3.3v input, and 5v input.

In WLED it's "Generic I2S with Mclk". You have 3 choices of what MCLK pin you can use - 0, 1, and 3. Pin 0 highly recommended as 1 as 3 may already be in use

5v seems to NEED to be connected. You can connect it to 3.3v but it will glitch randomly. Put that pin on 5v for best function. 3.3v and ground are connected to the same pins on the right side, so you just need to connect one of each, on either side.

MD1 and MD0 set master/slave modes. It defaults to slave (both pins are internally set to low), which is what you want for WLED. Don't connect these to anything.

FMY (format, FMT in the spec sheet - I assume the "Y" is a typo on the silkscreen) is a bit more interesting. By default it's pulled low internally, which the docs claim to be "I2S, 24-bit" - which will work fine as a default.

...however, pulling FMY "high" (connected to 3.3v) seems to make everything better in WLED. According to the spec sheet, this moves the entire 24 bit sequence one pulse earlier ("left justified") and the responsiveness seems to be better overall in WLED. The GEQ visual output is more "balanced" with the highs being better represented. The format of the 24 bits is unchanged - both are MSB first - but it seems to be better in WLED when the pin is pulled high.

ES8388

This audio chip reqires I2C commands to initialize properly. "Line-in mode" has been hard-coded into the initialization and will be used when "ES8388" is selected.

The on-board microphones are not currently supported - line-in is much better regardless.

Line-in should be internally routed to line-out, allowing these boards to be used in the middle of a line-level signal path.

Pin Config

The LyraT v4.3 and some AiThinker v2.2 boards use the following pin config:

  • Type: ES8388
  • IS2 SD = 35
  • I2S WS = 25
  • I2S SCK = 5
  • I2S MCLK = 0
  • I2C SDA = 18
  • I2C SCL = 23

If the above doesn't work for AiThinker v2.2 boards use a chip with the following pins, use if you see errors about I2C:

Note: the underside of ESP32 overhang shows ESP32-A1S B221 and B238 on two boards with this config - the "B" or "B2" may be hints as to revision.

  • Type: ES8388
  • IS2 SD = 35
  • I2S WS = 25
  • I2S SCK = 27
  • I2S MCLK = 0
  • I2C SDA = 33
  • I2C SCL = 32

WM8978

This audio chip reqires I2C commands to initialize properly. "Line-in mode" has been hard-coded into the initialization and will be used when "WM8978" is selected.

The on-board microphones are not currently supported - line-in is much better regardless.

Support for the WM8978 chipset is derived from the Puca DSP board:

image

Curently the Puca DSP on-board microphones may leak some sound in extremely loud environments, but the line-in will overpower this signal when presented. This is being investigated.

Line-in should be internally routed to line-out, allowing this board to be used in the middle of a line-level signal path.

Pin Config

The Puca DSP board pins are as follows:

  • Type: WM8978
  • I2S SD = 27
  • I2S WS = 25
  • I2S SCK = 23
  • I2S MCLK = 0
  • I2C SDA = 19 (set in global)
  • I2C SCL = 18 (set in global)