β οΈ Caution!! This project is currently Work in Progress (WIP).
Features, APIs, and structure may change rapidly until the first stable release.
This project is a highly modular, configurable, and extensible firmware for ESP8266/ESP32 microcontrollers designed to control audio ICs like TDA7439, PT2313, PT2322, and others via I2C. It features support for physical button control, LCD displays, web UI (future), EEPROM/Flash settings storage, and preset management β all following clean architecture, SOLID principles, and professional coding practices.
- β
Audio IC Control
- Volume, Bass, Treble, Balance, Loudness, Input Selection
- β
Hardware Abstraction Layer (HAL)
- Abstracts I2C, EEPROM, Logging, Display, etc.
- β
Drivers Layer
- Drivers for audio ICs (e.g., TDA7439) with clean APIs
- β
UI/UX Support
- Physical buttons and 16x2 I2C LCD
- Future-proof for Web UI
- β
Configuration Management
- No hardcoded pins, fully configurable
- Settings stored in EEPROM/Flash with CRC validation
- β
Presets Management
- Save and switch multiple audio presets
- β
Centralized Logging
- Supports different log levels with tagged logs
- β
Error Handling
- Error codes, retries, fallback handling for I2C failures
- β
Cross-Platform Support
- Works with both ESP8266 and ESP32
- β
Storage System
- Binary data storage with integrity checks
ESP8266-ESP32-AudioSystem/
β
βββ boards/ β Board-specific configurations
βββ config/ β Default and custom configurations
βββ core/ β Core logic (SettingsManager, Logger, I2CManager)
βββ drivers/
β βββ audio/ β Audio IC drivers (e.g., TDA7439.cpp)
βββ filesystem/ β Persistent storage handling (EEPROM/Flash)
βββ hal/ β Hardware Abstraction Layer (I2C, Display, etc.)
βββ presets/ β Preset management (save, load)
βββ services/ β Business logic services (AudioService, etc.)
βββ ui/
β βββ display/ β LCD UI
β βββ web/ β Future Web UI
βββ utils/ β Utilities (CRC, helpers)
βββ include/ β Header files
βββ src/ β Main application entry point
βββ platformio.ini β PlatformIO build configuration
βββ README.md β This file
Microcontroller | Supported |
---|---|
ESP8266 (NodeMCU, Wemos D1) | β |
ESP32 (DevKit, Wroom, Wrover) | β |
Audio IC | Status |
---|---|
TDA7439 | β Complete |
PT2313 | π Planned |
PT2322 | π Planned |
UI | Status |
---|---|
16x2 LCD (I2C) | π (Planned) |
Web UI | π (Planned) |
Push Buttons | π (Planned) |
- PlatformIO with VSCode (Recommended)
- ESP8266 or ESP32 board
- Audio IC (e.g., TDA7439) wired over I2C
- Optional: 16x2 I2C LCD Display, push buttons
- Clone the repo:
git clone https://github.com/Arun-R-S/ESP8266-ESP32-AudioSystem.git
cd ESP8266-ESP32-AudioSystem
-
Install dependencies via PlatformIO (auto resolves).
-
Edit
platformio.ini
to select your board. -
Configure pins and settings:
// config/BoardConfig.h
#define I2C_SDA_PIN D2
#define I2C_SCL_PIN D1
#define LCD_ADDRESS 0x27
#define AUDIO_I2C_ADDRESS 0x44
- Build and upload:
pio run --target upload
- Open serial monitor:
pio device monitor
- Adjust Volume:
AudioService.SetVolume(10);
- Change Bass:
AudioService.SetBass(5);
- Switch Input:
AudioService.SetInput(2);
- Save Preset:
PresetManager.SavePreset(1);
- Load Preset:
PresetManager.LoadPreset(1);
// config/SettingsStruct.h
struct AudioSettings {
uint8_t volume;
uint8_t bass;
uint8_t treble;
uint8_t balance;
bool loudness;
uint8_t inputSource;
};
- Settings are stored in Flash/EEPROM with CRC32 validation.
- On corruption, factory defaults are restored.
- Supports versioning for future updates.
- Log Levels:
DEBUG
,INFO
,WARN
,ERROR
- Usage:
Logger(INFO, "Audio", "Volume set to %d", volume);
- Retry mechanism on I2C failures.
- Return error codes for hardware failures.
- Fallback to defaults if storage fails.
- β Clean Code
- β SOLID Principles
- β No hardcoded pins β fully configurable
- β Modular architecture
- β Separation of concerns
- β Extensible for new ICs, UIs, or features
+------------------------+
| Main App |
+-----------+------------+
β
+-----------+------------+
| Services |
+-----------+------------+
β
+------+ +------+ +------+
| HAL | | Drivers| | UI |
+------+ +------+ +------+
β
+-----------+
| Hardware |
+-----------+
- TDA7439 Driver
- LCD + Button UI
- Web UI Interface
- PT2313 and PT2322 Drivers
- MQTT/HTTP API
- OTA Update Support
Contributions are welcome!
- Fork this repository
- Create your feature branch (
git checkout -b feature/awesome
) - Commit your changes (
git commit -m 'Add awesome feature'
) - Push to the branch (
git push origin feature/awesome
) - Open a Pull Request
This project is licensed under the MIT License β see the LICENSE file for details.
- Inspired by Tasmota's robust configuration and storage mechanism.
- Thanks to the open-source community for drivers and libraries.