Away in a Manger, This Nativity Is Lit by an Espressif ESP32 Bit-Banging USB Power Delivery
An ESP32-C6, with no more than an external resistor and a SOT-363 transistor, handles USB PD with aplomb in this clever experiment.
Pseudonymous self-described hacker "g3gg0" has dropped the bill of materials for an illuminated nativity scene β by turning an Espressif ESP32 microcontroller into a USB Power Delivery (PD) device.
"The light was quite bright and I was missing some candle-like flickering, so I quickly designed a [Espressif] ESP32-C6 board as I wanted to play with its Zigbee capabilities anyway and implement a Zigbee controlled crib, varying brightness, and flicker mode," g3gg0 explains of the illuminated scene. "The LED strip required 12V, so I needed a USB PD chip to trigger the power supply to deliver this voltage. Then some el cheapo MOSFETs and a mini screw terminal, done."
The proof of concept worked well enough, but it raised an interesting question in terms of cost-reduction and space savings. "I am using an USB [Type-]C plug and a [WCH Electronics] CH224K [USB PD sink] to tickle 12V out of the USB PD power supply. And this chip in its SOIC-8 footprint is as big as the ESP32-C6 itself. While usually this is not much of a problem, sometimes you want to save precious PCB space. So the question arose: why not bit-bang PD-protocol with the ESP32 and save precious PCB space?"
The Espressif ESP32-C6 is not, by its data sheet, a USB Power Delivery compatible device, and cannot negotiate voltages and currents from a USB PD supply. That didn't stop g3gg0, though, who promptly set about "violating standards" β adding as few components as possible and getting the microcontroller to encode and decode USB PD messages itself. Later updates also added cable reporting and Programmable Power Supply (PPS) support β "so," g3gg0 explains, "you can basically build your own power supply with an ESP32 and a PPS capable phone charger."
The project is documented in full on g3gg0's website.