Skip to content

Releases: Bwooce/USBFlashHub

v0.1.0 - Initial Stable Release

Choose a tag to compare

@Bwooce Bwooce released this 04 Oct 08:51

USBFlashHub v0.1.0

Overview

First stable release of USBFlashHub - ESP32 firmware for controlling Jim Heaney's I2C-Controlled USB Hub hardware.

Hardware Support

  • ESP32 Variants: S2 (Wemos S2 Mini), S3 (S3 Zero with RGB LED), C3 (C3 Zero/Mini), Original ESP32
  • Compatible Hardware: Jim Heaney's I2C-Controlled USB Hub
  • Hubs: Support for up to 8 hubs (32 ports total)
  • Current Limiting: MT9700 with series-switched resistor ladder
    • High power: ~227mA (30kΩ resistor)
    • Low power: ~113mA (60kΩ series resistors)

Features

Core Functionality

  • Port Control: Individual port power control (off/low/high)
  • LED Control: Per-hub LED indicators
  • Pin Control: Direct boot/reset pin control for programming
  • I2C Health Monitoring: Automatic error recovery and health tracking
  • Emergency Stop: All-off command for safety

Activity Logging

  • PSRAM Support: 10,000 log entries with 2MB PSRAM
  • RAM Fallback: 100 entries without PSRAM
  • Real-time WebSocket: Live log streaming to web clients
  • Error Logging: I2C failures, hub initialization, WiFi errors
  • Persistence: Log survives deep sleep (PSRAM volatile on reset)

Web Interface

  • Real-time Control: WebSocket-based responsive UI
  • Status Monitoring: Live hub/port status updates
  • Activity Log Viewer: Browse activity history
  • Power Level Control: Easy high/low power switching

Network Features

  • WiFi Manager: Easy WiFi configuration via WebSocket
  • mDNS: Access via usbhub.local
  • WebSocket: Port 81 for real-time bidirectional communication
  • HTTP Server: Port 80 for web interface
  • NTP Sync: Automatic time synchronization

Python Automation

  • Testing Agent: Automated device testing with YAML rules
  • Hub Control: Interactive CLI, dashboard, and REST API modes
  • Automation Scripts: Power cycling, batch programming, device inventory
  • Database: SQLite device tracking and test history

Reliability

  • I2C Retry Logic: Automatic retry with exponential backoff
  • Watchdog Protection: WDT reset during I2C operations
  • Conditional Serial Logging: USB-aware to reduce overhead
  • Error Recovery: Graceful handling of I2C failures

Build Instructions

Arduino IDE / arduino-cli

ESP32-S2:

arduino-cli compile --fqbn esp32:esp32:esp32s2:CDCOnBoot=cdc,PSRAM=enabled
arduino-cli upload --fqbn esp32:esp32:esp32s2:CDCOnBoot=cdc,PSRAM=enabled -p /dev/ttyACM0

ESP32-S3:

arduino-cli compile --fqbn esp32:esp32:esp32s3:CDCOnBoot=cdc,PSRAM=enabled
arduino-cli upload --fqbn esp32:esp32:esp32s3:CDCOnBoot=cdc,PSRAM=enabled -p /dev/ttyACM0

ESP32-C3:

arduino-cli compile --fqbn esp32:esp32:esp32c3:CDCOnBoot=cdc
arduino-cli upload --fqbn esp32:esp32:esp32c3:CDCOnBoot=cdc -p /dev/ttyACM0

ESP32 (Original):

arduino-cli compile --fqbn esp32:esp32:esp32
arduino-cli upload --fqbn esp32:esp32:esp32 -p /dev/ttyUSB0

Required Libraries

  • ArduinoJson (via Library Manager)
  • WebSockets by Markus Sattler
  • Adafruit NeoPixel (for S3-Zero RGB LED)

Upload Web Interface

python3 upload_data.py

Configuration

WebSocket Commands

Port Control:

{"cmd":"port","port":1,"power":"high"}
{"cmd":"port","port":5,"power":"low"}
{"cmd":"port","port":3,"power":"off"}

Hub Control:

{"cmd":"hub","hub":1,"led":true}
{"cmd":"alloff"}

Pin Control:

{"cmd":"boot","state":true}
{"cmd":"reset","pulse":100}

WiFi Configuration:

{"cmd":"config","wifi":{"ssid":"YourSSID","pass":"password","enable":true}}
{"cmd":"config","mdns":"usbhub"}

Python Agents

Installation

cd agents
./install.sh

Usage Examples

# Turn on all ports
python3 turn_on_all_ports.py

# Interactive control
python3 hub_control.py --mode cli

# Automated testing
python3 testing_agent.py --config test_rules.yaml

# Power cycle ports
./automation_scripts/power_cycle_all.py --ports 1,2,3

Known Limitations

  • Activity log is volatile (PSRAM cleared on any reset)
  • Power terminology is generic (high/low) - actual current depends on resistor configuration
  • No persistent storage for activity logs (by design for performance)

Documentation

  • See README.md for detailed documentation
  • See CLAUDE.md for technical implementation notes
  • See agents/README.md for Python agent documentation

Credits


Full Changelog: https://github.com/Bwooce/USBFlashHub/commits/v0.1.0