Overview
Each USB device has a vendor ID (VID) and product ID (PID). These codes identify the manufacturer and product. The only problem is that it can be really annoying to find the VID and PID for a device. You usually have to go through a forest of clicks and menus on your operating system. With this project, you'll use a Feather RP2040 USB Host running CircuitPython that shows the VID and PID on a mounted device for a simple plug and play way to learn the mysteries of your devices.
You can press any of the three buttons on the FeatherWing to toggle what information from the mounted USB device is shown. In one group is the VID and PID and in the other is the Manufacturer and Product name.
Page last edited October 14, 2025
Text editor powered by tinymce.
Install CircuitPython
CircuitPython is a derivative of MicroPython designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the CIRCUITPY drive to iterate.
CircuitPython Quickstart
Follow this step-by-step to quickly get CircuitPython running on your board.
Click the link above to download the latest CircuitPython UF2 file.
Save it wherever is convenient for you.
To enter the bootloader, hold down the BOOT/BOOTSEL button (highlighted in red above), and while continuing to hold it (don't let go!), press and release the reset button (highlighted in red or blue above). Continue to hold the BOOT/BOOTSEL button until the RPI-RP2 drive appears!
If the drive does not appear, release all the buttons, and then repeat the process above.
You can also start with your board unplugged from USB, press and hold the BOOTSEL button (highlighted in red above), continue to hold it while plugging it into USB, and wait for the drive to appear before releasing the button.
A lot of people end up using charge-only USB cables and it is very frustrating! Make sure you have a USB cable you know is good for data sync.
You will see a new disk drive appear called RPI-RP2.
Drag the adafruit_circuitpython_etc.uf2 file to RPI-RP2.
The RPI-RP2 drive will disappear and a new disk drive called CIRCUITPY will appear.
That's it, you're done! :)
Safe Mode
You want to edit your code.py or modify the files on your CIRCUITPY drive, but find that you can't. Perhaps your board has gotten into a state where CIRCUITPY is read-only. You may have turned off the CIRCUITPY drive altogether. Whatever the reason, safe mode can help.
Safe mode in CircuitPython does not run any user code on startup, and disables auto-reload. This means a few things. First, safe mode bypasses any code in boot.py (where you can set CIRCUITPY read-only or turn it off completely). Second, it does not run the code in code.py. And finally, it does not automatically soft-reload when data is written to the CIRCUITPY drive.
Therefore, whatever you may have done to put your board in a non-interactive state, safe mode gives you the opportunity to correct it without losing all of the data on the CIRCUITPY drive.
To enter safe mode when using CircuitPython, plug in your board or hit reset (highlighted in red above). Immediately after the board starts up or resets, it waits 1000ms. On some boards, the onboard status LED (highlighted in green above) will blink yellow during that time. If you press reset during that 1000ms, the board will start up in safe mode. It can be difficult to react to the yellow LED, so you may want to think of it simply as a slow double click of the reset button. (Remember, a fast double click of reset enters the bootloader.)
In Safe Mode
If you successfully enter safe mode on CircuitPython, the LED will intermittently blink yellow three times.
If you connect to the serial console, you'll find the following message.
Auto-reload is off. Running in safe mode! Not running saved code. CircuitPython is in safe mode because you pressed the reset button during boot. Press again to exit safe mode. Press any key to enter the REPL. Use CTRL-D to reload.
You can now edit the contents of the CIRCUITPY drive. Remember, your code will not run until you press the reset button, or unplug and plug in your board, to get out of safe mode.
Flash Resetting UF2
If your board ever gets into a really weird state and CIRCUITPY doesn't show up as a disk drive after installing CircuitPython, try loading this 'nuke' UF2 to RPI-RP2. which will do a 'deep clean' on your Flash Memory. You will lose all the files on the board, but at least you'll be able to revive it! After loading this UF2, follow the steps above to re-install CircuitPython.
Page last edited October 14, 2025
Text editor powered by tinymce.
Code the Reporter
Once you've finished setting up your Feather RP2040 USB Host with CircuitPython, you can access the code and necessary libraries by downloading the Project Bundle.
To do this, click on the Download Project Bundle button in the window below. It will download to your computer as a zipped folder.
# SPDX-FileCopyrightText: 2025 Liz Clark for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
CircuitPython USB VID/PID Reporter
Feather RP2040 USB Host with OLED FeatherWing
"""
import usb.core
import keypad
import board
import displayio
import terminalio
from adafruit_display_text import label
from i2cdisplaybus import I2CDisplayBus
import adafruit_displayio_sh1107
displayio.release_displays()
# init display
i2c = board.I2C()
display_bus = I2CDisplayBus(i2c, device_address=0x3C)
display = adafruit_displayio_sh1107.SH1107(display_bus, width=128, height=64)
# text groups
main = displayio.Group()
extra_info = displayio.Group()
groups = [main, extra_info]
display.root_group = main
# text objects for title, VID and PID
title_text = label.Label(terminalio.FONT, text="USB VID/PID Reporter", color=0xFFFFFF, x=5, y=15)
main.append(title_text)
vid_text = label.Label(terminalio.FONT, text="VID:", color=0xFFFFFF, x=5, y=35)
main.append(vid_text)
pid_text = label.Label(terminalio.FONT, text="PID:", color=0xFFFFFF, x=5, y=50)
main.append(pid_text)
# text objects for manufacturer and product info
# added to secondary group
man_header = label.Label(terminalio.FONT, text="Manufacturer:", color=0xFFFFFF, x=5, y=10)
extra_info.append(man_header)
man_text = label.Label(terminalio.FONT, text=" ", color=0xFFFFFF, x=5, y=25)
extra_info.append(man_text)
prod_header = label.Label(terminalio.FONT, text="Product:", color=0xFFFFFF, x=5, y=40)
extra_info.append(prod_header)
prod_text = label.Label(terminalio.FONT, text=" ", color=0xFFFFFF, x=5, y=55)
extra_info.append(prod_text)
# init A, B and C buttons on FeatherWing as keypad keys
keys = keypad.Keys((board.D5,board.D6,board.D9,), value_when_pressed=False, pull=True)
# variables
last_pid = 0x0000 # store last PID
last_vid = 0x0000 # store last VID
usb_dev = False # is there a USB device?
first_run = True # first run through loop
group_index = 0 # display group index
while True:
event = keys.events.get()
if event:
# if any button is pressed, toggle graphics group
if event.pressed:
group_index = (group_index + 1) % 2
display.root_group = groups[group_index]
# find connected devices
devices = list(usb.core.find(find_all=True))
# if no device, reset states and text objects
if not devices and usb_dev or first_run:
print("no device")
pid_text.text = "PID:"
vid_text.text = "VID:"
man_text.text = " "
prod_text.text = " "
usb_dev = False
first_run = False
else:
if not usb_dev:
first_run = False
for device in devices:
try:
# if its the same device, don't scan again
if (last_pid == hex(device.idProduct) and
last_vid == hex(device.idVendor) and usb_dev):
break
# new device!
usb_dev = True
# get PID, VID, manufacturer and product
# update text elements
print("pid", hex(device.idProduct))
last_pid = hex(device.idProduct)
pid_text.text = f"PID: {last_pid}"
print("vid", hex(device.idVendor))
last_vid = hex(device.idVendor)
vid_text.text = f"VID: {last_vid}"
print("man", device.manufacturer)
# only update manufacturer and product if info is known
if device.manufacturer is not None:
man_text.text = device.manufacturer
print("product", device.product)
if device.product is not None:
prod_text.text = device.product
print()
# if there's any error reading info from a USB device, continue
except usb.core.USBError:
print("got an error, continuing..")
continue
Upload the Code and Libraries to the Feather RP2040 USB Host
After downloading the Project Bundle, plug your Feather RP2040 USB Host into the computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called CIRCUITPY. Unzip the folder and copy the following items to the Feather RP2040 USB Host's CIRCUITPY drive.
- lib folder
- code.py
Your Feather RP2040 USB Host CIRCUITPY drive should look like this after copying the lib folder and code.py file:
displayio.release_displays() # init display i2c = board.I2C() display_bus = I2CDisplayBus(i2c, device_address=0x3C) display = adafruit_displayio_sh1107.SH1107(display_bus, width=128, height=64)
Two display groups are used. The main group has the title text and VID/PID text. The extra_info group has the manufacturer text and product name text. Each of these text objects are initialized as Labels.
# text groups main = displayio.Group() extra_info = displayio.Group() groups = [main, extra_info] display.root_group = main # text objects for title, VID and PID title_text = label.Label(terminalio.FONT, text="USB VID/PID Reporter", color=0xFFFFFF, x=5, y=15) main.append(title_text) vid_text = label.Label(terminalio.FONT, text="VID:", color=0xFFFFFF, x=5, y=35) main.append(vid_text) pid_text = label.Label(terminalio.FONT, text="PID:", color=0xFFFFFF, x=5, y=50) main.append(pid_text) # text objects for manufacturer and product info # added to secondary group man_header = label.Label(terminalio.FONT, text="Manufacturer:", color=0xFFFFFF, x=5, y=10) extra_info.append(man_header) man_text = label.Label(terminalio.FONT, text=" ", color=0xFFFFFF, x=5, y=25) extra_info.append(man_text) prod_header = label.Label(terminalio.FONT, text="Product:", color=0xFFFFFF, x=5, y=40) extra_info.append(prod_header) prod_text = label.Label(terminalio.FONT, text=" ", color=0xFFFFFF, x=5, y=55) extra_info.append(prod_text)
# init A, B and C buttons on FeatherWing as keypad keys keys = keypad.Keys((board.D5,board.D6,board.D9,), value_when_pressed=False, pull=True)
Variables
There are a few variables that are used in the loop. last_pid and last_vid hold the previously read VID and PID info. usb_dev checks if a USB device is plugged into the Feather. first_run lets the loop know that its the first time the loop is running. group_index is the display group into that lets you toggle between the main group or the extra_info group.
# variables last_pid = 0x0000 # store last PID last_vid = 0x0000 # store last VID usb_dev = False # is there a USB device? first_run = True # first run through loop group_index = 0 # display group index
The Loop
All three of the FeatherWing buttons are monitored for keypad events. If any of the three buttons are pressed, then the display group is toggled.
while True:
event = keys.events.get()
if event:
# if any button is pressed, toggle graphics group
if event.pressed:
group_index = (group_index + 1) % 2
display.root_group = groups[group_index]
Find the Devices
devices holds a list of connected and mounted USB devices to the USB host peripheral. If no device is found, then the OLED will only show the project title text and clear any previous USB info that was being displayed.
# find connected devices
devices = list(usb.core.find(find_all=True))
# if no device, reset states and text objects
if not devices and usb_dev or first_run:
print("no device")
pid_text.text = "PID:"
vid_text.text = "VID:"
man_text.text = " "
prod_text.text = " "
usb_dev = False
first_run = False
If there is a connected USB device, the text objects are updated to show the VID, PID, manufacturer and product information. Sometimes USB devices do not have manufacturer or product information, so there is error handling to prevent exceptions if that information isn't present to update the text objects. Additionally, if there are any USBError exceptions, the loop will continue.
else:
if not usb_dev:
first_run = False
for device in devices:
try:
# if its the same device, don't scan again
if (last_pid == hex(device.idProduct) and
last_vid == hex(device.idVendor) and usb_dev):
break
# new device!
usb_dev = True
# get PID, VID, manufacturer and product
# update text elements
print("pid", hex(device.idProduct))
last_pid = hex(device.idProduct)
pid_text.text = f"PID: {last_pid}"
print("vid", hex(device.idVendor))
last_vid = hex(device.idVendor)
vid_text.text = f"VID: {last_vid}"
print("man", device.manufacturer)
# only update manufacturer and product if info is known
if device.manufacturer is not None:
man_text.text = device.manufacturer
print("product", device.product)
if device.product is not None:
prod_text.text = device.product
print()
# if there's any error reading info from a USB device, continue
except usb.core.USBError:
print("got an error, continuing..")
continue
Page last edited October 14, 2025
Text editor powered by tinymce.
Assembly
For this project, you'll just need to solder some headers and then plug the Feather and FeatherWing into the FeatherWing Doubler. If you're new to soldering, check out the How to Solder Headers Learn Guide.
Page last edited October 14, 2025
Text editor powered by tinymce.
Use
Power up the Feather with a USB C cable plugged into a USB power source. On power-up, you'll see the display show the text areas for the device information.
Insert a USB device into the Feather RP2040 USB Host port. You'll see the connected device's VID and PID show up on the OLED.
Page last edited October 14, 2025
Text editor powered by tinymce.