A customizable captive portal implementation for ESP32 using AsyncWebServer and LittleFS. When devices connect to the ESP32's WiFi access point, they are automatically presented with a captive portal interface.
- β¨ Automatic captive portal detection on client devices
- π Custom landing page (
captive.html) - π± Responsive web interface
- πΎ File system based content using LittleFS
- β‘ Async web server for better performance
- PlatformIO installed
- ESP32 development board
- USB cable
- Visual Studio Code (recommended)
-
Clone this repository:
git clone https://github.com/luanphamng/esp-captive-portal.git cd esp-captive-portal -
Open the project in PlatformIO:
- Open VS Code
- Install PlatformIO extension if you haven't
- Click "Open Project" and select the esp-captive-portal folder
-
Build the project:
pio run
-
Upload the filesystem:
pio run -t uploadfs
-
Upload the firmware:
pio run -t upload
esp-captive-portal/
βββ src/ # Source files
β βββ main.cpp # Main application code
βββ data/ # Web content files
β βββ captive.html # Initial captive portal page
β βββ index.html # Main application page
β βββ notifications.css
β βββ notifications.js
β βββ assets/ # Static assets
β βββ css/
β βββ js/
βββ platformio.ini # PlatformIO configuration
The project uses platformio.ini for build configuration:
- LittleFS for file system
- ESP32 board settings
- Required libraries
- Debug settings
If you can't flash on Ubuntu/Linux, set the correct permissions:
sudo chmod 777 /dev/ttyUSB0 # Replace ttyUSB0 with your portIf you encounter "build_command.json" errors:
- Delete the
output/build_command.jsonfile - Rebuild the project
- If the portal doesn't appear, try clearing your device's network cache
- Make sure all files are properly uploaded to LittleFS
- Check serial monitor for debugging information
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details
- ESPAsyncWebServer
- AsyncTCP
- ESP32 Community