Web-based control for the HUSB238 USB-C Power Delivery module via Bluetooth Low Energy.
Try it now: https://unit-electronics-mx.github.io/unit_web_devlab_husb238_usb_c_pd_module/
Requirements: Chrome/Edge browser with Bluetooth enabled. ESP32 + HUSB238 hardware must be programmed and powered.
- Control USB-C PD voltage negotiation (5V, 9V, 12V, 15V, 18V, 20V)
- Read current and voltage status
- Monitor connection state
- Automatic voltage sweep
- Web-based interface (no installation required)
- ESP32-H2 (Pulsar H2) or compatible ESP32 board
- HUSB238 USB-C PD module
- I2C connection:
- SDA: GPIO12
- SCL: GPIO22
- Open Arduino IDE
- Install Adafruit_HUSB238 library
- Open
husb238/husb238_ble.ino - Select your ESP32 board
- Upload sketch
- Open the web application
- Click "Connect to HUSB238"
- Select "HUSB238" from Bluetooth devices
- Control voltages from the web interface
The firmware supports SCPI-like commands via BLE or Serial:
*IDN? - Device identification
STAT? - USB-C connection status
PD:LIST? - List available voltages
PD:GET? - Get current voltage
PD:SET<voltage> - Set voltage (5, 9, 12, 15, 18, 20)
PD:SWEEP - Sweep all available voltages
CURR:GET? - Get current
CURR:MAX?<voltage> - Get max current for voltage
├── husb238/
│ └── husb238_ble.ino # ESP32 firmware
├── docs/
│ ├── index.html # Web application
│ └── script-husb238.js # BLE logic
└── .github/
└── workflows/
└── deploy-gh-pages.yml # Auto-deployment
Local testing:
cd docs
python3 -m http.server 8000Open http://localhost:8000 in Chrome/Edge.
Device not found: Ensure ESP32 is powered and BLE is initialized (check serial monitor).
Service not found: Clear browser BLE cache at chrome://bluetooth-internals and forget the device.
Connection fails: Verify I2C pins match your hardware configuration.
MIT License - UNIT Electronics