Quick Key Adapter, 10 Button HID Keyboard using PIC18F14K50

Quick Key Adapter, 10 Button HID Keyboard

This Instructable covers creating a USB connected Human Interface Device Keyboard that has 10 button inputs which are mapped to keyĀ combinationsĀ in the firmware. KeyĀ combinationsĀ can be quickly accessed without using the keyboard which may beĀ inconvenientĀ to use.Ā Such as with a MAME orĀ similarĀ machine where the keyboard may be stored orĀ inaccessibleĀ or certain keys may be used frequently but arenā€™t mapped to any of theĀ arcadeĀ buttons.

Such as: Alt+F4 for Close Program, Windows+D to Show Desktop, Minimize Window, Maximize Window, Multiple Launch Program or Emulator, Alt+Ctrl+Del, Coin Buttons for players 1 and 2,

The custom hardware(circuit) is based on Microchip Solutions sample ā€œUSB Device HID Keyboardā€ firmware for the Low Pin Count USB Development Kit which uses a 18F14K50. TheĀ developmentĀ kit is not required to recreate this as included here is a schematic, PCB layout and firmware to build one from scratch.
Key Adapter
It does not require any external power supply, it draws from the USB host. All the keycodes are set in firmware and are for Windows based OSā€™s, additional OSs could be used but the keycodes would have to be changed in the firmware.

If someone would like to send me key codes for a different OS, I will put together the firmware and post it to this Instructable.

Included in the ZIP below is PCB Layout, Schematic, diagrams, MPLAB project files, HEX file, readme, and the datasheet. Or you can view the HID Quickkey USB Adapter DatasheetĀ or Visit the Website for Updates, Downloads and Details.

The Eagle files for the PCB can be found as aĀ separateĀ download.

DISCLAIMER: Recreate this project at your own risk. There is always risks when building your own electronics, be careful. Damage to the computers USB bus is possible, but not probable when everything is built correctly.

Parts and Supplies

Complete Kits including the programmed PIC is available in The Store

Basic Kits including the programmed PIC, without buttons and wire are also available.

Parts:

  • PIC18F14K50 ā€“ DIP package, Buy One Programmed
  • 2x 10k 5 bused resistorsĀ Like This
  • USB Type B Socket
  • 12 mhz Oscillator, series*
  • 0.1uF disc Capacitor
  • 220nF disc Capacitor
  • 4 pin Header, such as Molex KK6410
  • 4 pin Housing, such as MolexĀ KK 6471
  • 6 pinĀ Header, such as Molex KK6410
  • 6Ā pin Housing, such as Molex KK 6471
  • Crimps, MolexĀ KK 4809
  • Wire, solid strand and stranded
  • Printed Circuit Board or Perforated Proto board and solid strand wire
  • 10 Normally Open Push buttons, board mount
  • USB Type B to Type A cable(most devices such as printers use them) Buy One

*Normal crystal oscillator can be used, just add a 22pF capacitor from each OSC pin to ground.

Tools:

  • Soldering Iron
  • Wire Strippers
  • DiagonalĀ Cutters

Construct PCB

If Purchasing A PCB or Making one yourself, have it ready beforeĀ beginningĀ this step. Perforated board could also be used, then just follow the schematic.

The silkscreen PCB layout image included in the ZIP in Step 1 should beĀ accessibleĀ for this Step, it shows the parts layout.

ā€“ Start with the 20-pin socket, the notch on the end marks the Pin 1 end. Carefully insert it, ensuring all pins line up.

ā€“ Resistor Buses are next, they each have 5 10k resistors in parallel within them with a common pin on one end, The common pin, which is marked with a dot on the SIP package should be lined up with the printed dot on the end of RN1 and RN2.

ā€“ Oscillator, ensure the solder joints are shiny and designing your own board, it should be as close to the MCU as possible.

ā€“ Capacitors C1 & C2: C1 is a 100nF disc cap for decoupling, C2 is a 220nF capacitor connected between the MCUā€™s VBUS pin and V+.

ā€“ Resistor R1 pulls the Data+ line high, which signals to the Host what USB speed the Device runs at.

ā€“ USB Receptacle: It only goes in one way, Bend the mounting pins outward once it is in the board, solder all the contacts ensure their good joints. Make sure the solder doesnā€™t bridge, as the contacts are quite close together.

ā€“ Headers: The polarized headers go in now, they can go in facing either way, there is a 4-pin and a 6-pin.

ā€“ PWR: Unused power header, leave it empty but solder over both pads. It is there in case more power than the bus can provide would be needed if the device was repurposed.

ā€“ Jumpers:Lastly the jumpers are installed, using these means that single sided copper circuit board can be used. Use some solid strand wire. And avoid other touching other parts, especially bare wire line on a capacitor.

  • J1 is jumped to J2
  • P1 is jumped to P2 which is jumped to P3. solder 2 wires into P2, then one wire each goes to P1 and P3.
  • G1 and G2 are left open, explained in the next step.
  • RX and TX are also left open and are not used, but are connected to the USART.
Schematic Key Adapter
All the electronic parts except the PIC microcontroller and switches should be installed onto the circuit board. Look over everything carefully for jumps, bad solder joints, loose wires, or parts.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter