Arduino Mechanical Keyboard



Arduino mechanical keyboard

Arcade buttons would be integrated into the system using a 32u4 based Arduino to inject keystrokes to the computer to mimic the use of hot keys. And, we'd add some 'Wow' factor with WS2812 LED strips, relay control of a fog machine and crazy sound effects. Again, Eric took care of all the mechanical design.

  • The keyboard transmits CMD + control + shift + F1 - F12 and 1 - 3, to cover all the keys. Using BetterTouchTool, these inputs can be mapped to various actions for each app. Besides this, the top left key 'master', when long pressed, transmits CMD + control + shift + option + F1 and puts the keyboard.
  • In this video, I show how I built a fully customizable keypad for my CNC using mechanical switches, an Arduino and a custom PCB manufactured by PCBWay, who y.

Working with CAD programs involves focusing on the task at hand and keyboard shortcuts can be very handy. Most software packages allow the user to customize these shortcuts but eventually, certain complex key combination can become a distraction.

[awende] over at Sparkfun has created a Cherry MX Keyboard which incorporates all of the Autodesk Eagle Shortcuts to a single 4×4 matrix. The project exploits the Arduino Pro Mini’s ability to mimic an HID device over USB thereby enabling the DIY keyboard. Pushbuttons connected to the GPIOs are read by the Arduino and corresponding shortcut key presses are sent to the host machine.

Additional functionality is implemented using two rotary encoders and the Teensy encoder library. The first knob functions as a volume control with the push-button working as a mute button. The encoder is used to control the grid spacing and the embedded button is used to switch between imperial and metric units. The entire code, as well as the schematic, is available on GitHub for your hacking pleasure. It’s a polished project just ready for you to adapt.

The project can be extended to be used with other computer software such as Gimp and the keys may be replaced by capacitive touch sensors making it more sturdy. Bluetooth can be added to make things wireless and you can check out the Double Action Keyboard to extend functionality further.

The Hardware

Assembly

Keyboard
  1. Solder the 500mah jumper on the trinket backpack for batteries larger than 500mah
  2. (Optional) Cut the switch trace on the trinket backpack and solder a micro switch between the two contacts. See https://learn.adafruit.com/adafruit-pro-trinket-lipoly-slash-liion-backpack for more details
  3. Solder the trinket backpack to the Bluefruit micro
  4. Solder the micro USB power connections to ground and 3.3v on the Bluefruit Micro
  5. Solder the Data ( + ) pin(PS2 clk) of the micro USB to pin 2 on the Bluefruit micro
  6. Solder the Data ( - ) pin(PS2 data) of the micro USB to pin 3 on the Bluefruit micro
  7. Solder all batteries in PARALLEL to the trinket backpack
  8. Plug the micro USB into the keyboard and double stick tape the electronics

Battery life and charging

  • Battery life depends on the size of your battery, power consumption of your keyboard, and the power level of your bluetooth
    • I haven't tested my battery life with 6000mah battery nor have I measured the power consumption( multimeter broken :( )
    • I can run a 12 hour work day with stock bluetooth power settings and medium backlight with no problems
  • You can charge the keyboard through the micro USB on the bluefruit.
    • I usually charge mine when I leave work

The Software

Setup

  1. Download my git repo
  2. Install the proper drivers
  3. Download the adafruit Bluefruit library
    1. Add to your arduino library
  4. Add Adafruit board support in Arduino IDE


Update your BLE module

  1. Download the adafruit app
    1. https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect&hl=en
  2. Follow this procedure
    1. REMEMBER TO GROUND THE DFU PIN


Upload the Firmware

Arduino Mechanical Keyboard
  1. Open this project in the Arduino IDE
  2. Select Bluefruit Micro as your board
  3. Select the proper serial port
  4. Click upload


Arduino Mechanical Keyboard Instructions

Configure and connect

Arduino keyboard example
  1. Hit shift + ctrl + esc on your MODIFIED keyboard
    1. This will reconfigure your bluetooth module for keyboard use
    2. Bluetooth is now named 'BLE_WASD'
    3. Do this again if your keyboard ever stops working randomly
  2. Connect your keyboard to your computer or phone
    1. I have only had luck with Windows 10(it was able to solve the funky driver errors from the adafruit bluefruit module)
    2. Windows 7 was a no go
    3. Windows 8 is untested
    4. Android only works upon first pairing
    5. Apple products untested

Use Arduino As Keyboard

Hacking

Arduino Keyboard Example

  • This code will work with any arduino and bluefruit module, you just need to change the pinouts and stuff.
  • This code supports 100% of the PS2 receiving protocol(one way communication) and has some extra features for a WASD keyboard(media keys)
  • Use the `special_functions( )` function to do custom things with your keyboard. Like make a T9 number pad.
  • You can change the power output of the Bluetooth module to increase range or save battery