# Adafruit QT Py CH32V203

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/131/531/medium800/hacks_5996-05.jpg?1721917895)

What a cutie pie! Or is it... a QT Py? This diminutive dev board features the powerful CH32V203 low-cost processor that's all the trend: based on RISC-V and cheaper than an 8-bit core! This little one is a great way to get started in the CH32x processor family, with everything you need to build many USB-based projects at an excellent price.

![](https://cdn-learn.adafruit.com/assets/assets/000/131/532/medium800/hacks_5996-02.jpg?1721917922)

The **CH32V203G6** has a single 32-bit RISC-V core, running up to 144MHz, with 1-cycle multiply/divide. Inside is 10KB SRAM, 32KB single-cycle Flash as well as an additional 'external XIP' 224KB of Flash that can be used for program or data storage but is not as fast as the 32KB. There's also extras you expect: ADC, timers, USB device, UART, I2C and SPI.

![](https://cdn-learn.adafruit.com/assets/assets/000/131/533/medium800/hacks_5996-04.jpg?1721917961)

 **However, please note that the CH32 series is not supported nearly-as-well as ATmega, ESP32, ATSAMD, STM32, or RP2040 chips that have a strong company-led development community.** WCH is very "it's a low cost chip, you figure it out" kind of company, and while there is some community-led development, it is still best used by folks comfortable with having to use Makefiles, clone git repositories, edit configuration files, etc. **It definitely does _not_ run CircuitPython or Micropython, and Arduino support is very early.** It's definitely not good for beginners!

![](https://cdn-learn.adafruit.com/assets/assets/000/131/534/medium800/hacks_5996-03.jpg?1721918025)

If you're interested in playing with the CH32V203, we've wrapped it up in a QT Py format. The pinout and shape is [Seeed Xiao](https://wiki.seeedstudio.com/Seeeduino-XIAO/) compatible, with castellated pads so you can solder it flat to a PCB. It comes with [our favorite connector - the STEMMA QT](http://adafruit.com/stemma), a chainable I2C port that can be used with [any of our STEMMA QT sensors and accessories](https://www.adafruit.com/category/620). We also added an RGB NeoPixel and both a reset button and 'bootloader enter' button that allows you to upload code over USB without a WCH LINKE or similar SWD programmer.

![](https://cdn-learn.adafruit.com/assets/assets/000/131/535/medium800/hacks_5996-01.jpg?1721918086)

- Same size, form-factor, and pin-out as Seeed Xiao
- **USB Type C connector** - [If you have only Micro B cables, this adapter will come in handy](https://www.adafruit.com/product/4299)!
- **CH32V203G8 RISC-V** microcontroller core with 3.3V power/logic. Internal 144 MHz oscillator.
- **Native USB Device** - [We do have USB CDC support via TinyUSB but its pretty chunky](https://github.com/openwch/arduino_core_ch32/pull/129) - upload can also be done via USB
- **Built in RGB NeoPixel LED**
- **10 GPIO pins:**
  - ADC input on all GPIOs
  - I2C port with STEMMA QT plug-n-play connector
  - Hardware UART
  - Hardware SPI

- 3.3V regulator with [**600mA peak output**](https://www.diodes.com/assets/Datasheets/AP2112.pdf)
- **Reset switch and bootloader switch** for starting your project code over or entering USB ROM bootloader mode
- SWD data/clock pads on the bottom for advanced debugging usage
- **Really really small**

# Adafruit QT Py CH32V203

## Pinouts

![](https://cdn-learn.adafruit.com/assets/assets/000/131/554/medium800/hacks_double.jpg?1722253960)

Warning: This QT Py does not run CircuitPython or MicroPython and Arduino support is very early.

![](https://cdn-learn.adafruit.com/assets/assets/000/132/173/medium800/hacks_Artboard_1-100.jpg?1725888047)

PrettyPins PDF [on GitHub](https://github.com/adafruit/Adafruit-QT-Py-CH32V203-PCB/blob/main/Adafruit%20QT%20Py%20CH32V203%20PrettyPins.pdf).

## Power
- **USB-C port** - This is used for both powering and programming the board. You can power it with any USB C cable.
- **3V** - This pin is the output from the [3.3V regulator](https://www.diodes.com/assets/Datasheets/AP2112.pdf), it can supply 600mA peak.
- **GND** - This is the common ground for all power and logic.
- **5V** - This is 5V out from the USB port.&nbsp;

![hacks_power.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/555/medium640/hacks_power.jpg?1722256955)

## CH32V203 Chip
The **CH32V203G6** has a single 32-bit RISC-V core, running up to 144MHz, with 1-cycle multiply/divide. Inside is 10KB SRAM, 32KB single-cycle Flash as well as an additional 'external XIP' 224KB of Flash that can be used for program or data storage but it's not as fast as the 32KB. There are also extras you expect: ADC, timers, USB device, UART, I2C and SPI.

![hacks_ch32.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/556/medium640/hacks_ch32.jpg?1722257014)

## Logic Pins
There are ten GPIO pins broken out to pins. There is hardware I2C, UART, and SPI. All of the GPIO have an ADC input.

![hacks_logic.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/557/medium640/hacks_logic.jpg?1722257544)

### I2C

- **SCL** - This is the I2C clock pin. There is _no_ pull-up on this pin, so for I2C please add an external pull-up if the breakout doesn't have one already. It's connected to PB6.
- **SDA** - This is the I2C data pin. There is _no_ pull-up on this pin, so for I2C please add an external pull-up if the breakout doesn't have one already. It's connected to PB7.

These pins are also connected to the STEMMA QT port.

### UART

- **RX** - This is the UART receive pin. Connect to TX (transmit) pin on your sensor or breakout. It's connected to PA3.
- **TX** - This is the UART transmit pin. Connect to RX (receive) pin on your sensor or breakout. It's connected to PA2.

### SPI

- **SCK** - This is the SPI clock pin. It's connected to PA5.
- **MI** - This is the SPI **M** icrocontroller **I** n / **S** ensor **O** ut pin. It's connected to PA6.
- **MO** - This is the SPI **M** icrocontroller **O** ut / **S** ensor **I** n pin. It's connected to PA7.

## STEMMA QT Connector
This **JST SH 4-pin [STEMMA QT](https://learn.adafruit.com/introducing-adafruit-stemma-qt) connector** is located at the back of the board. It allows you to connect to&nbsp;[various breakouts and sensors with **STEMMA QT** connectors](https://www.adafruit.com/category/1018) or to other things using&nbsp;[assorted associated accessories](https://www.adafruit.com/?q=JST%20SH%204). It works great with any STEMMA QT or Qwiic sensor/device. You can also use it with Grove I2C devices thanks to [this handy cable](https://www.adafruit.com/product/4528).

![hacks_stemma.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/606/medium640/hacks_stemma.jpg?1722260980)

## NeoPixel LED
Next to the **BOOT** button, in the center of the board, is the **RGB NeoPixel LED**. This addressable LED can be controlled with code. It is connected to PA4.

![hacks_neo.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/607/medium640/hacks_neo.jpg?1722261052)

## Buttons
- **Reset button** - This button restarts the board and helps enter the bootloader. You can click it once to reset the board without unplugging the USB cable or battery.
- **BOOT button** - This button is connected to PB8/BOOT0. To enter bootloader mode, disconnect the QT Py from USB power. Hold down the **BOOT** button and reconnect USB power.

![hacks_buttons.jpg](https://cdn-learn.adafruit.com/assets/assets/000/131/608/medium640/hacks_buttons.jpg?1722261128)

# Adafruit QT Py CH32V203

## Arduino IDE Setup

You've seen the warnings that you definitely can't use this QT Py with CircuitPython or MicroPython. What you&nbsp;_can_ do though is use the [arduino\_core\_ch32 board support package](https://github.com/openwch/arduino_core_ch32) to write code in the Arduino IDE.

Support for the CH32V203 in the Arduino IDE is very new and Adafruit has contributed some changes to make interfacing with the QT Py easier. As a result, the steps on this page are more involved than what you may be used to when setting up the Arduino IDE for a new development board.

## Install Arduino IDE

The first thing you will need to do is to download the latest release of the Arduino IDE. You will need to&nbsp;be using&nbsp; **version 1.8** &nbsp;or higher for this guide.

[Arduino IDE Download](http://www.arduino.cc/en/Main/Software)
## Install the arduino\_core\_ch32 Board Support Package

After you have downloaded and installed **the latest version of Arduino IDE** , you will need to start the IDE and navigate to the **Preferences** menu. You can access it from the **File** menu in _Windows_ or _Linux_, or the **Arduino** menu on _OS X_.

![arduino](https://cdn-learn.adafruit.com/assets/assets/000/101/639/original/esp32_s2_arduino_ide_setup_flora_prefs.png?1618870383 )

A dialog will pop up just like the one shown below.

![preference](https://cdn-learn.adafruit.com/assets/assets/000/101/640/original/esp32_s2_arduino_ide_setup_flora_Screen_Shot_2015-05-07_at_9.07.21_AM.png?1618870405 )

We will be adding a URL to the new **Additional Boards Manager URLs** option. The list of URLs is comma separated, and _you will only have to add each URL once._ New Adafruit boards and updates to existing boards will automatically be picked up by the Board Manager each time it is opened. The URLs point to index files that the Board Manager uses to build the list of available & installed boards.

To find the most up to date list of URLs you can add, you can visit the list of [third party board URLs on the Arduino IDE wiki](https://github.com/arduino/Arduino/wiki/Unofficial-list-of-3rd-party-boards-support-urls#list-of-3rd-party-boards-support-urls). We will only need to add one URL to the IDE in this example, but _ **you can add multiple URLS by separating them with commas** _. Copy and paste the link below into the **Additional Boards Manager URLs** option in the Arduino IDE preferences.

```html
https://github.com/openwch/board_manager_files/raw/main/package_ch32v_index.json
```

![](https://cdn-learn.adafruit.com/assets/assets/000/131/609/medium800/hacks_bspJson.png?1722262092)

If you have multiple boards you want to support, say ESP8266 and Adafruit, have both URLs in the text box separated by a comma (,)

Once done click **OK** to save the new preference settings.

## Installation Prerequisites

Before you install the board support package via the Arduino IDE, make sure to check the [toolchain prerequisites for your operating system](https://github.com/openwch/arduino_core_ch32?tab=readme-ov-file#os-support) in the board support package repository. It's very important that you follow the steps listed in the README before installing the board support package in the Arduino IDE.

Warning: Follow the steps listed in the GitHub README for your operating system before installing the board support package in the Arduino IDE.

## Install with the Board Manager

The next step is to actually install the Board Support Package (BSP). Go to the&nbsp; **Tools → Board → Boards Manager** submenu. A dialog should come up with various BSPs. Search for **ch32**.

![](https://cdn-learn.adafruit.com/assets/assets/000/131/610/medium800/hacks_installBSP.png?1722262111)

Click the **Install** button and wait for it to finish. Once it is finished, you can close the dialog. This takes care of installing all of the backend dependencies and toolchain for the WCH chips.

## Install the Adafruit TinyUSB Arduino Library

A lot of effort and time has been put into updating the TinyUSB Arduino library to support the CH32V203 QT Py. These updates allow you to upload code easily to the QT Py over USB. You'll need to [install version 3.3.3](https://github.com/adafruit/Adafruit_TinyUSB_Arduino/releases/tag/3.3.3) or newer to use these changes.

Warning: Version 3.3.3 or newer of the Arduino TinyUSB Library is required to properly interface with the QT Py

![](https://cdn-learn.adafruit.com/assets/assets/000/132/162/medium800/hacks_Arduino_Open_Library_Manager.png?1725634433)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/132/164/medium800/hacks_Screenshot_2024-09-06_105317.png?1725634482)

If asked about dependencies, click "Install all".

![](https://cdn-learn.adafruit.com/assets/assets/000/132/165/medium800/hacks_Screenshot_2024-09-06_105506.png?1725634515)

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

## Manually Install the arduino\_core\_ch32 Board Support Package

A pull request was recently merged to the CH32 board support package to add a board definition for the QT Py CH32V203. Until a new release is made, you'll want to manually install&nbsp;the board support package to get these newest features. To do this, you'll need to&nbsp; **git clone** the repository into the **hardware** folder inside of your&nbsp; **Arduino** folder in your filesystem.

You can do this using the GitHub Desktop app or by using&nbsp;`git` in the terminal:

```terminal
cd /path/to/Arduino/hardware
git clone https://github.com/openwch/arduino_core_ch32.git
```

There is one final step to have the manual installation of the board support package appear in the Arduino IDE. Navigate to the **arduino\_core\_ch32** folder inside of the **hardware** folder. You'll need to **create a new folder called WCH**. **Move the contents of the arduino\_core\_ch32** folder that you just cloned into that **WCH folder**.

Your new folder hierarchy should be **Arduino/hardware/arduino\_core\_ch32/WCH**

![](https://cdn-learn.adafruit.com/assets/assets/000/132/160/medium800/hacks_Screenshot_2024-09-06_103924.png?1725633583)

You may need to update the Adafruit TinyUSB submodule that came with the git clone by doing this:

```terminal
cd /path/to/Arduino/hardware/arduino_core_ch23/WCH
git submodule update --init
```

Restart the Arduino IDE to be sure that it grabs the forked board support package in the hardware folder.

## Code Upload Options

In the **Tools → Board** submenu you should see **CH32V EVT Boards Support** **(in sketchbook)**. This is the manual installation that you just cloned into your **hardware** folder.

![](https://cdn-learn.adafruit.com/assets/assets/000/132/161/medium800/hacks_Screenshot_2024-09-06_104139.png?1725633733)

Under **Board** , select **CH32V20x**.

![](https://cdn-learn.adafruit.com/assets/assets/000/132/240/medium800/hacks_Screenshot_2024-09-10_132546.png?1725989166)

Under **Board Select** , select **Adafruit QTPy CH32V203G6**.&nbsp;Under **USB Support** , select **Adafruit TinyUSB with USBD**. These settings will work with the CH32V203 QT Py.

Danger: If you're not able to upload to the board, you may need to 'manually' put it into bootloader mode and use the WCHISP tool. Check this page https://learn.adafruit.com/adafruit-qt-py-ch32v203/bootloader-mode

# Adafruit QT Py CH32V203

## Blink

Blinking an LED is a great way to determine that you have your hardware and software ducks in a row. In this example, you'll breadboard an LED to the **MISO** pin ( **PA6** ), upload the example code and see your LED blink on and off every second.

### Diffused 10mm LED Pack - 5 LEDs each in 5 Colors - 25 Pack

[Diffused 10mm LED Pack - 5 LEDs each in 5 Colors - 25 Pack](https://www.adafruit.com/product/4204)
Need some chunky indicators? We are big fans of these diffused LEDs. They are fairly bright, so they can be seen in daytime, and from any angle. They go easily into a breadboard and will add that extra zing to your project.

Now you can get a pack of 25 with 5 different...

In Stock
[Buy Now](https://www.adafruit.com/product/4204)
[Related Guides to the Product](https://learn.adafruit.com/products/4204/guides)
![scattered pile of multi colored unlit LEDs ](https://cdn-shop.adafruit.com/640x480/4204-00.jpg)

## Wiring
- **Board GND** to **LED cathode (black wire)**
- **Board MISO** to **LED anode (red wire)**

![adafruit_products_blink_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/129/893/medium640/adafruit_products_blink_bb.jpg?1715178781)

## Blink Example
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/QT_Py_CH32_Examples/Blink_QTPyCH32/Blink_QTPyCH32.ino

You'll notice that at the top of the code that the TinyUSB library is imported with `#include <Adafruit_TinyUSB.h>`. This will allow access to the USB serial port on the QT Py.

Confirm that your upload settings match the settings listed here under **Tools** :

- Board: **CH32V20x**
- Board Select: **Adafruit QTPy CH32V203G6**
- USB support: **Adafruit TinyUSB with USBD**

For the port, select the COM port that matches your QT Py. It will not be labeled like you may be used to with other boards in the Arduino IDE.

![hacks_Screenshot_2024-09-09_093237.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/179/medium640/hacks_Screenshot_2024-09-09_093237.jpg?1725888941)

Upload the sketch to your board. You should see the LED blink on and off every second.&nbsp;

![adafruit_products_blink.gif](https://cdn-learn.adafruit.com/assets/assets/000/129/908/medium640thumb/adafruit_products_blink.jpg?1715196572)

If you open the Serial Monitor, you'll see `LED on` and `LED off` print out in unison with the blinking LED.

![hacks_Screenshot_2024-09-09_094143.png](https://cdn-learn.adafruit.com/assets/assets/000/132/180/medium640/hacks_Screenshot_2024-09-09_094143.png?1725889332)

Danger: If you're not able to upload to the board, you may need to 'manually' put it into bootloader mode and use the WCHISP tool. Check this page https://learn.adafruit.com/adafruit-qt-py-ch32v203/bootloader-mode

# Adafruit QT Py CH32V203

## I2C Scan Test

A lot of sensors, displays, and devices can connect over I2C. I2C is a 2-wire 'bus' that allows multiple devices to all connect on one set of pins so it's very convenient for wiring!

When using your board, you'll probably want to connect up I2C devices, and it can be a little tricky the first time. The best way to debug I2C is go through a checklist and then perform an I2C scan

# Common I2C Connectivity Issues

- **Have you connected four wires (at a minimum) for each I2C device?** Power the device with whatever is the logic level of your microcontroller board (probably 3.3V), then a ground wire, and a SCL clock wire, and and a SDA data wire.
- **If you're using a STEMMA QT board - check if the power LED is lit.** It's usually a green LED to the left side of the board.
- **Does the STEMMA QT/I2C port have switchable power or pullups?** To reduce power, some boards have the ability to cut power to I2C devices or the pullup resistors. Check the documentation if you have to do something special to turn on the power or pullups.
- **If you are using a DIY I2C device, do you have pullup resistors?** Many boards do _not_ have pullup resistors built in and they are _required!_ We suggest any common 2.2K to 10K resistors. You'll need two: one each connects from SDA to positive power, and SCL to positive power. Again, positive power (a.k.a VCC, VDD or V+) is often 3.3V
- **Do you have an address collision?** You can only have _one_ board per address. So you cannot, say, connect two AHT20's to one I2C port because they have the same address and will interfere. Check the sensor or documentation for the address. Sometimes there are ways to adjust the address.
- **Does your board have multiple I2C ports?** Historically, boards only came with one. But nowadays you can have two or even three! This can help solve the "hey, but what if I want two devices with the same address" problem: just put one on each bus.
- **Are you hot-plugging devices?** I2C does _not_ support dynamic re-connection, you cannot connect and disconnect sensors as you please. They should all be connected on boot and not change. ([Only exception is if you're using a hot-plug assistant but that'll cost you](https://www.adafruit.com/product/5159)).
- **Are you keeping the total bus length reasonable?** I2C was designed for maybe 6" max length. We like to push that with plug-n-play cables, but really please keep them as short as possible! ([Only exception is if you're using an active bus extender](https://www.adafruit.com/product/4756)).

# Perform an I2C scan!

### Install TestBed Library

To scan I2C, the Adafruit TestBed library is used. This library and example just makes the scan a little easier to run because it takes care of some of the basics. You will need to add support by installing the library. Good news: it is _very easy_ to do it. Go to the **Arduino Library Manager.**

![](https://cdn-learn.adafruit.com/assets/assets/000/107/555/medium800/i2c_scan_test_installlib.png?1640562425)

Search for **TestBed** and install the **Adafruit TestBed** library

![](https://cdn-learn.adafruit.com/assets/assets/000/107/556/medium800/i2c_scan_test_testbedlib.png?1640562581)

Now open up the I2C Scan example

![](https://cdn-learn.adafruit.com/assets/assets/000/107/557/medium800/i2c_scan_test_i2cscan.png?1640562632)

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/I2C_Scanners/arduino/i2c_scanner/i2c_scanner.ino

### Wire up I2C device

While the examples here will be using the [Adafruit MCP9808](https://www.adafruit.com/product/5027), a high accuracy temperature sensor, the overall process is the same for just about any I2C sensor or device.

The first thing you'll want to do is get the sensor connected so your board has I2C to talk to.

### Adafruit MCP9808 High Accuracy I2C Temperature Sensor Breakout

[Adafruit MCP9808 High Accuracy I2C Temperature Sensor Breakout](https://www.adafruit.com/product/5027)
The MCP9808 digital temperature sensor is one of the more accurate/precise we've ever seen, with a typical accuracy of ±0.25°C over the sensor's -40°C to +125°C range and precision of +0.0625°C. They work great with any microcontroller using standard I2C. With...

In Stock
[Buy Now](https://www.adafruit.com/product/5027)
[Related Guides to the Product](https://learn.adafruit.com/products/5027/guides)
![Top view of temperature sensor breakout above an OLED display FeatherWing. The OLED display reads "MCP9808 Temp: 24.19ºC"](https://cdn-shop.adafruit.com/640x480/5027-04.jpg)

### STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long

[STEMMA QT / Qwiic JST SH 4-Pin Cable - 50mm Long](https://www.adafruit.com/product/4399)
This 4-wire cable is&nbsp;50mm / 1.9" long and fitted with JST SH female 4-pin connectors on both ends. Compared with the chunkier JST PH these are 1mm pitch instead of 2mm, but still have a nice latching feel, while being easy to insert and remove.

<a...></a...>

In Stock
[Buy Now](https://www.adafruit.com/product/4399)
[Related Guides to the Product](https://learn.adafruit.com/products/4399/guides)
![Angled of of JST SH 4-Pin Cable.](https://cdn-shop.adafruit.com/640x480/4399-00.jpg)

## Wiring the MCP9808

The MCP9808 comes with a STEMMA QT connector, which makes wiring it up quite simple and solder-free.

![](https://cdn-learn.adafruit.com/assets/assets/000/132/186/medium800/hacks_i2cFritz_bb.jpg?1725890644)

Now upload the scanning sketch to your microcontroller and open the serial port to see the output. You should see something like this:

![](https://cdn-learn.adafruit.com/assets/assets/000/132/185/medium800/hacks_Screenshot_2024-09-06_180946.png?1725890454)

# Adafruit QT Py CH32V203

## NeoPixel

In this example, you'll upload the sketch to have the onboard NeoPixel (pin PA4) perform a rainbow swirl.

![](https://cdn-learn.adafruit.com/assets/assets/000/129/906/medium800thumb/adafruit_products_neopixel.jpg?1715196551)

## Library Installation

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

![](https://cdn-learn.adafruit.com/assets/assets/000/132/183/medium800/hacks_Arduino_Open_Library_Manager.png?1725889720)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/132/184/medium800/hacks_Screenshot_2024-09-09_095020.png?1725889851)

Info: There are no additional dependencies for this library.

## NeoPixel Example
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/QT_Py_CH32_Examples/Neopixel_QTPyCH32/Neopixel_QTPyCH32.ino

You'll notice that at the top of the code that the TinyUSB library is imported with `#include <Adafruit_TinyUSB.h>`. This will allow access to the USB serial port on the QT Py.

Confirm that your upload settings match the settings listed here under **Tools** :

- Board: **CH32V20x**
- Board Select: **Adafruit QTPy CH32V203G6**
- USB support: **Adafruit TinyUSB with USBD**

For the port, select the COM port that matches your QT Py. It will not be labeled like you may be used to with other boards in the Arduino IDE.

![hacks_Screenshot_2024-09-09_093237.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/182/medium640/hacks_Screenshot_2024-09-09_093237.jpg?1725889632)

Upload the sketch to your board. You'll see the NeoPixel begin swirling thru the colors of the rainbow. This is the same demo that ships on the boards.

![adafruit_products_neopixel.gif](https://cdn-learn.adafruit.com/assets/assets/000/129/907/medium640thumb/adafruit_products_neopixel.jpg?1715196560)

# Adafruit QT Py CH32V203

## HID Keyboard

In this example, you'll upload the sketch to turn your QT Py into a simple four key keyboard.

## Wiring
- **Button 1 input** to **board A0 (blue wire)**
- **Button 1 ground** to **board GND (black wire)**
- **Button 2 input** to **board A1 (green wire)**
- **Button 2 ground** to **board GND (black wire)**
- **Button 3 input** to **board A2 (yellow wire)**
- **Button 3 ground** to **board GND (black wire)**
- **Button 4 input** to **board A3 (orange wire)**
- **Button 4 ground** to **board GND (black wire)**

![hacks_hidFritz_bb.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/199/medium640/hacks_hidFritz_bb.jpg?1725894181)

## Library Installation

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

![](https://cdn-learn.adafruit.com/assets/assets/000/132/183/medium800/hacks_Arduino_Open_Library_Manager.png?1725889720)

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

![](https://cdn-learn.adafruit.com/assets/assets/000/132/184/medium800/hacks_Screenshot_2024-09-09_095020.png?1725889851)

Info: There are no additional dependencies for this library.

This example also requires the Adafruit TinyUSB library. You should already have this library installed after following the [steps on the Arduino IDE](https://learn.adafruit.com/adafruit-qt-py-ch32v203/arduino-ide-setup#install-the-adafruit-tinyusb-arduino-library-3182113) setup page.

## HID Keyboard Example
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/QT_Py_CH32_Examples/HID_Keyboard_QTPyCH32/HID_Keyboard_QTPyCH32.ino

Confirm that your upload settings match the settings listed here under **Tools** :

- Board: **CH32V20x**
- Board Select: **Adafruit QTPy CH32V203G6**
- USB support: **Adafruit TinyUSB with USBD**

For the port, select the COM port that matches your QT Py. It will not be labeled like you may be used to with other boards in the Arduino IDE.

![hacks_Screenshot_2024-09-09_093237.jpg](https://cdn-learn.adafruit.com/assets/assets/000/132/182/medium640/hacks_Screenshot_2024-09-09_093237.jpg?1725889632)

Upload the sketch to your board. When you press the buttons connected to pins A0-A3, you'll type 0, 1, 2 or 3.

You can customize the code to send different keycodes. Edit the `hidcode[]` with the keycodes of your choice.

```cpp
// For keycode definition check out https://github.com/hathach/tinyusb/blob/master/src/class/hid/hid.h
uint8_t hidcode[] = {HID_KEY_0, HID_KEY_1, HID_KEY_2, HID_KEY_3};
```

# Adafruit QT Py CH32V203

## Using WCHISP Tool

Uploading directly to the QT Py USB port with the Arduino IDE is very convenient. However, if you find that you can't access the COM port or have problems with your toolchain then you may need to utilize uploading code in bootloader mode with the&nbsp;[WCHISP tool](https://github.com/ch32-rs/wchisp). The WCHISP tool is a command line implementation of the WCHISP tool in Rust.&nbsp;

You can get your QT Py CH32V203 into bootloader mode by unplugging the USB port, holding down the **Boot** button and plugging the USB cable back in.&nbsp;

## Install WCHISP Tool

There are prebuilt binaries of the WCHISP tool on the GitHub repository. Navigate to the [releases page](https://github.com/ch32-rs/wchisp/releases) and download the binary for your operating system. After installing, the tool will be available in a folder:

![](https://cdn-learn.adafruit.com/assets/assets/000/132/187/medium800/hacks_Screenshot_2024-09-09_102419.png?1725891887)

## Using WCHISP Tool

After you install the tool, navigate to its directory in your terminal:

```terminal
cd /path/to/wchisp
```

Place the QT Py into bootloader mode by holding down the BOOT button and plugging it in via USB. To confirm that your board is connected, you can run `wchisp` in the terminal. You should see that the tool has found the device:

![](https://cdn-learn.adafruit.com/assets/assets/000/132/188/medium800/hacks_Screenshot_2024-09-09_102616.png?1725892014)

To flash code onto the board, you'll need a compiled binary file. These files can be compiled in the Arduino IDE by going to&nbsp; **Sketch - Export compiled Binary**. The binary file will be exported to the Sketch folder. Make sure to use the same [board settings](https://learn.adafruit.com/adafruit-qt-py-ch32v203/arduino-ide-setup#code-upload-options-3176951) that are described on the Arduino IDE pages in this guide.

![hacks_Screenshot_2024-09-09_102816.png](https://cdn-learn.adafruit.com/assets/assets/000/132/190/medium640/hacks_Screenshot_2024-09-09_102816.png?1725892205)

Compiled binary files are available for the [examples in this guide](https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/main/QT_Py_CH32_Examples) in the Learn repository. You can also use the [Factory Reset binary](https://github.com/adafruit/Adafruit-QT-Py-CH32V203-PCB/blob/main/factory-reset/Adafruit_QTPy_CH32V203_Factory_Reset.bin), which is the NeoPixel swirl example that the boards ship with.

[Factory Reset Binary File](https://github.com/adafruit/Adafruit-QT-Py-CH32V203-PCB/raw/main/factory-reset/Adafruit_QTPy_CH32V203_Factory_Reset.bin)
To upload the code to the board, run the following command in the terminal:

```terminal
wchisp flash /path/to/binary_file.bin
```

You should see an output like this in the terminal after the binary has been successfully uploaded:

![](https://cdn-learn.adafruit.com/assets/assets/000/132/191/medium800/hacks_Screenshot_2024-09-09_103346.png?1725892454)

# Adafruit QT Py CH32V203

## Downloads

## Files

- [CH32V203 Product Page](https://www.wch-ic.com/products/CH32V203.html)
- [CH32V203 Datasheet](https://cdn-learn.adafruit.com/assets/assets/000/131/418/original/CH32V203DS0.PDF?1721655401)
- [EagleCAD PCB files on GitHub](https://github.com/adafruit/Adafruit-QT-Py-CH32V203-PCB)
- [Fritzing object in the Adafruit Fritzing Library](https://github.com/adafruit/Fritzing-Library/blob/master/parts/Adafruit%20QT%20Py%20CH32V203.fzpz)
- [PrettyPins pinout PDF on GitHub](https://github.com/adafruit/Adafruit-QT-Py-CH32V203-PCB/blob/main/Adafruit%20QT%20Py%20CH32V203%20PrettyPins.pdf)
- [PrettyPins pinout SVG on GitHub](https://github.com/adafruit/Adafruit-QT-Py-CH32V203-PCB/blob/main/Adafruit%20QT%20Py%20CH32V203%20PrettyPins.svg)

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

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


## Primary Products

### Adafruit QT Py CH32V203 Dev Board with STEMMA QT

[Adafruit QT Py CH32V203 Dev Board with STEMMA QT](https://www.adafruit.com/product/5996)
What a cutie pie! Or is it... a QT Py? This diminutive dev board features the&nbsp;powerful CH32V203 low-cost processor that's all the trend: based on RISC-V and cheaper than an 8-bit core! This little one is a great way to get started in the CH32x processor family, with everything you...

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

## Related Guides

- [QT Py CH32V203 eInk / ePaper Daily Calendar and Clock](https://learn.adafruit.com/ch32v203-eink-epaper-calendar-and-clock.md)
- [Adafruit INA260 Current + Voltage + Power Sensor Breakout](https://learn.adafruit.com/adafruit-ina260-current-voltage-power-sensor-breakout.md)
- [Adafruit MIDI FeatherWing](https://learn.adafruit.com/adafruit-midi-featherwing.md)
- [Making oscilloscope images with DACs](https://learn.adafruit.com/dac-oscilloscope-images.md)
- [Adafruit CH9328 UART to HID Keyboard Breakout](https://learn.adafruit.com/adafruit-ch9328-uart-to-hid-keyboard-breakout.md)
- [Adafruit Music Maker FeatherWing](https://learn.adafruit.com/adafruit-music-maker-featherwing.md)
- [Adafruit KB2040](https://learn.adafruit.com/adafruit-kb2040.md)
- [Adafruit Si5351 Clock Generator Breakout](https://learn.adafruit.com/adafruit-si5351-clock-generator-breakout.md)
- [Neo Trinkey Auto Screen Locker](https://learn.adafruit.com/neo-trinkey-auto-screen-locker.md)
- [Installing IronOS on an MHP30 Mini Hot Plate (DEPRECATED)](https://learn.adafruit.com/installing-ironos-on-a-mhp30-mini-hotplate.md)
- [Adafruit MMA8451 Accelerometer Breakout](https://learn.adafruit.com/adafruit-mma8451-accelerometer-breakout.md)
- [Adafruit BMP580, BMP581, and BMP585 - Temperature and Pressure Sensor](https://learn.adafruit.com/adafruit-bmp580-bmp581-and-bmp585-temperature-and-pressure-sensor.md)
- [Adafruit CircuitPython Wii Classic Controller Library](https://learn.adafruit.com/adafruit-circuitpython-wii-classic-controller-library.md)
- [Dancing Inflatables: Make your Holiday Display Move](https://learn.adafruit.com/dancing-inflatables-make-your-holiday-display-move.md)
- [Adafruit 1.14" 240x135 Color Newxie TFT Display](https://learn.adafruit.com/adafruit-1-14-240x135-color-newxie-tft-display.md)
