Close

ESP32 with SGTL5000

A project log for digital-walkie-talkie

long range, low power, modular

christoph-tackChristoph Tack 01/03/2021 at 14:360 Comments

Hardware

The SGTL5000 uses a virtual ground for the audio outputs.  This likely makes it unsuitable for use in smartphone headsets in which the ground of the microphone is shared with the audio output.  To be tested.

  1. NodeMCU-32S
  2. Adafruit 1780 : Adafruit Accessories Audio Adapter Board for Teensy

Generating I2S

The annoying thing about the Adafruit audio adapter is that it's not fully open source.  These are the supply voltages:

https://cdn.hackaday.io/images/6563761610045017903.png
I2S standard format : data is one bit delayed with respect to WS edges.

On the SGTL5000 datasheet, this is the one bit delay on I2S format with respect to the left-justified format on Figure 10. I2S Port Supported Formats.  This seems to be normal I2S behavior. 

The delay could be removed by setting the i2s_comm_format_t in the ESP32 to 0, but I'll just leave it to the standard setting.

The SGTL5000 considers the 16bit data as signed format.  It's analog output is inverted, which actually doesn't matter much for audio.  Voutmax corresponds to 0x8000 = -32768, while Voutmin corresponds to 0x7FFF = 32767).

The sample code to generate a 200Hz sine wave on the left channel of line-out and headphone can be found here.

References

  1. SGTL5000 driver on Github (by PJRC)
  2. Interfacing an audio codec with ESP32 – Part 1 and Interfacing an Audio Codec with ESP32 – Part 2
  3. Audio Adaptor Boards for Teensy 3.x and Teensy 4.x
  4. ESP32 I2S Internet Radio (with software MP3 decoding inside ESP32)
  5. esp32_audio
  6. ESP32-2-Way-Audio-Relay

Discussions