While USB-PD→DC cables exist, these are preset to a specific voltage. Using the same USB-PD with different devices requiring different voltages means unplugging and plugging in a different cable for each device. There has to be a better solution, and thanks to Adafruit, we can make it! This design uses 4 LED lit push button switches, and a 0.91 inch OLED screen, to choose from 5v (default), 9v, 12v, and 20v. When first turned on, 5v is chosen by default.
The unit requires the following power inputs:
5v to Arduino |
Ensure the Arduino receieves a consistent power output and preserve all available current through USB-PD is available for any devices you have connected. |
USB-PD |
The main power input. Please ensure your USB-PD power supply supports all of the voltages you plan to use. |
Pressing a specific voltage pushbutton results in that switch lighting up and the OLED screen displaying the currently operating voltage. If the selected voltage cannot be set, either due to a communications error or the USB-PD power source not supporting that voltage, an error will be displayed and the previously working voltage left enabled.
This is a work in progress, expect updates to be posted as time/testing permits
-
Component List
-
Pin count confirmation
-
Arduino microcontroller restrictions confirmed
-
Parts ordering
-
Pinout and wiring confirmation
-
Switch/LED/OLED screen code validation in simulation
-
3D case designed and parts test-fitted
Quantity | Name | Purpose | Link |
---|---|---|---|
1 |
Adafruit USB Type C Power Delivery (HUSB238) |
Does USB-PD heavy lifting and supports I2C control for "on the fly" voltage changes. |
|
1 |
Adafruit Monochrome 0.91 inch Display (OLED) |
Provides a feedback mechanism to the user to confirm if the chosen voltage was changed successfully or if the USB-PD power source does not support that voltage. |
|
4 |
Adafruit 16mm Illuminated Push Button Momentary |
Used to choose which voltage you want. |
|
1 |
Arduino Micro 328 (5V 16Mhz version) |
The control brains. Contains the code to control the USB-PD board and OLED screen. |
|
4 |
10k Ohm Resistors |
Pulldown resistor for each switch. |
Favorite component source |
1 |
330 Ohm Resistor |
Current limiting resistor for LEDs for indicating the currently enabled voltage. |
Favorite component source |
1 |
DIY OEM Type C Female Socket |
Provides a dedicated 5v power for control Arduino |
I’ve include both a checklist-type wiring diagram, and a Fritzing diagram in an effort to reach the widest audience of other makers.
Below is the table of Arduino Pins to component pins/pads, if there is an inline resistor, and a handy extra space to mark off when you’ve completed that connection.
Arduino Micro 328 Pin | Inline Resistor Value | Component Pin/Pad | Done? |
---|---|---|---|
Ground |
330 Ohm |
Cathode (negative) of each LED. All LEDs can be tied together and linked to one resistor |
|
Ground |
10K Ohm |
Pin 1 of "5v" Switch |
|
Ground |
10K Ohm |
Pin 1 of "9v" Switch |
|
Ground |
10K Ohm |
Pin 1 of "12v" Switch |
|
Ground |
10K Ohm |
Pin 1 of "20v" Switch |
|
5v (Vcc on some Arduino models) |
Pin 2 of each Switch, VIN on OLED |
||
2 (Digital Pin) |
Pin 1 of "20v" Switch |
||
3 (Digital Pin) |
Pin 1 of "12v" Switch |
||
4 (Digital Pin) |
Pin 1 of "9v" Switch |
||
5 (Digital Pin) |
Pin 1 of "5v" Switch |
||
6 (Digital Pin) |
Anode (positive) of "20v" indicator LED |
||
7 (Digital Pin) |
Anode (positive) of "12v" indicator LED |
||
8 (Digital Pin) |
Anode (positive) of "9v" indicator LED |
||
9 (Digital Pin) |
Anode (positive) of "5v" indicator LED |
||
A4 (Hardware SDA pin) |
SDA pins on OLED and HUSB238 |
||
A5 (Hardware SDA pin) |
SCL pins on OLED and HUSB238 |
For visually oriented folks, here is a Fritzing wiring diagram with an Arduino Micro 328: The power/barrel connector is the 5V input (separate from HUB238). The pigtail breakout is the 5V/9V/12V/20V output from the HUB238.