ESP32-S2 기반의 Toy Web Server 입니다.
- Wi-Fi 연결: WPA/WPA2 Personal 네트워크 자동 연결 및 재연결
- HTTP 서버: 포트 80에서 웹 페이지 제공
- LCD 디스플레이: ST7789 1.14인치 IPS LCD에 상태 표시
- Wi-Fi 연결 상태
- IP 주소
- HTTP 요청 수
LilyGO T-Display-S2(ESP32-S2)를 사용하였습니다. 주변에 있어서 사용한 거라서, 다른 제품을 사용하셔도 무관합니다.
| 핀 | GPIO |
|---|---|
| MOSI | 35 |
| SCLK | 36 |
| CS | 34 |
| DC | 37 |
| RST | 38 |
| BL (백라이트) | 33 |
| 기능 | GPIO |
|---|---|
| SD 카드 전원/LED 제어 | 14 |
| SD 카드 CS | 10 |
- rust
- espup
cargo build --releasecargo run --release
➜ esp32s2-web git:(main) ✗ cargo run --release
Finished `release` profile [optimized + debuginfo] target(s) in 0.21s
Running `espflash flash --monitor --chip esp32s2 --log-format defmt target/xtensa-esp32s2-none-elf/release/esp32s2-web`
[2026-01-27T06:37:51Z INFO ] Serial port: '/dev/cu.usbserial-1130'
[2026-01-27T06:37:51Z INFO ] Connecting...
[2026-01-27T06:37:52Z INFO ] Using flash stub
Chip type: esp32s2 (revision v0.0)
Crystal frequency: 40 MHz
Flash size: 4MB
Features: WiFi, No Embedded Flash, No Embedded PSRAM, ADC and temperature sensor calibration in BLK2 of efuse V1
MAC address: 7c:df:a1:00:8b:1a
App/part. size: 465,376/4,128,768 bytes, 11.27%
[00:00:00] [========================================] 14/14 0x1000 Skipped! (checksum matches) [00:00:00] [========================================] 1/1 0x8000 Skipped! (checksum matches)
[00:00:33] [========================================] 309/309 0x10000 Verifying... OK! [2026-01-27T06:38:27Z INFO ] Flashing has completed!
Commands:
CTRL+R Reset chip
CTRL+C Exit
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x3ffe5110,len:0x1690
load:0x4004a000,len:0xb18
load:0x4004e000,len:0x33d0
entry 0x4004a1c4
I (25) boot: ESP-IDF v5.5.1-838-gd66ebb86d2e 2nd stage bootloader
I (25) boot: compile time Nov 26 2025 12:27:28
I (26) boot: chip revision: v0.0
I (28) boot: efuse block revision: v0.1
I (31) boot.esp32s2: SPI Speed : 40MHz
I (35) boot.esp32s2: SPI Mode : DIO
I (39) boot.esp32s2: SPI Flash Size : 4MB
I (43) boot: Enabling RNG early entropy source...
I (47) boot: Partition Table:
I (50) boot: ## Label Usage Type ST Offset Length
I (56) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (63) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (69) boot: 2 factory factory app 00 00 00010000 003f0000
I (76) boot: End of partition table
I (79) esp_image: segment 0: paddr=00010020 vaddr=3f000020 size=0f4ach ( 62636) map
I (103) esp_image: segment 1: paddr=0001f4d4 vaddr=3ffbe030 size=00b44h ( 2884) load
I (104) esp_image: segment 2: paddr=00020020 vaddr=40080020 size=54d5ch (347484) map
I (201) esp_image: segment 3: paddr=00074d84 vaddr=3ffbeb74 size=00c00h ( 3072) load
I (203) esp_image: segment 4: paddr=0007598c vaddr=40022000 size=0c030h ( 49200) load
I (227) boot: Loaded app from partition at offset 0x10000
I (227) boot: Disabling RNG early entropy source...
[INFO ] ESP32-S2 Web Server starting (T-Display-S2) (esp32s2_web src/bin/main.rs:70)
[INFO ] LCD initialized (esp32s2_web src/bin/main.rs:113)
[INFO ] Initializing WiFi... (esp32s2_web src/bin/main.rs:120)
[INFO ] WiFi initialized (esp32s2_web src/bin/main.rs:128)
[INFO ] HTTP server waiting for network... (esp32s2_web src/bin/main.rs:331)
[INFO ] Waiting for IP address assignment... (esp32s2_web src/bin/main.rs:333)
[WARN ] esp_wifi_internal_tx 12290 (esp_radio src/wifi/mod.rs:2418)
[INFO ] WiFi task started, connecting to SSID: Anonymous (esp32s2_web src/bin/main.rs:228)
[INFO ] Configuring WiFi... SSID: Anonymous (esp32s2_web src/bin/main.rs:239)
[INFO ] WiFi configured (esp32s2_web src/bin/main.rs:247)
[INFO ] Starting WiFi... (esp32s2_web src/bin/main.rs:249)
[INFO ] WiFi started (esp32s2_web src/bin/main.rs:257)
[INFO ] WiFi started, waiting for connection... (esp32s2_web src/bin/main.rs:261)
[INFO ] Connect initiated, waiting for IP... (esp32s2_web src/bin/main.rs:270)
[INFO ] WiFi connected! Waiting for IP address... (esp32s2_web src/bin/main.rs:280)
[INFO ] ======================================== (esp32s2_web src/bin/main.rs:338)
[INFO ] WiFi connected! (esp32s2_web src/bin/main.rs:339)
[INFO ] IP Address: 192.168.0.36 (esp32s2_web src/bin/main.rs:340)
[INFO ] HTTP Server: http://192.168.0.36 (esp32s2_web src/bin/main.rs:341)
[INFO ] ======================================== (esp32s2_web src/bin/main.rs:342)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)
[INFO ] Client connected! (esp32s2_web src/bin/main.rs:366)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)
[INFO ] Client connected! (esp32s2_web src/bin/main.rs:366)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)
[INFO ] Client connected! (esp32s2_web src/bin/main.rs:366)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)
[INFO ] Client connected! (esp32s2_web src/bin/main.rs:366)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)
[INFO ] Client connected! (esp32s2_web src/bin/main.rs:366)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)
[INFO ] Client connected! (esp32s2_web src/bin/main.rs:366)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)
[INFO ] Client connected! (esp32s2_web src/bin/main.rs:366)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)
[INFO ] Client connected! (esp32s2_web src/bin/main.rs:366)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)
[INFO ] Client connected! (esp32s2_web src/bin/main.rs:366)
[INFO ] Listening on port 80... (esp32s2_web src/bin/main.rs:358)src/bin/main.rs 파일에서 다음 상수를 수정하세요:
const WIFI_SSID: &str = "네트워크_이름";
const WIFI_PASSWORD: &str = "비밀번호";프로젝트는 Embassy 비동기 런타임을 사용하며 세 개의 주요 태스크로 구성됩니다:
- wifi_task: Wi-Fi 연결 관리 및 재연결
- net_task: 네트워크 스택 실행
- http_server_task: HTTP 요청 처리
메인 루프는 LCD 디스플레이 업데이트를 담당합니다.
esp-hal: ESP32 하드웨어 추상화esp-radio: Wi-Fi 드라이버embassy-net: 비동기 네트워크 스택mipidsi: ST7789 LCD 드라이버embedded-graphics: 그래픽 라이브러리
MIT License
