Group assignment
Individual Assignment
The main objective for this week was to read and play music from an SD card, and control playback (forward/rewind/speed) based on the rotation of a physical disk. This mimics a DJ-style interaction, where the motion of a disk directly affects the music playback.At the beginning, I explored ready-made MP3 player modules such as the DX player. However, I found that:
It could only play / pause / skip tracks
It did not support variable speed playback
It could not rewind or scrub audio dynamically
Since my project requires real-time control of playback speed, this approach was not suitable. Next i searched about different amplifiers & modules.
MAX98357A
imgWhat is MAX98357A?
It is a tiny chip/module that lets your microcontroller (like Arduino or ESP32) play sound through a speaker.Datasheet
It does two main jobs:
1. Converts digital audio → analog sound
Your ESP32 sends audio in a digital format called **I2S** (a special audio data format).
2. Amplifies the sound
The signal is too weak by itself, so the MAX98357A boosts it enough to drive a speaker directly.
What is I2S?
I2S (Inter-IC Sound) is a way for chips to send audio data to each other digitally.I2S controller has the following features that can be configured by the I2S driver:
- Operation as system master or slave
- Capable of acting as transmitter or receiver
- DMA controller that allows stream sampling of data without requiring the CPU to copy each data sample
Wires:
- BCLK → beat clock
- LRC / WS → tells Left or Right audio
- DIN → actual audio data
Cordless motor
imgSince i need to rotate the disk like in a dj set , i need to add a motor. Here my instructor suggested to use a cordless motor which runs on 3.7v as it is small in size and also is apt for rotating the disk.
Single H bridge IC
What is IC? An IC (Integrated Circuit)** is a tiny electronic circuit built into a small chip** that can perform specific functions.What is a H-bridge and why do we need it?
An H-bridge is a circuit shaped like the letter **“H”**, made of switches (transistors inside the IC). It allows you to:
- Rotate a motor forward
- Rotate it backward
- **Stop** it
- Sometimes even **brake** it
A single bridge IC controls 1 motor while a double bridge motor controls 2.
How does it work?
Think of 4 switches:
- Turn ON one pair → motor spins forward
- Turn ON the opposite pair → motor spins reverse
- Turn OFF all → motor stops
The advantage of using an IC H Bridge is that these switches are handled for you inside the IC and you do not have to built the circuit piece by piece.
Here, i am using L91105
imgNow, after going through its datasheet we found out that it does not have any PWM pins, but can imitate it using it’s IA and IB pins as follows:
XIAO ESP32S3
The ESP32-S3 has a dual-core 240MHz processor which is powerful enough to decode MP3 files in real time entirely in software. Simpler microcontrollers like ATtiny
or SAMD21 cannot do this they lack both the processing speed and RAM required. The main reason is its SPI for SD card, and it's built-in I2S support,
which is the exact protocol my amplifier needs to receive.Diagrams
Next i drew the schematic diagram and the PCB diagram:
Then i milled the PCB:
This is how the complete milled PCB looked :
Then i assembled the needed components
and soldered the PCB
Programming
First i tried to read the sd card from the esp32s3 i followed this Website
I wasn't able to get it right eventhough my code was fine. most probably due to loose connection.but in the end i got it right:
Conclusion
Final Files
PCB FilesCode File