Your shopping cart is empty!
HID Recogniser using TinyUSB
- Khor Jia Yong
- 29 Dec 2023
- Project
- Beginner
- 1195
Introduction
TinyUSB is an open-source software framework for embedded systems, enabling USB communication. It emphasizes memory safety and thread safety by avoiding dynamic allocation and deferring interrupt event handling to non-ISR task functions. In this project, the objective is to develop the identification of Hardware Interface Devices (HID) such as mice, keyboards, gamepads, etc., wherein the detection of these devices is achieved through USB connections.
Hardware Components
- Maker Pi RP2040
- USB Connector A Type Female
Software Requirement
Project Development
Hardware setup
1. Understand the pinout of the USB host type A by referring to the datasheet provided.
2. Construct and set up the circuit by
- Connecting the D+ pin to the GPIO 16 of Maker Pi RP2040
- Connecting the D- pin to the GPIO 17 of Maker Pi RP2040
- Connecting the + pin to the 5V or 3.3V of Maker Pi RP2040
- Connecting the - pin to the GND of Maker Pi RP2040
The figure shows the reference to a circuit connection
Software setup
1. On your Arduino IDE, install the Adafruit_TinyUSB Library and PIO USB Library.
If asked about dependencies, click "Install all".
2. In the Tools menu,
i. Choose "Cytron Maker Pi RP2040" as the board.
ii. Select either 120 MHz or 240 MHz for CPU Speed and set the USB Stack to "Adafruit TinyUSB."
3. To produce program, go to File > Examples > Adafruit TinyUSB Library > DualRole > Simple and select "device_info".
4. Run the sketch, connect your device to the USB Type A host connector, and observe the output on the serial monitor.
Source Code
This is the sample code of the "HID Recogniser using TinyUSB" project.