# Adafruit USB Type C Power Delivery Switchable Breakout

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/131/481/medium800thumb/adafruit_products_5991-07.jpg?1721759700)

The HUSB238 USB PD sink chip is neat in that you can either use switches (really, resistor selection) to set the desired PD voltage _or_ use I2C for dynamic querying and setting. We already stock a simple **[Adafruit USB Type C Power Delivery Dummy Breakout](https://www.adafruit.com/product/5807)** board around the HUSB238, but that one requires soldering closed jumpers to select the voltage. For folks who want a no-soldering-required board, this **Adafruit USB Type C Power Delivery Dummy - I2C or Switchable** is ready for instant gratification. No soldering required!

![](https://cdn-learn.adafruit.com/assets/assets/000/131/482/medium800/adafruit_products_5991-05.jpg?1721759845)

Compared to the basic **[Adafruit USB Type C Power Delivery Dummy Breakout](https://www.adafruit.com/product/5807)** we've done a renovation to keep the same great schematic and also add some oft-requested features:

- **No soldering required!** Switches allow on-the-fly voltage changes. Terminal block can be used to provide power to your robot, display, LEDs, etc.
- **Green LED** output lets you know that the terminal block power is on - can be disabled if you prefer
- **Stemma QT for I2C control** plug-and-play with Qwiic/QT
- **USB Data lines** available on solderable pads
- **On/Off switch** - you can disconnect the internal pass FET by connecting a switch between two onboard pads. When the switch is _closed_ the output will disconnect / turn off.
- We use the **HUSB328 PDL003A E-Marker variant** of the chip, a little more expensive, but it can request 5A power.

![](https://cdn-learn.adafruit.com/assets/assets/000/131/483/medium800/adafruit_products_5991-01.jpg?1721759899)

It's perfect for USB Type C wall adapters providing multiple voltages. The standard offerings are 5V, 9V, 12V, 15V, 18V, and 20V. This HUSB238 breakout plugs into the USB C cable and negotiates the PD request and commands over the CC lines. For example, we can ask what voltages are available and pick the highest. Or if you need a specific voltage, it will select that one.

![](https://cdn-learn.adafruit.com/assets/assets/000/131/484/medium800/adafruit_products_5991-04.jpg?1721759926)

This breakout will be handy for projects where you need a lot more than 5V @ 2A power: this adapter can give up to 20V at 5A - yes you can get 100W over USB C! - and you could buck that down to get a ton of current at 5V or 12V if that's needed. Or use it to convert a DC or battery-powered device into a USB C powered one!

![](https://cdn-learn.adafruit.com/assets/assets/000/131/485/medium800/adafruit_products_5991-03.jpg?1721759953)

 **DIP switch-configured usage is simple** : simply unplug the USB PD so you don't accidentally select too high a voltage for your device. Then switch ON the voltage you want: 5V, 9V, 12V, 15V, 18V, or 20V. You'll get that voltage and as much current as the adapter will provide. No microcontroller or microcomputer is required!

![](https://cdn-learn.adafruit.com/assets/assets/000/131/486/medium800/adafruit_products_5991-02.jpg?1721759984)

 **I2C-configured usage** is also available via a Stemma QT port. Use the [Arduino library and example code](https://github.com/adafruit/Adafruit_HUSB238) to query the USB Type C PD source for available voltages and currents and select the desired voltage dynamically. When configuring over I2C, the jumper settings are used on startup until the I2C commands come over.

The [STEMMA QT connector](https://learn.adafruit.com/introducing-adafruit-stemma-qt/what-is-stemma-qt) lets you make solderless connections between your development board and the breakout or chain it with a wide range of other sensors and accessories using a [**compatible cable**](https://www.adafruit.com/?q=stemma%20qt%20cable). [**QT Cable is not included** , but we have a variety in the shop](https://www.adafruit.com/?q=stemma+qt+cable&sort=BestMatch).

# Adafruit USB Type C Power Delivery Switchable Breakout

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/131/487/medium800/adafruit_products_double.jpg?1721760165)

The default I2C address is **0x08**.

## Power Output Terminal Block

- **+** - This is the voltage output pin. This pin will output the voltage selected from the HUSB238.
- **-** - Common ground for power and logic.

## USB Type C Port and Data Pins

At the top of the board is the USB type C port. You'll use this port to plug into a USB C PD wall adapter with a USB C cable. The USB data pins are broken out on the board: Data Plus (labeled **D+** on the board silk) and Data Minus (labeled **D-** on the board silk). These pins are located to the right of the USB type C port.

## DIP Switches

On the right side of the board is the 1x6 DIP switch. These switches let you select the voltage that is requested via USB PD. The available voltages are labeled on the board silk. To select a voltage, flip the switch to **ON** next to the board silk label for the voltage you need. The following voltages are available: **5V** , **9V** , **12V** , **15V** , **18V** , **20V**.

If none of the switches are turned **ON** , then the highest voltage available from the USB PD supply will be selected, which could be up to 20V.

Warning: If none of the switches are turned ON, then the highest voltage available from the USB PD supply will be selected, which could be up to 20V.

## I2C

Connect the STEMMA QT connector to a microcontroller or microcomputer board that has a separate power supply. When configuring over I2C, the selected switch settings are used on startup until the I2C commands come over.

- **[STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt) -** This port is located on the left side of the board. These connectors allow you to connect to dev boards with **STEMMA QT** (Qwiic) connectors or to other things with [various associated accessories](https://www.adafruit.com/?q=JST%20SH%204) with connections for GND (black wire), power (red wire), SDA (blue wire) and SCL (yellow wire).

Warning: When configuring over I2C, the switch settings are used on startup until the I2C commands come over.

## ISet Jumper

- **ISet** - Towards the top right corner of the board, above the DIP switches, is the ISet jumper. This jumper is connected to the **ISET** pin on the HUSB238. The **ISET** pin controls the current available on the board. When the jumper is closed, 1.25A is selected. If the jumper is cut (open), then 3.25A is selected.

## On/Off Switch
- **OFF** - directly below the DIP switches are two pins that can be used as an on/off switch. These pins are labeled **OFF** on the board silk. You can disconnect the internal pass FET by connecting a switch between these two onboard pads. When the switch is _closed_ the output will disconnect / turn off.

![adafruit_products_5991-06.gif](https://cdn-learn.adafruit.com/assets/assets/000/131/489/medium640thumb/adafruit_products_5991-06.jpg?1721761423)

## Power LED and Jumper

- **Power LED -** In the lower left corner, to the left of the terminal block, on the front of the board, is the power LED. It is a green LED.
- **LED jumper** - This jumper is located on the front of the board, above the green LED, and is labeled **LED** on the board silk. Cut the trace on this jumper to cut power to the power LED.

# Adafruit USB Type C Power Delivery Switchable Breakout

## CircuitPython and Python

It's easy to use the **HUSB238** with Python or CircuitPython, and the [Adafruit\_CircuitPython\_HUSB238](https://docs.circuitpython.org/projects/husb238/en/latest/) module. This module allows you to easily write Python code to control the power delivery chip.

You can use this driver with any CircuitPython microcontroller board or with a computer that has GPIO and Python [thanks to Adafruit\_Blinka, our CircuitPython-for-Python compatibility library](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

It's important to note that when you are controlling the breakout over I2C, the DIP switch settings on the board are used on startup until the I2C commands come over.

Warning: When configuring over I2C, the DIP switch settings are used on startup until the I2C commands come over.

## CircuitPython Microcontroller Wiring

First wire up the breakout to your board exactly as follows. For testing, you can connect the **+** and **-** outputs from the breakout to a multimeter with alligator clips. You'll set the multimeter to read DC voltage (labeled with a "V" and one dashed and one solid line). The following is the breakout wired to a Feather RP2040 using a STEMMA QT cable:

- **USB C PD power supply** to **breakout USB C port**
- **Board STEMMA GND** to **breakout STEMMA GND (black wire)**
- **Board STEMMA SCL** to **breakout STEMMA SCL (yellow wire)**
- **Board STEMMA SDA** to **breakout STEMMA SDA (blue wire)**
- **Breakout +** to **multimeter positive (red wire)**
- **Breakout -** to **multimeter negative (black wire)**

![adafruit_products_featherSTEMMA_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/492/medium640/adafruit_products_featherSTEMMA_bb.jpg?1721762689)

### Digital Multimeter - Model 9205B+

[Digital Multimeter - Model 9205B+](https://www.adafruit.com/product/2034)
This massive multimeter has everything but the kitchen sink included. It's a great addition to any workbench or toolbox. &nbsp;It's low cost, simple to use, and has a big clear display with all the measurements you need and more!

The multimeter includes:

- AC/DC Voltage...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2034)
[Related Guides to the Product](https://learn.adafruit.com/products/2034/guides)
![Angled shot of a Digital Multimeter - Model 9205B+. ](https://cdn-shop.adafruit.com/640x480/2034-01.jpg)

## Python Computer Wiring

Since there are _dozens_ of Linux computers/boards you can use, we will show wiring for Raspberry Pi. For other platforms, [please visit the guide for CircuitPython on Linux to see whether your platform is supported](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux).

For testing, you can connect the **+** and **-** outputs from the breakout to a multimeter with alligator clips. You'll set the multimeter to read DC voltage (labeled with a "V" and one dashed and one solid line).

Here's the Raspberry Pi wired with I2C using STEMMA QT cable:

- **USB C PD power supply** to **breakout USB C port**
- **Pi GND** to **breakout STEMMA GND (black wire)**
- **Pi 3.3V** to **breakout STEMMA VIN**
- **Pi SCL** to **breakout STEMMA SCL (yellow wire)**
- **Pi SDA** to **breakout STEMMA SDA (blue wire)**
- **Breakout +** to **multimeter positive (red wire)**
- **Breakout -** to **multimeter negative (black wire)**

![adafruit_products_pi_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/493/medium640/adafruit_products_pi_bb.jpg?1721762708)

## Python Installation of HUSB238 Library

You'll need to install the **Adafruit\_Blinka** library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. [Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready](https://learn.adafruit.com/circuitpython-on-raspberrypi-linux)!

Once that's done, from your command line run the following command:

- `pip3 install adafruit-circuitpython-husb238`

If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported!

## CircuitPython Usage

To use with CircuitPython, you need to first install the **Adafruit\_CircuitPython\_HUSB238** library, and its dependencies, into the **lib** folder on your **CIRCUITPY** drive. Then you need to update **code.py** with the example script.

Thankfully, we can do this in one go. In the example below, click the **Download Project Bundle** button below to download the necessary libraries and the **code.py** file in a zip file. Extract the contents of the zip file, and copy the **entire**  **lib**  **folder** and the **code.py** file to your **CIRCUITPY** drive.

Your **CIRCUITPY/lib** folder should contain the following folders and file:

- **adafruit\_bus\_device/**
- **adafruit\_register/**
- **adafruit\_husb238.mpy**

![CIRCUITPY](https://adafruit.github.io/Adafruit_CircuitPython_Bundle/husb238_husb238_simpletest.py.png )

## Python Usage

Once you have the library `pip3` installed on your computer, copy or download the following example to your computer, and run the following, replacing **code.py** with whatever you named the file:

`python3 code.py`

## Example Code

**If running CircuitPython:** Once everything is saved to the **CIRCUITPY** drive, [connect to the serial console](https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console) to see the data printed out!

**If running Python:** The console output will appear wherever you are running Python.

https://github.com/adafruit/Adafruit_CircuitPython_HUSB238/blob/main/examples/husb238_simpletest.py

For this example, it's best to test with the output from the breakout connected to a multimeter in DC voltage mode. DC voltage mode is labeled with a V and two lines, one dashed and one solid. [For information on using a multimeter, check out this guide.](https://learn.adafruit.com/multimeters/overview)

![components_instruments_masdcvoltage.jpg](https://cdn-learn.adafruit.com/assets/assets/000/125/190/medium640/components_instruments_masdcvoltage.jpg?1697468167)

[Multimeters Learn Guide](https://learn.adafruit.com/multimeters/overview)
In the example, the HUSB238 is instantiated over I2C. Then, the available voltages are read from the attached USB-C PD power supply. In the loop, the available voltages are set, one by one, by the HUSB238. You'll see these output on your multimeter. The voltage and current are read from the PD supply and are printed to the serial console.

![](https://cdn-learn.adafruit.com/assets/assets/000/125/579/medium800/components_cp_serial.png?1698176120)

# Adafruit USB Type C Power Delivery Switchable Breakout

## Python Docs

# Adafruit USB Type C Power Delivery Switchable Breakout

## Arduino

Using the HUSB238 breakout with Arduino involves wiring up the breakout to your Arduino-compatible microcontroller, installing the [Adafruit\_HUSB238](https://github.com/adafruit/Adafruit_HUSB238) library, plugging in a USB C PD power supply to the breakout and running the provided example code. It's important to note that when you are controlling the breakout over I2C, the DIP switch settings on the board are used on startup until the I2C commands come over.

Warning: When configuring over I2C, the DIP switch settings are used on startup until the I2C commands come over.

## Wiring

Here is an Adafruit Metro wired up to the breakout. For testing, you can connect the **+** and **-** outputs from the breakout to a multimeter with alligator clips. You'll set the multimeter to read DC voltage (labeled with a "V" and one dashed and one solid line).

- **USB C PD power supply** to **breakout USB C port**
- **Board GND** to **breakout STEMMA GND (black wire)**
- **Board 5V** to **breakout STEMMA VIN (red wire)**
- **Board SCL** to **breakout SCL (yellow wire)**
- **Board SDA** to **breakout SDA (blue wire)**
- **Breakout +** to **multimeter positive (red wire)**
- **Breakout -** to **multimeter negative (black wire)**

![adafruit_products_metro_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/494/medium640/adafruit_products_metro_bb.jpg?1721762730)

### Digital Multimeter - Model 9205B+

[Digital Multimeter - Model 9205B+](https://www.adafruit.com/product/2034)
This massive multimeter has everything but the kitchen sink included. It's a great addition to any workbench or toolbox. &nbsp;It's low cost, simple to use, and has a big clear display with all the measurements you need and more!

The multimeter includes:

- AC/DC Voltage...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2034)
[Related Guides to the Product](https://learn.adafruit.com/products/2034/guides)
![Angled shot of a Digital Multimeter - Model 9205B+. ](https://cdn-shop.adafruit.com/640x480/2034-01.jpg)

## Library Installation

You can install the **Adafruit\_HUSB238** library for Arduino using the Library Manager in the Arduino IDE.

![](https://cdn-learn.adafruit.com/assets/assets/000/124/720/medium800/adafruit_products_Arduino_Open_Library_Manager.png?1695739512)

Click the **Manage Libraries ...** menu item, search for **Adafruit\_HUSB238** , and select the **Adafruit HUSB238** library:

![](https://cdn-learn.adafruit.com/assets/assets/000/124/721/medium800/adafruit_products_arduino_lib.png?1695739568)

If asked about dependencies, click "Install all".

![](https://cdn-learn.adafruit.com/assets/assets/000/124/722/medium800/adafruit_products_depends.png?1695739602)

If the "Dependencies" window does not come up, then you already have the dependencies installed.

Warning: 

## Simple Test
https://github.com/adafruit/Adafruit_HUSB238/blob/main/examples/HUSB238_test/HUSB238_test.ino

Upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 115200 baud. You'll see the HUSB238 recognized over I2C by the code. It will set the voltage to 5V over I2C. Then, it will query the attached PD adapter to see which voltage and current combinations are available and print the currently set voltage.

![](https://cdn-learn.adafruit.com/assets/assets/000/124/723/medium800/adafruit_products_testSketchSerial.png?1695739726)

## Test All Voltages Example
For this example, it's best to test with the output from the breakout connected to a multimeter in DC voltage mode. DC voltage mode is labeled with a V and two lines, one dashed and one solid. [For information on using a multimeter, check out this guide.](https://learn.adafruit.com/multimeters/overview)

![adafruit_products_instruments_masdcvoltage.jpg](https://cdn-learn.adafruit.com/assets/assets/000/124/724/medium640/adafruit_products_instruments_masdcvoltage.jpg?1695739940)

[Multimeters Learn Guide](https://learn.adafruit.com/multimeters/overview)
https://github.com/adafruit/Adafruit_HUSB238/blob/main/examples/HUSB238_TryAllVoltages/HUSB238_TryAllVoltages.ino

Upload the sketch to your board and open up the Serial Monitor ( **Tools -\> Serial Monitor** ) at 115200 baud. You'll see the HUSB238 recognized over I2C by the code. Then, it will try setting a new voltage one after the other. As the Serial Monitor updates, you should see the same voltage read by your multimeter.

![](https://cdn-learn.adafruit.com/assets/assets/000/124/725/medium800/adafruit_products_allVoltsSerial.png?1695740087)

# Adafruit USB Type C Power Delivery Switchable Breakout

## Arduino Docs

# Adafruit USB Type C Power Delivery Switchable Breakout

## Downloads

## Files

- [HUSB238 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/125/150/original/husb238_datasheet_full.pdf?1697209172)
- [EagleCAD PCB Files on GitHub](https://github.com/adafruit/Adafruit-USB-Type-C-PD-Switchable-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20USB%20Type%20C%20Power%20Delivery%20Dummy%20-%20I2C%20or%20Switchable%20-%20HUSB238%20-%20STEMMA%20QT.fzpz)
- [3D Models on GitHub](https://github.com/adafruit/Adafruit_CAD_Parts/tree/main/5991%20HUSB238%20USBC)

## Schematic and Fab Print
![](https://cdn-learn.adafruit.com/assets/assets/000/131/415/medium800/adafruit_products_schem.png?1721653532)

![](https://cdn-learn.adafruit.com/assets/assets/000/131/416/medium800/adafruit_products_fab.png?1721653539 dimensions are in inches)

## 3D Model
![](https://cdn-learn.adafruit.com/assets/assets/000/131/977/medium800/adafruit_products_5991_HUSB238_USBC.jpg?1724336387)


## Primary Products

### Adafruit USB Type C Power Delivery Dummy - I2C or Switchable

[Adafruit USB Type C Power Delivery Dummy - I2C or Switchable](https://www.adafruit.com/product/5991)
The HUSB238 USB PD sink chip is neat in that you can either use switches&nbsp;(really, resistor selection) to set the desired PD voltage&nbsp;_or_&nbsp;use I2C for dynamic querying and setting. We already stock a simple&nbsp; **<a...></a...>**

In Stock
[Buy Now](https://www.adafruit.com/product/5991)
[Related Guides to the Product](https://learn.adafruit.com/products/5991/guides)

## Featured Products

### USB C to USB C Cable - USB 3.1 Gen 4 with E-Mark - 1 meter long

[USB C to USB C Cable - USB 3.1 Gen 4 with E-Mark - 1 meter long](https://www.adafruit.com/product/4199)
As technology changes and adapts, so does Adafruit! Rather than the regular USB A, this cable has&nbsp; **USB C to USB C** &nbsp;plugs!

USB C is the latest industry-standard connector for transmitting data&nbsp;_and_&nbsp;power. Like Lightning and MagSafe cables, USB C...

Out of Stock
[Buy Now](https://www.adafruit.com/product/4199)
[Related Guides to the Product](https://learn.adafruit.com/products/4199/guides)
### Small Alligator Clip to Male Jumper Wire Bundle - 6 Pieces

[Small Alligator Clip to Male Jumper Wire Bundle - 6 Pieces](https://www.adafruit.com/product/3448)
When working&nbsp;with unusual non-header-friendly surfaces, these handy cables will be your best friends! No longer will you have long, cumbersome strands of alligator clips. These compact jumper cables have a premium male header on one end and a grippy mini alligator clip on the...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3448)
[Related Guides to the Product](https://learn.adafruit.com/products/3448/guides)
### Digital Multimeter - Model 9205B+

[Digital Multimeter - Model 9205B+](https://www.adafruit.com/product/2034)
This massive multimeter has everything but the kitchen sink included. It's a great addition to any workbench or toolbox. &nbsp;It's low cost, simple to use, and has a big clear display with all the measurements you need and more!

The multimeter includes:

- AC/DC Voltage...

Out of Stock
[Buy Now](https://www.adafruit.com/product/2034)
[Related Guides to the Product](https://learn.adafruit.com/products/2034/guides)

## Related Guides

- [Plantagotchi: PyBadge Plant Monitor](https://learn.adafruit.com/plantagotchi-pybadge-plant-monitor.md)
- [Tappy Robotic Hand](https://learn.adafruit.com/robotic-tapping-hand-with-cpx.md)
- [Archimedes' Boat](https://learn.adafruit.com/archimedes-boat.md)
- [Desktop Dumpster Fire](https://learn.adafruit.com/desktop-dumpster-fire.md)
- [Slider Crank Mechanism -- from Cardboard and Craft Sticks](https://learn.adafruit.com/cardboard-slider-crank.md)
- [Circuit Playground Express Head-Tilt Ears](https://learn.adafruit.com/circuit-playground-express-head-tilt-ears.md)
- [Circuit Playground Express Serial Communications](https://learn.adafruit.com/circuit-playground-express-serial-communications.md)
- [Grand Central Soundboard in Ten Minutes](https://learn.adafruit.com/grand-central-soundboard-in-ten-minutes.md)
- [Motion Gift Box](https://learn.adafruit.com/motion-gift-box.md)
- [Esenciales para CircuitPython](https://learn.adafruit.com/esenciales-para-circuitpython.md)
- [Best Beginner Boards for Teachers](https://learn.adafruit.com/best-beginner-boards-for-teachers.md)
- [Automation with Crickit and Capsela](https://learn.adafruit.com/automation-with-crickit-and-capsela.md)
- [Adafruit HUSB238 USB Type C Power Delivery Breakout](https://learn.adafruit.com/adafruit-husb238-usb-type-c-power-delivery-breakout.md)
- [Color Spinner Camera Ring Light ](https://learn.adafruit.com/camera-ring-light-with-cpx.md)
- [Make It Bubble](https://learn.adafruit.com/make-it-bubble.md)
