{"product_id":"adafruit-ch9328-uart-to-hid-keyboard-breakout","title":"Adafruit CH9328 UART to HID Keyboard Breakout","description":"\u003cp\u003eWe love using chips with 'native USB' peripherals - that's the magic silicon that lets a microcontroller act like an HID keyboard, mouse, disk drive or MIDI synth. It's a standard addition on \u003ca href=\"\/hi\/products\/adafruit-qt-py-samd21-dev-board-with-stemma-qt\"\u003eSAMD21\u003c\/a\u003e, \u003ca href=\"\/hi\/search?q=RP2040\u0026amp;narrow_by=\u0026amp;sort_by=relevency\u0026amp;page=1\"\u003eRP2040\u003c\/a\u003e, and even the latest \u003ca href=\"\/hi\/search?q=esp32-s2\u0026amp;narrow_by=\u0026amp;sort_by=relevency\u0026amp;page=1\"\u003eESP32-S2\u003c\/a\u003e and \u003ca href=\"\/hi\/search?q=esp32-s3\u0026amp;narrow_by=\u0026amp;sort_by=relevency\u0026amp;page=1\"\u003eESP32-S3\u003c\/a\u003e boards. But what about when you have a classic ATmega328 Uno? or an original ESP32 or ESP8266? Maybe even a single-board computer like a Raspberry Pi? We would say \"Sorry...that's not possible\" UNTIL NOW!\u003c\/p\u003e \u003cp\u003eThe \u003ca href=\"https:\/\/www.wch-ic.com\/products\/CH9328.html\"\u003eCH9328\u003c\/a\u003e is a funky chip that is basically a programmed microcontroller that enumerates as an everyday HID keyboard and can convert ASCII or 8-byte raw reports, read over a standard serial port UART, into keypresses. So, you can emulate a keyboard even if your chip doesn't have a native USB! You do need a hardware or software serial port: some way to generate a 9600 baud 3V-logic signal that the CH9328 can read.\u003c\/p\u003e \u003cp\u003eWe added all the support circuitry to make this chip easy to use, you may not even need to do any soldering. The CH9328 is connected to a \u003ca href=\"https:\/\/www.wch-ic.com\/products\/CH9328.html\"\u003eUSB Type C\u003c\/a\u003e port so it's easy to plug into any computer, laptop or even phone\/tablet. Then, you can get 5V power from the 5V and Ground pads. There's a UART RX receive input plus a reset line if you want to perform a hard reset. If you want 'solderless' functionality, grab one of our JST SH cables: the red line will provide 5V, black is Ground, and the white wire is data in.\u003c\/p\u003e \u003cp\u003eYou can configure the 'Mode' using the 4 onboard switches, do that before powering it up:\u003c\/p\u003e \u003cul\u003e \u003cli\u003eSwitch #1 is used to configure the \"Upload speed\" - for most cases, it doesn't matter which way it is set\u003c\/li\u003e \u003cli\u003eIf Switch #2, #3 and #4 are all 'ON' the chip is in Mode 0:\u003cbr\u003eVisible ASCII characters are sent as-is: if you send ASCII \"A\", an \"A\" is typed. If 0x1B is received, it is converted to the Enter key\u003c\/li\u003e \u003cli\u003eIf Switch #2 and #4 are 'ON' and Switch #3 is 'OFF' the chip is in Mode 1:\u003cbr\u003eVisible ASCII characters are sent as-is: if you send ASCII \"A\", an \"A\" is typed\u003c\/li\u003e \u003cli\u003eIf Switch #2 and #3 are 'ON' and Switch #4 is 'OFF' the chip is in Mode 2:\u003cbr\u003eVisible ASCII characters are sent as-is: if you send ASCII \"A\", an \"A\" is typed. If 0x28 is received, it is converted to the Enter key\u003c\/li\u003e \u003cli\u003eIf Switch #3 and #4 are 'ON' and Switch #2 is 'OFF' the chip is in Mode 3: This is the mode for sending raw 8-byte HID reports. This is also good if you want more control over the keypresses or keyholds, or to mimic a non-US keyboard because you can control exactly what control codes are sent and when.\u003c\/li\u003e \u003c\/ul\u003e \u003cp\u003eWe recommend using mode 3 if possible, but you'll want to use our CH9328 library to do so.\u003c\/p\u003e \u003cp\u003eThis is a nice and easy way to emulate a keyboard without having to worry about native USB support, gadget mode, or maybe you just want to emulate more than one kind of device. You can also do 'funky' things like having one desktop or single-board computer 'type' into a device such as a computer or mobile device by running our Python code and having it send UART data via a \u003ca href=\"\/hi\/products\/usb-to-ttl-serial-cable-debug-console-cable-for-raspberry-pi\"\u003eUSB-to-UART converter\u003c\/a\u003e. Either way, the CH9328 will make it easy to keeb away.\u003c\/p\u003e \u003cp\u003e\u003ciframe width=\"560\" height=\"315\" src=\"\/\/www.youtube.com\/embed\/8_UBtB6yOec?si=u12VffIlnVSLA3hp\u0026amp;start=313\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen=\"allowfullscreen\"\u003e\u003c\/iframe\u003e\u003c\/p\u003e \u003ch2\u003eSpecifications\u003c\/h2\u003e \u003cul\u003e \u003cli\u003eDimensions: 26.4mm x 20.3mm x 4.6mm\u003c\/li\u003e \u003cli\u003eWeight: 2.7g\u003c\/li\u003e \u003c\/ul\u003e","brand":"Adafruit","offers":[{"title":"Default Title","offer_id":50847327027473,"sku":"ADA5973","price":6.7,"currency_code":"USD","in_stock":false}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0901\/6285\/6209\/files\/adafruit-ch9328-uart-to-hid-keyboard-breakout-adafruit-ada5973-42391282974915.jpg?v=1735211023","url":"https:\/\/abcd3032.myshopify.com\/hi\/products\/adafruit-ch9328-uart-to-hid-keyboard-breakout","provider":"Tayyab Zak","version":"1.0","type":"link"}