Recently I have purchased male and female USB-C breakout boards. I intend to connect the male breakout to a keyboard and the female end to my computer using a USB-C cable and wire the breakouts together using a breadboard. I was wondering if it is possible to read the keystrokes being sent across the D- and D+ lines with a micro-controller.

Here is an image of how I currently have the breakout boards setup

enter image description here

  • 1
    Just a suggestion, you should probably edit your question and replace Micro Controller with Arduino so as not to be off topic.
    – st2000
    Jul 9 at 20:54
  • Welcome to SE/Arduino! Please take the tour to learn how this site works, and read "How to Ask". -- Would you mind to edit your question and extend on the reason, please? -- It is much simpler to capture key presses in the receiving operating system, or in the keyboard before being transmitted. USB is quite complex "on the wire," however, you might try what small logic analyzers are doing. These commonly have special hardware involved, a simple device like the microcontroller of an Arduino cannot do it. Jul 10 at 6:10
  • You may want to take a look at this video. The author decodes the USB HID protocol by hand, with pen and paper. Jul 10 at 8:12

1 Answer 1


It would be far far easier to interface an Arduino to an old PS2 keyboard.

USB is complex. You would have to understand USB protocol, then understand the HID (Human Interface Device) protocol inside of the USB protocol. As HID can interface a number of devices like mice and keyboards, you might have to then understand the keyboard portion of the HID protocol.

As a point of reference, commercial USB analyzers cost hundreds of dollars. This USB analyzer cost about $500.

As an alternative, have you considered an all software USB monitor? These normally reside on the same computer as the USB Device is attached to. Wireshark should be able to do this.

Also, assuming that is a Pro Micro used on the keyboard, consider adding code to its Atmel processor to send out keyboard activity on an unused pin. This approach might proved much easier then monitoring the keyboard after its data has been incorporated into the USB protocol.

  • I don't want to discourage you. I just what to point out the difficulties of creating a USB interface. Especially one that is not a USB Device or USB Host (i.e. one that can monitor but will not enumerate or try to take control of the USB).
    – st2000
    Jul 9 at 20:56
  • This is a really old thread that discusses a USB Sniffer. Even back then (likely only USB 3.0 existed at the time) it was thought to be a really difficult task.
    – st2000
    Jul 9 at 21:02
  • OP doesn't want a general USB sniffer. only keyboard
    – Juraj
    Jul 10 at 5:13
  • Btw you can use Wireshark to catch USB communication directly on the system. His question looks more like XY problem. If he has everything on the photo, he could just program it directly into that on-keyboard MCU (looks like Pro Micro with usb-c?)
    – KIIV
    Jul 10 at 10:32
  • @Juraj, I think once you start using USB to communicate you are going to have to buy into the entire USB protocol. But please follow up w/links to project that monitor only a USB/HID/Keyboard. I would be fun to figure out how they did it!
    – st2000
    Jul 10 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.