Skip to content

This is an example of a captive portal running on the esp32 Soc. We're using the ESPAsyncTCP library from MeNoDev.

Notifications You must be signed in to change notification settings

LuanTechAutomation/esp-captive-portal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Captive Portal

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.

Features

  • ✨ 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

Prerequisites

Installation

  1. Clone this repository:

    git clone https://github.com/luanphamng/esp-captive-portal.git
    cd esp-captive-portal
  2. 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

Building and Uploading

  1. Build the project:

    pio run
  2. Upload the filesystem:

    pio run -t uploadfs
  3. Upload the firmware:

    pio run -t upload

Project Structure

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

Configuration

The project uses platformio.ini for build configuration:

  • LittleFS for file system
  • ESP32 board settings
  • Required libraries
  • Debug settings

Troubleshooting

Permission Issues on Linux/Ubuntu

If you can't flash on Ubuntu/Linux, set the correct permissions:

sudo chmod 777 /dev/ttyUSB0  # Replace ttyUSB0 with your port

Build Issues

If you encounter "build_command.json" errors:

  1. Delete the output/build_command.json file
  2. Rebuild the project

Common Issues

  • 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

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

About

This is an example of a captive portal running on the esp32 Soc. We're using the ESPAsyncTCP library from MeNoDev.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published