Skip to content

Latest commit

 

History

History
103 lines (69 loc) · 3.72 KB

File metadata and controls

103 lines (69 loc) · 3.72 KB

DP100-ESP32-WebApp

ESP32-S3 firmware for monitoring and controlling a DP100 power supply over USB Host. The device exposes an embedded web UI, Wi-Fi provisioning portal, HTTP control APIs, and a lightweight WebSocket telemetry stream for browser charts or AI observers.

【改装】基于ESP32-S3的DP100无线控制器 独立使用! 不干扰按键!

DP100 Modification

In USB Device mode, the DP100 USB-A port does not provide 5 V output. The power electronic switch input therefore needs to be directly shorted to its output.

Features

  • ESP32-S3 USB Host communication with DP100.
  • Wi-Fi STA auto-connect with saved credentials and SoftAP provisioning fallback.
  • Embedded web dashboard at http://<esp32-ip>/.
  • Local web development page under web/ to iterate without flashing firmware.
  • High-rate CSV-style WebSocket telemetry at /ws.
  • HTTP APIs for status, Wi-Fi setup, DP100 output control, time sync, and scheduled on/off rules.

Project Layout

main/                 ESP-IDF application component
  main.c              App entry point
  dp100_usb.*         DP100 USB Host polling and control
  wifi_portal.*       Web server, Wi-Fi provisioning, APIs, WebSocket
  scheduler.*         Time sync and cron-style output scheduler
  json_utils.*        JSON response helpers
  portal.html         Embedded firmware UI
web/                  Local browser UI and development server
docs/                 API, WebSocket, and product notes
tools/                Build, flash, and WebSocket debug scripts
ref/                  Reference implementations
build/                Generated ESP-IDF build output

Build and Flash

Use the project scripts rather than calling idf.py directly; they set the expected ESP-IDF 6.0.1 paths and target.

./tools/build.sh
./tools/flash.sh -p /dev/ttyUSB0

Flash normally uses the existing build output. To force build during flash:

./tools/flash.sh -p /dev/ttyUSB0 --build

The project currently targets ESP32-S3 only.

Local Web UI Development

Run the local page when changing frontend behavior:

node web/server.mjs

Open:

http://127.0.0.1:8080

The default device host is 192.168.1.20. The local page proxies HTTP API calls and connects WebSocket directly to ws://<device-ip>/ws. After frontend changes are stable, keep web/index.html and main/portal.html synchronized.

Runtime Behavior

On boot, ESP32 tries saved Wi-Fi credentials. If connection succeeds, it runs in STA mode and serves the dashboard on its assigned IP. If saved Wi-Fi fails, it starts an open SoftAP provisioning network and serves the setup page.

DP100 telemetry is sent over WebSocket as CSV text. The first message is the header:

dt/ms,v/mV,i/mA,s/status

Rows contain elapsed milliseconds, output voltage, output current, and state (0 OFF, 1 CV, 2 CC). Output power is calculated by clients.

Documentation

  • HTTP API: docs/api.md
  • WebSocket protocol: docs/WEBSOCKET_PROTOCOL.md
  • Local web workflow: web/README.md

License

This project is licensed under the GNU General Public License v3.0 or later, abbreviated as GPL-3.0-or-later. You may use, study, modify, and distribute this project; distributing modified versions or derivative works requires compliance with GPL source-disclosure and same-license obligations. See LICENSE.

Notes

  • Do not commit Wi-Fi credentials or device-specific provisioning data.
  • sdkconfig and sdkconfig.defaults are project configuration files; review changes carefully.
  • build/ is generated output and should not be edited by hand.

Thanks

DP100-WebApp