Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP32-Based Audio Player with GPS and SD Card Storage

View and Edit Project In Cirkit DesignerImage of ESP32-Based Audio Player with GPS and SD Card Storage

Circuit Documentation

Summary

This circuit integrates an ESP32 microcontroller with various peripherals including a GPS module (GPS NEO 6M), a digital microphone (INMP441 FRONT MIC), an I2S audio amplifier (Max98357), a microSD card breakout board (Adafruit MicroSD card breakout board), and a loudspeaker. The ESP32 is responsible for processing audio data from the microphone, interfacing with the GPS module, controlling the audio output through the I2S amplifier to the loudspeaker, and reading/writing data to the microSD card. The circuit is designed to provide audio feedback via text-to-speech, record audio data, and track GPS location.

Component List

ESP32

GPS NEO 6M

INMP441 FRONT MIC

Max98357

Adafruit MicroSD card breakout board

Loudspeaker

Wiring Details

ESP32

GPS NEO 6M

INMP441 FRONT MIC

Max98357

Adafruit MicroSD card breakout board

Loudspeaker

Documented Code

sketch.ino

#include <google-tts.h>
#include <Adafruit_ZeroI2S.h>

// Pin definitions for I2S and MAX98357
#define I2S_DOUT 22   // Data Out to DIN on MAX98357
#define I2S_BCLK 26   // Bit Clock to BCLK on MAX98357
#define I2S_LRC 14    // Left Right Clock to LRC on MAX98357

void setup() {
  Serial.begin(115200);

  // Initialize I2S for MAX98357
  if (!I2S.begin(I2S_PHILIPS_MODE, 16000, 16)) {
    Serial.println("Failed to initialize I2S!");
    while (1);
  }
  
  // Set up I2S pins
  I2S.setPins(I2S_BCLK, I2S_LRC, I2S_DOUT);

  // Initialize Google TTS
  if (!GoogleTTS.begin()) {
    Serial.println("Failed to initialize Google TTS!");
    while (1);
  }
}

void loop() {
  // The text you want to convert to speech
  String textToSpeak = "Hello, this is your ESP32 speaking!";
  
  // Request Google TTS to convert text to audio
  GoogleTTS.speak(textToSpeak);
  
  // Optional: Wait before repeating or exit loop if only one-time play needed
  delay(10000);  // Wait 10 seconds before repeating
}

documentation.txt

No additional documentation provided for the code.