Main Content

fpx: easy USB‑C power for all your devices

My first attempt in using USB-C adapters as a power source was met with great enthusiasm. It was just a breakout board for STUSB4500 autonomous USB-PD sink controller. It has since been picked up by Sparkfun with a much better design (as you would expect).

Although sufficient, I wasn’t very happy with how much effort was needed to program the chip. It required talking I2C which for me meant an Arduino had to be available, connected to a computer with USB and a whole bunch of jumper wires. I have since used Adafruit’s MCP2221A breakout board and a Raspberry Pi but the process still has a lot of friction. So, I set out to simplify the programming aspect of STUSB4500 and this post will take you through to what became fpx, a smaller and easily configurable version of fabpide2.

Long time ago, I had the idea of setting WiFi passwords for ESP8266 boards using something like morse code as light pulses (and someone actually did this recently). This method would have few advantages over alternative methods, such as wiring up the board to another device or using ESSID station names as password:

No need for special software to run on a computer/phone which would most likely be limited to certain OSes (or at a high development and maintenance cost to make it ubiquitously available). A simple web page with some javascript code would ensure it would run on just about every “smart” device out there.
No need for cables to connect to the programmer device.
More secure as it requires close proximity and unobstructed view of the device.
Simple to design and implement than more complex protocols and interfaces such as USB, Bluetooth and WiFi.
I thought this was the perfect opportunity for me to try out my idea. It took a bit of thinking to come up with some signal processing methods and further changes to arrive at a fairly robust setup. There is a lot more room for improvement of course.

Speaking of signal processing, I had no prior experience with it. I decided to see how far I could get without turning to literature. I wanted the board to adapt to both, varying light conditions, as well as varying light flash rate, as there was no way to ensure a specific screen refresh rate. Even if there was only one rate right now, I wanted to make the board future proof to some degree.

Architecture
Architecture is a strong word for what makes up fpx. Following are the main components and the reason for picking each:

STUSB4500: already quite familiar with it and it does the heavy lifting when it comes to talking USB-PD
ATtiny 816 microcontroller: used to read light pulses and program STUSB4500; another familiar chip I’ve used in the past; it also uses the newer UPDI single wire in-circuit programming and debugging interface which requires less space on the board for pads.
Phototransistor: very cheap and requires the least number of supporting components (just a resistor) while providing very fast response times (compared to full fledged light sensors with digital interfaces).
The rest are supporting components. As you can see, this is a very simple board.”

Link to article