Author Topic: Bit-banging USB HID keyboard using USART output through FTDI chip  (Read 1560 times)

Marsbound

  • Member
  • ***
  • Posts: 1
Hi,

I'm using a PIC18F87K22 for a final project I'm working on.  My assignment is to connect to a PC as an HID keyboard, and then send keystrokes to the computer.

The problem is that the PIC18F87K22 is only capable of RS-232 communication.  The development board we are using has a serial port we can plug into, or we can use a provided FTDI chip that lets us use a usb cord.  However, even when using the FTDI chip the connection still appears on the PC as a virtual-COM port.

I am struggling to understand V-USB and how to implement it on my PIC, and would greatly appreciate any help on how to use it to get my PC to recognize the connection as an HID keyboard.

Thanks, Will

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3021
    • Lakeview Research

Renate

  • Frequent Contributor
  • ****
  • Posts: 87
Re: Bit-banging USB HID keyboard using USART output through FTDI chip
« Reply #2 on: December 09, 2021, 06:57:19 am »
What you're trying to do is simple. The way that you are trying to do it is complicated.
As Jan said, the sensible way to do that is to use a microcontroller that supports USB (like the Arduino Leonardo, ATMega32u4). A normal USB keyboard is HID.
You could also "bit-bang" low speed USB on a PIC, but why?

Using an FTDI serial/USB converter doesn't get you anywhere. You could write a Windows program that received the key strokes and did something with them, but it wouldn't be like a regular keyboard. In Linux you could write a daemon to receive the serial and inject key events. For Windows you'd need to write a Windows driver if you wanted a system-wide keyboard.

If your PC had a PS2 keyboard input you could reasonably implement that protocol on a PIC and send your key strokes. That's neither USB nor HID.

HID goes over USB, it goes over Bluetooth and I've seen it implemented over an IC interface.