What? Why?
I got the idea of re-purposing an old Raspberry Pi power-supply into a multi-port USB charging station. It occurred to me that a useful extension to this would be to make each charging port controllable from my network, via MQTT. Two immediate reasons for this were: to have the charging station listen for my 'goodnight network' (MQTT) message, and respond by switching off all connected charging cables (and their annoying LEDs); and to have a platform whereby a connected device could request it's own power-supply be switched on/off.
Other design goals: I'd like to mount my PCB on a laser-cut 'cable-wrangler' that attaches to the back of my desk; as well as re-purposing an old (5V!) power-supply, I'd like to re-use an old NodeMCU ESP8266 module.
It is important to note that this is intended mainly as a relatively low-power charging station to manage my collection of 'weird' charging cables (looking at you, watch and headphones) - distributing more than a couple of amps via this PCB is not recommended.
Physical/Electrical/Code Assets
- Extended Gerber files for PCB - suitable for submission to elecrow.com, for example.
- PCB BOM: NodeMCU ESP8266 module x 1; USB-A female sockets x 5; IRL540N MOSFET x 5 (N.B. 'IRL' = logic-level, as opposed to 'IRF' = 5V+); pull-down resistors x 5 (1 - 10 KΩ); 5V / <15W power-supply x 1.
- OnShape Part Studio for cable-wrangler (including 'wing' mount for PCB) - suitable for laser-cutting. NB: cables are retained by a 'bar' that pivots at one end (it's a bit hard to see in the photos, below).
- NodeMCU code - suitable for use in PlatformIO, for example. You will need to update the config/code to match your network. You'll also need to build your own 'callback()' function. Search the code for '###' to see where to make your updates.
The platformio.ini for this project:[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
build_flags =
-DC_ADDRESS=### 4TH IP ADDRESS BLOCK - AS PER upload_port, BELOW ###
-DC_CLIENT=\"### MQTT CLIENT ID ###\"
-DC_TOPIC=\"### MQTT TOPIC FOR THIS DEVICE ###\"
-DC_SSID=\"### YOUR WIFI SSID ###\"
-DC_SSPW=\"### YOUR WIFI PASSWORD ###\"
-DC_HASH=\"### YOUR OTA PASSWORD HASH, AS PER 'upload_flags = --auth', BELOW ###\"
lib_deps =
knolleary/PubSubClient@2.8
[env:nodemcuv2_ota]
extends = env:nodemcuv2
upload_protocol = espota
upload_port = 192.168.4.###
upload_flags = --auth=### YOUR OTA PASSWORD ###
All MQTT-aware USB Charging Station assets by Chris Molloy are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
¤ Copyright 1999-2024 Chris Molloy ¤ All rights reserved ¤