readme.md

Markdown · 161 lines

# ESP32 Captive Portal Notepad
A simple WiFi-based text storage app with captive portal support

This project turns an **ESP32 Dev Board** into a fully standalone **wireless notepad**.  
When powered, the ESP32 creates its own **WiFi Access Point** (open network, no password).  
Any device connecting to it gets **automatically redirected** to a local web interface (via a captive portal).

The page contains a simple text form where you can enter and save any message.  
The ESP32 stores it in memory and displays it on the webpage each time you reopen the portal.

This works entirely offline — no internet required.

---

## ✨ Features

### ✔ Open WiFi Access Point  
- SSID: **ESP32-PORTAL**  
- No password required  
- Works with phones, tablets, laptops

### ✔ Captive Portal  
Automatically redirects to the ESP32 page when connecting:
- Android open network assistant (`/generate_204`)
- iOS/macOS hotspot detection (`/hotspot-detect.html`)
- Windows NCSI check (`/ncsi.txt`)
- Any attempted website (Google, YouTube, etc.) redirects back to the portal

### ✔ Web-based Notepad  
- Enter text into a `<textarea>`
- Save it using the **Save text** button
- Stored text is shown at the top of the page
- Works instantly on any browser

### ✔ Zero external hardware required  
- No buttons  
- No LEDs  
- No display  
- Only the ESP32 module itself

---

## 📡 How It Works

1. ESP32 boots and enters **Access Point** mode.
2. Starts a DNS server that **redirects all domains** to itself.
3. Starts an HTTP server serving a simple HTML interface.
4. User connects to WiFi → gets the notepad page automatically.
5. User types text → ESP32 stores it and displays it.

---

## 🛠 Required Hardware

- **ESP32 Dev Board** (any compatible ESP32 module)
- USB cable for programming
- No external components needed

---

## 📦 Required Software

**Arduino IDE** or **PlatformIO**, plus:

### ESP32 Board Package  
In Arduino IDE:

```
Tools → Board → Boards Manager → search "ESP32" → install
```

This package provides:
- `WiFi.h`
- `WebServer.h`
- `DNSServer.h`

No other libraries are needed.

---

## 🚀 Uploading the Code

1. Open the `.ino` sketch.
2. In Arduino IDE select:
   ```
   Tools → Board → ESP32 Dev Module
   ```
3. Select your COM port.
4. Upload the sketch.

---

## 🔧 Default WiFi Settings

```
SSID: ESP32-PORTAL
Password: (none)
IP Address: 192.168.4.1
```

After connecting, most devices show the captive portal screen automatically.

If not, open:

```
http://192.168.4.1/
```

---

## 🧪 Using the Notepad

1. Connect to **ESP32-PORTAL** WiFi.
2. Wait for the captive portal to pop up.
3. Or open manually:

   ```
   http://192.168.4.1/
   ```

4. Type any text in the textarea.
5. Press **Save text**.
6. The saved text appears at the top of the page.

---

## 📁 Project Structure

```
/ESP32-Captive-Notepad
 ├── main.ino
 └── README.md
```

---

## 🧩 Extending the Project

You can easily add more features:

- Store text permanently using `Preferences` or `LittleFS`
- Add timestamp / message history
- Add authentication or password protection
- Add encryption for secure local notes
- Turn this into a simple To-Do List server
- Add physical UI components (OLED, buttons, LEDs)

If you want, I can generate these extensions.

---

## 📝 License

This project is open-source and free to use, modify and share.

---

## ❤️ Credits

Created using ESP32, Arduino and pure curiosity.  
Design optimized for teaching, prototyping and fun experiments.