The 8002A audio amplifier module is a high-performance mono Class D amplifier module that supports a wide voltage supply (2.5-5.5V) and delivers a maximum output power of 3W (THD<10%). It features built-in adaptive filtering technology and overcurrent protection circuitry, with a total harmonic distortion of ≤0.3% and a signal-to-noise ratio of ≥90dB. It is suitable for portable devices such as Bluetooth speakers and smart home products.
Digital To Analog Converter (DAC) - ESP32 - — ESP-IDF Programming Guide v5.5.3 documentation
The DAC only supports an 8-bit digital-to-analog converter, mapping digital values from 0 to 255 to an analog voltage ranging from 0 to Vref;
The ESP32 has only two DAC channels, located on GPIO25 (Channel 1) and GPIO26 (Channel 2);
They cannot be used concurrently with I2S.
| 8002A AMP Speaker Module | ESP32 |
|---|---|
| G | G |
| V | 3.3V |
| S | GPIO25 or GPIO26 |
After burning the example program onto the ESP32 development board, you can hear the custom audio being played.
How to convert the encoding?
-
Install FFmpeg. click to download the corresponding version.
-
Configure the FFmpeg environment variables, and then execute the following command in the CMD command line:
ffmpeg -y -i input.mp3 -acodec pcm_s16le -f s16le -ac 1 -ar 16000 output.pcmParameter breakdown:
a. -y
* Automatically overwrite output files without confirmation.
b. -i input.mp3
* Specifies the input file as `input.mp3`.
c. -acodec pcm_s16le
* Sets the audio codec to PCM 16-bit signed integer.
* `s16le` = signed 16-bit little-endian.
d. -f s16le
* Forces the output format to be raw PCM (without a file header).
* Consistent with the codec, ensuring output of pure audio data streams.
e. -ac 1
* Sets the number of audio channels to 1 (mono).
* If the input is stereo, it will be downmixed to mono.
f. -ar 16000
* Sets the audio sampling rate to 16000Hz (16kHz).
g. output.pcm
* Output filename.
-
Convert the output
output.pcmfile into a C language format header file. It is recommended to use the xxd dump tool. Command:xxd -i -C ./output.pcm pcm.h -
Open the generated pcm.h file, replace the variable names in pcm.h with kPcmData, save the file, and replace the pcm.h in the example.Upload a case and you can play a customized audio file.


