Smart Doll Speaker
- Home
- portfolio
- Embedded IoT Solutions
- Smart Doll Speaker
01. A Journey from BLE to Wi-Fi for Seamless MP3 Encryption and Playback
Transferring encrypted MP3 files over Bluetooth sounded like a good idea—until we hit the wall of slow speeds and small data limits. But where BLE fell short, Wi-Fi stepped in to deliver the seamless, high-speed audio experience we were after.
In this project, we explored how to transfer encrypted MP3 files using Bluetooth Low Energy (BLE) to an ESP32, store them, decrypt them, and finally play the audio. We focused on understanding the limitations of BLE and finding solutions to improve data transmission and audio playback.
02. Things used in this project
Challenges: The rapid advancement of technology has increased the attack surface, making cybersecurity more challenging. Sophisticated threats like malware, ransomware, and phishing target individuals, businesses, and governments. Maintaining data privacy while managing diverse regulations adds complexity to creating a unified approach to cybersecurity.
Solutions: The Global Cybersecurity Network tackles these challenges through advanced encryption, secure communication, and effective threat detection systems. By uniting global experts, it fosters standardized practices, proactive defense, and adaptive solutions to emerging threats. This collective approach ensures robust data protection and a secure digital environment for all users.
03. Story
Sending Encrypted Data Over BLE
We started by transferring an encrypted MP3 file to the ESP32 over BLE. The data was stored in the ESP32’s file system, either in LittleFS or FAT. However, during this step, we ran into a key limitation of BLE—its ability to handle only small packets of data and the relatively slow speed of transmission. Despite these constraints, we were able to complete the transfer and save the file on the ESP32.
Saving Data to a Micro-SD Card
After transferring the file to the ESP32, we needed a better storage solution for larger files, so we saved the MP3 onto a micro-SD card using an SD card adapter. This allowed us to store more data than the ESP32’s internal memory could handle and provided a convenient way to manage the file outside of the ESP32.
Decryption and Audio Playback
Next, we decrypted the MP3 file. After decryption, the digital audio data was converted to an analog signal using the ESP32’s DAC (Digital-to-Analog Converter). This signal was then passed to an amplifier. We first tested the playback on headphones connected to the ESP32 via an audio jack, followed by playing the audio through a speaker. Both tests confirmed that the decryption and playback processes were working correctly.
Moving to Wi-Fi for Faster Data Transfer
After testing the BLE-based system, we identified a major issue—BLE’s slow transfer rate made it impractical for handling large files. To address this, we switched to Wi-Fi for faster data transmission. Wi-Fi allowed us to send larger chunks of data quickly, which significantly improved the overall performance of the system.
Adding Audio Recording Functionality
With Wi-Fi in place, we expanded the system by adding a microphone for recording audio. The recorded audio was saved in a .wav format, and we knew that handling recorded audio required careful attention to ensure the sample rates were accurate. Debugging this process on the ESP32, however, was challenging. We needed to determine whether the microphone was capturing the audio correctly or if there was an issue during processing.
To simplify troubleshooting, we transferred the recorded .wav file to a PC, where it was easier to play the audio and verify the sample rates and recording quality. Once we confirmed the recording was accurate, we returned to the ESP32 to focus on the DAC and amplification process.
Implementing Push Button Controls
We added several push buttons to control the system’s audio functions. These buttons allowed us to:
- Start and stop audio playback
- Pause and stop audio
- Record and stop recording
- Turn Wi-Fi on and off
- Adjust volume levels
- Power the system on and off
These controls made it easier to operate the system without needing direct access to the code or manual intervention.
This project demonstrated how to handle encrypted MP3 file transfers, storage, decryption, and audio playback on the ESP32. While BLE served as the initial data transfer method, its slow speed and small data packet limitations prompted us to switch to Wi-Fi, which improved data handling significantly. Along with these core functions, the project also included audio recording and added push-button controls to simplify interaction with the system.