This is an old revision of the document!
| Name | Giurgiu Andrei-Ștefan |
|---|---|
| Group | 335CA |
The project consists of creating a karaoke mechanism, using a speaker for the instrumental and an LCD screen for the lyrics. The user can choose from a preset selection of songs, loaded on a microSD card. The songs which are listed at the beginning on the screen, can be selected using buttons. The speaker volume can also be adjusted using a potentiometer.
The goal of the project is to create a relaxing and fun atmosphere for the users.
The ESP32 is the main component of the project, since it will be in charge of reading data from the card and send the audio signal to an amplifier using the I2S protocol.
The MAX88357A amplifier will take the digital signal from the ESP32 and transform it into a strong analogue signal. After this the sound will be sent to the speaker.
The main storage component is a 16GB microSD card, formatted as Fat32. The instrumental files are stored in the .mp3 format and the lyrics files in the .lrc format, which is a text format with timestamps before the text, so that syncing with the instrumental is easier.
The user interface is made of three classes of components: the 20×4 LCD display with an I2C interface, the volume adapter and the buttons. The display is a simple LCD with an I2C module attached, which at the beginning will show the available songs on the device. Using the buttons, the user can select a song and play it.
The list of components used is:
| Component | Pin Name | Connected To | Reason |
|---|---|---|---|
| ESP32-DEVKITC-32D | 3V3 | Potentiometer (Top Pin) | Provides a safe 3.3V reference. Crucial: Using 5V here would fry the ESP32's ADC pin. |
| IO34 | Potentiometer (Wiper) | ADC input to read the voltage (0-4095) for software volume control. | |
| IO27 | PLAY/PAUSE BUTTON | GPIO input to control the taskAudio state. |
|
| IO14 | UP BUTTON | GPIO input for navigating the .mp3/.lrc file list on the LCD. | |
| IO13 | DOWN BUTTON | GPIO input for navigating the .mp3/.lrc file list on the LCD. | |
| GND | Common GND | The most important connection! Ties all voltage potentials together so data signals have a solid reference point. | |
| 5V | Not Connected | Power is supplied by the MB102 to avoid overloading the ESP32's internal voltage regulator. | |
| IO23 | Micro SDHC reader (MOSI) | SPI Master Out Slave In: Sends commands to the SD card. | |
| IO22 | PCF8574 (SCL) | I2C Clock line to synchronize data sent to the LCD. | |
| IO21 | PCF8574 (SDA) | I2C Data line to send lyrics and menu text to the LCD. | |
| IO19 | Micro SDHC reader (MISO) | SPI Master In Slave Out: Reads audio/text data from the SD card. | |
| IO18 | Micro SDHC reader (SCK) | SPI Clock line to synchronize SD card data transfers. | |
| IO5 | Micro SDHC reader (CS) | SPI Chip Select: Activates the SD card reader when the ESP32 needs to talk to it. | |
| IO16 | MAX98357A (DIN) | I2S Data Out (DOUT): Sends the digital audio stream to the amplifier. | |
| IO26 | MAX98357A (BCLK) | I2S Bit Clock: Sets the rhythm for the audio data bits. | |
| IO25 | MAX98357A (LRC) | I2S Left/Right Clock (Word Select): Tells the amp which audio channel is currently being sent. | |
| MB102 Power Supply | VCC2 | ESP32 (5V), MAX98357A (Vin), PCF8574 (VCC), Micro SDHC reader (VCC) | Provides heavy-duty 5V power to the power-hungry components (Amp and SD reader), ensuring clean audio and no processor resets. |
| GND | Common GND | The foundation of the circuit's grounding. | |
| VCC1 | Not Connected | Second power rail is not needed for this build. | |
| MAX98357A | LRC | ESP32 (IO25) | Receives the Left/Right channel timing from ESP32. |
| BCLK | ESP32 (IO26) | Receives the data rhythm timing from ESP32. | |
| DIN | ESP32 (IO16) | Receives the actual digital MP3 audio data. | |
| GAIN | Common GND | Ties the pin low to set a 12dB gain and stops it from acting like an antenna, eliminating background “hiss” / purici. | |
| SD | Not Connected | Left floating, it defaults to ON. | |
| GND | Common GND | Completes the power circuit and provides audio ground reference. | |
| Vin | MB102 (VCC2) | Receives 5V to drive the speaker at maximum safe volume. | |
| + | Speaker (+) | Outputs the amplified analog audio wave (positive). | |
| - | Speaker (-) | Outputs the amplified analog audio wave (negative). | |
| PCF8574 | VCC | MB102 (VCC2) | 5V logic and backlight power for the LCD display. |
| GND | Common GND | Completes the power circuit for the LCD backpack. | |
| SDA | ESP32 (IO21) | Receives text data via I2C. | |
| SCL | ESP32 (IO22) | Receives the I2C clock signal. | |
| Micro SDHC reader | CS | ESP32 (IO5) | Listens for the ESP32 to activate it via SPI. |
| SCK | ESP32 (IO18) | Receives the SPI clock signal. | |
| MOSI | ESP32 (IO23) | Receives file read/write commands from the ESP32. | |
| MISO | ESP32 (IO19) | Sends the read files (.mp3, .lrc) back to the ESP32. | |
| VCC | MB102 (5V) | Dedicated 5V power (SD cards can draw spikes of 100mA+ while reading, which could crash the ESP32 if powered directly from it). | |
| GND | Common GND | Completes the power circuit. | |
| Potentiometer | Top Pin | ESP32 (3V3) | Limits the maximum voltage across the resistor to 3.3V (safe for ESP32). |
| Wiper | ESP32 (IO34) | Slides between 0V and 3.3V, sending the current value to the ESP32 ADC. | |
| Bottom Pin | Common GND | Grounds the other side to complete the voltage divider. | |
| PLAY/PAUSE BUTTON | Pin 1 | ESP32 (IO27) | Connects to the GPIO to trigger an interrupt or state change. |
| Pin 2 | Common GND | Pulls the GPIO to LOW when pressed (assuming internal pull-up). | |
| UP BUTTON | Pin 1 | ESP32 (IO14) | Connects to the GPIO to trigger an interrupt or state change. |
| Pin 2 | Common GND | Pulls the GPIO to LOW when pressed. | |
| DOWN BUTTON | Pin 1 | ESP32 (IO13) | Connects to the GPIO to trigger an interrupt or state change. |
| Pin 2 | Common GND | Pulls the GPIO to LOW when pressed. | |
| Speaker | + | MAX98357A (+) | Receives the positive audio signal. |
| - | MAX98357A (-) | Receives the negative audio signal. |
Under construction.
This project will be developed using the PlatformIO extension in Visual Studio Code. I will use Arduino for the main framework. Other libraries that will be included are:
.mp3 filesIn order to not have glitching or interrupting music, I decided to use FreeRTOS tasks for my project. There will be three main tasks:
More details after I finish implementing the firmware.
To be determined after Software Milestone.
To be determined after Software Milestone.
Click here.
| Component | Link Datasheet |
|---|---|
| ESP32-WROOM-32D | Datasheet microcontroller |
| Amplifier MAX98357A | Datasheet MAX98357A |
| LCD 20×4 | Datasheet display |
| MB102 Power supply module | Datasheet MB102 |
| MicroSDHC reader module | Datasheet MicroSDHC |