Easy WiFi Configuration for ESP32 via Bluetooth (Classic BT & BLE)
Simplify WiFi provisioning with Classic Bluetooth or BLE on ESP32 boards
Features • Why EZConnect? • Installation • Quick Start • Examples • Documentation
EZConnect is a versatile Arduino/ESP32 library that simplifies WiFi configuration using either Classic Bluetooth or BLE (Bluetooth Low Energy). It allows users to send WiFi credentials wirelessly via Bluetooth and automatically connect the ESP32 to WiFi without hardcoding SSID or password.
The library supports both Classic BT and BLE modes, making it compatible with all ESP32 variants including the newer ESP32-C3, ESP32-S3, and ESP32-S2 series which have different Bluetooth hardware availability. This flexibility empowers hobbyists and developers to choose the best Bluetooth mode for their specific ESP32 board.
Perfect for IoT projects, smart devices, wireless configuration systems, and simplifying first-time WiFi setup.
Not all ESP32 variants support the same Bluetooth hardware:
- ESP32 (Original) - Supports both Classic BT and BLE
- ESP32-C3 / ESP32-C6 - BLE only (no Classic BT)
- ESP32-S2 - No Bluetooth support
- ESP32-S3 - BLE only (no Classic BT)
EZConnect supports both Classic BT and BLE modes, so you can use whichever is available on your specific ESP32 variant. This eliminates the frustration of incompatibilities and gives developers flexibility in their hardware choices.
- No hardcoded credentials - Credentials are sent wirelessly via Bluetooth
- No app development required - Use standard Bluetooth terminal apps for Classic BT
- Works with existing apps - Most Android/iOS devices have built-in Bluetooth support
- BLE option included - For projects that need lower power consumption with BLE-enabled apps
- Automatic reconnection - Once configured, ESP32 reconnects automatically on reboot
- Persistent storage - WiFi credentials are safely stored in device memory
- Dual Bluetooth Mode Support
- Classic Bluetooth - Works with standard Bluetooth serial apps
- BLE (Bluetooth Low Energy) - Lower power, requires BLE-capable app
- Persistent storage - Stores WiFi credentials using Preferences
- Auto-reconnection - Automatically reconnects on reboot
- Configurable timeout - Set your own WiFi connection timeout
- Status LED support - Visual feedback for connection state
- Simple API - Minimal setup required
- Non-blocking design - Uses millis() for efficient operation
| Board | Classic BT | BLE | Recommended |
|---|---|---|---|
| ESP32 (Generic) | Yes | Yes | Either |
| ESP32-C3 | No | Yes | BLE |
| ESP32-C6 | No | Yes | BLE |
| ESP32-S2 | No | No | Not Supported |
| ESP32-S3 | No | Yes | BLE |
Note: For ESP32-C3, ESP32-C6, and ESP32-S3, use BLE mode. For original ESP32, you can choose either mode based on your needs.
- Open Arduino IDE
- Go to Sketch → Include Library → Manage Libraries
- Search for EZConnect
- Click Install
- Download this repository as a ZIP file
- Open Arduino IDE
- Go to Sketch → Include Library → Add .ZIP Library
- Select the downloaded ZIP file
CRITICAL STEP
After installing the library, you must change the partition scheme to avoid compilation or runtime errors.
- In Arduino IDE, go to Tools → Partition Scheme
- Change from:
Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)- Change to:
Huge APP (3MB No OTA/1MB SPIFFS)Why is this necessary?
This library uses both WiFi and Bluetooth simultaneously, which requires more program space than the default partition scheme allows. Without this change, your sketch may fail to compile or upload.
#include <EZConnect.h>
// Initialize with Classic Bluetooth mode
EZConnect ez(EZCONNECT_CLASSIC_BT, "EZConnect-Device", 2, 0);
void setup() {
Serial.begin(115200);
ez.begin();
ez.showDebugmsg();
String ssid = ez.getSSID();
String pass = ez.getPass();
WiFi.begin(ssid.c_str(), pass.c_str());
// WiFi timeout = 10s, LED blink interval = 500ms
ez.checkConnectivity(10000, 500, 500);
}
void loop() {
ez.check();
}#include <EZConnect.h>
// Initialize with BLE mode
EZConnect ez(EZCONNECT_BLE, "EZConnect-Device", 2, 0);
void setup() {
Serial.begin(115200);
ez.begin();
ez.showDebugmsg();
String ssid = ez.getSSID();
String pass = ez.getPass();
WiFi.begin(ssid.c_str(), pass.c_str());
ez.checkConnectivity(10000, 500, 500);
}
void loop() {
ez.check();
}Choosing between modes:
- Classic Bluetooth: Compatible with standard Bluetooth terminal applications on Android and iOS without additional setup
- BLE: Required for ESP32 variants that do not support Classic BT (C3, S3, C6), or when lower power consumption is needed
- ESP32 boots and checks for saved WiFi credentials
- If credentials exist, ESP32 attempts to connect to WiFi
- If connection fails or credentials are missing, device enters Bluetooth mode
- User opens a Bluetooth terminal app (for Classic BT) or BLE app (for BLE mode) on their phone or PC
- User pairs with the device and sends WiFi credentials
- Credentials are saved to device memory (persistent storage)
- ESP32 connects to WiFi automatically
- LED provides visual feedback on connection status
- Device reconnects automatically on reboot if credentials exist
Send WiFi credentials from your Bluetooth app using one of these formats:
| Format | Example |
|---|---|
| Newline separator | MyWiFi\n12345678 |
| Pipe separator | MyWiFi|12345678 |
| Tab separator | MyWiFi 12345678 |
| Comma separator | MyWiFi,12345678 |
Replace MyWiFi with your SSID and 12345678 with your WiFi password.
EZConnect(EZCONNECT_CLASSIC_BT, const char* deviceName, uint8_t ledPin, uint8_t statusPin);EZConnect(EZCONNECT_BLE, const char* deviceName, uint8_t ledPin, uint8_t statusPin);| Parameter | Type | Description |
|---|---|---|
mode |
Enum | Either EZCONNECT_CLASSIC_BT or EZCONNECT_BLE |
deviceName |
const char* |
Bluetooth/BLE device name (max 31 characters) |
ledPin |
uint8_t |
GPIO pin for status LED (0 = disabled) |
statusPin |
uint8_t |
GPIO pin for status indicator (0 = disabled) |
void begin();
// Initialize EZConnect with chosen Bluetooth mode
String getSSID();
// Get stored WiFi SSID
String getPass();
// Get stored WiFi password
void check();
// Check for incoming Bluetooth data and process
void showDebugmsg();
// Enable debug messages to Serial Monitor
void checkConnectivity(int wifiTimeout, int blinkOn, int blinkOff);
// Check WiFi connectivity with LED feedback
// Parameters: WiFi timeout (ms), LED on duration (ms), LED off duration (ms)
void setUUIDs(const char* serviceUUID, const char* rxCharUUID);
// (BLE only) Set custom UUIDs for BLE Service and RX CharacteristicCheck out the examples folder for detailed implementations:
- BLE.ino - BLE mode setup with WiFi provisioning
- ClassicBT.ino - Classic Bluetooth mode setup
- CustomUUID.ino - BLE with custom UUIDs
Any standard Bluetooth serial terminal app works:
- Android: Bluetooth Terminal, Serial Bluetooth Terminal, HC-05 Bluetooth Terminal
- iOS: LightBlue (limited support), or use a Mac/PC with Bluetooth
- PC/Mac: Built-in Bluetooth with serial terminal software
When using BLE mode, you must use a BLE (Bluetooth Low Energy) compatible application. Standard Bluetooth terminal apps will NOT work with BLE mode.
Recommended BLE Apps:
- Android: nRF Connect (official Nordic app), BLE Scanner, LightBlue
- iOS: nRF Connect, LightBlue, BLE Scanner apps from App Store
- PC/Mac: nRF Connect Desktop (cross-platform), or built-in BLE support with appropriate software
Note: The nRF Connect app is the most widely used and recommended BLE application across all platforms. It provides a user-friendly interface specifically designed for BLE device communication and is available for Android, iOS, and desktop platforms.
EZConnect/
├── src/
│ ├── EZConnect.h
│ └── EZConnect.cpp
├── examples/
│ ├── BLE/
│ │ └── BLE.ino
│ ├── ClassicBT/
│ │ └── ClassicBT.ino
│ └── CustomUUID/
│ └── CustomUUID.ino
├── library.properties
├── LICENSE
└── README.md
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Found a bug? Please open an issue.
This project is licensed under the MIT License - see the LICENSE file for details.
You are free to use, modify, and distribute this library.
Atiqur Rahman
- Embedded Systems, Robotics, and IoT
- Email: aatiqurrahman111@gmail.com
- LinkedIn: linkedin.com/in/aatiqurrahman
If you find this project useful, please consider:
- Giving it a star on GitHub
- Reporting bugs and issues
- Suggesting new features
- Contributing to the codebase
Developed for the ESP32 community
