▄▄██▀▄███▄ ▄■▄▀▀▀█
       ▄███▀▄▀▄███▄▄▀▀▄▄ 
      ███▀▄███████████▀▄▀               ███▄
      ▀██▄▀██████▀▄▀▀▀▄▀        ▄▄▀▄███▄■▀ █▀▀█
      ▄▄██▀▀████▄▄          ▄█▀▄▀█▄███▀▀▀▄▄█ 
    ▄███▀▄▀▄███▀▀█▀▀        ▄██▄█ ██████████▀ 
  ▄███▀▄▀▄▀▀▀█▀▄▀           ██ ██▒████▀▀▀▀▀▀▄▀
 ▄███ █▀▄ ▀▀█    ▄▄▄▄▄    ███▀█▀▀███▄ ▀▀             ▄  ▄  ▄▄▄  ▄▄  ▄   ▄ ▄   ▄
▒███ █▄█▀▀   █▄▀█▀▀▀▀▀█▄ ▀██▄▀▄▀▀███▄▄▀▄           █▄▄█ █▄   █▄▄█ █▄ ▄█ ▀▄▄▄▀
████ ▄▀▄▀   ███ ▄▄▄■ ██   ▀██▄▀▀▄▀▀█▀▀▄▀▄         █  █ ▀▄▄▄ █  █  ▀▄▀    █
▒███  ▀▄▀▄ ▀ ▄▄▄▀ ▄▀▄▀ ▀▄▄████ ▀██▄▀█▄▄█▄▄█▄
 ███▄ ▀▄ ▀      ▄▀▄▀▄▀▄█▀▀▀▀██   ███▀██▄▀█▄█▄      ▄▄▄ ▄  ▄ ▄▄▄  ▄  ▄  ▄▄▄ ▄▄▄▄▄ ▄▄▄  ▄▄▄  ▄▄▄  ▄▄▄
  ▀██▄ ▀▄  ▀      ▀ ▀  ▄▀██ ▄▄█▄██  █▀  ▀▄▀▄██        █  █▀▄█ █  █ █  █ ▀▄▄    █   █▄▄▀  █  █▄   ▀▄▄
    ▀██▄ ▀▄         ▄ ▀▄▄▀█▄▀▄▀█  ▀▄▄ ▀ ▄▀▄▀▄▀ ██      ▄█▄ █  █ █▄▄▀ ▀▄▄▀ ▄▄▄▀   █   █  █ ▄█▄ ▀▄▄▄ ▄▄▄▀
      ▀▀█▄  ▀ ▄▄▄ ▀    ██▄▀▄▀▄▀▄▀▄       ▀    ▄▀
           ▀▀           ▀██▄▀▄  ▀ ■       ▀ ▄▀
                          ▀█▄ ▀▄          ▄▀
                             ▀ ▄▄▀  ▄▄▄ ▀
                                  ▀▀▀
                                    
posted by esells on May 27, 2016

Hand Wired Keyboard Part 2

At the end of part 1 I had a working keyboard but it had to be plugged in via USB. I haven’t used a wired keyboard in probably five years so having this one wired made me sad. There were a few hints at how people had done bluetooth + teensy setups (the teensy is the brains) but no real tutorials or anything. So as I typically do when presented with an electronics project, I headed over to adafruit to see how much I could get already pre-built for me.

I already had the battery/charging stuff from a previous project so all I needed was something for the bluetooth. Guess what? They have a part for that: bluefruit EZ-Key. This little guy has the ability to take input in on it’s UART port and fire it off via bluetooth, perfect!

Now I had to figure out the wiring as I wanted to be able to charge the battery via the teensy USB port as opposed to using the USB port on the lipo charger board. There is a small trace on the teensy that you can cut to stop the USB port from actually providing power (see here) which sounded like what I wanted so I had a few drinks to steady my hand, pulled out the xacto knife and made the cut. After that it was just a matter of getting the TX/RX from the teensy hooked up to the EZ-Key and then the power + charging coming from the lipo charger board to the teensy. Here is an amazing diagram I put together showing what I did:

wiring diagram
pro schematic

The center 5v pad on the teensy is powered by the USB plug, so to charge the battery I just plug the keyboard up via USB to a power source and I’m good to go. What the awesome diagram doesn’t show is a small switch I added on the “power” wire between the charger board and teensy so that I can turn off the keyboard when I’m not using it.

This setup was functional and it worked correctly but because of the extra components (mainly the battery) the original spacers that came with the keyboard didn’t work. I tried about five different arrangements but every time I ended up pinching a diode or something causing the keyboard to do strange things on certain keys. The solution was to just order some taller spacers. This means that I will need to order a new middle piece cut from acrylic in order to hide all the guts but honestly I kind of like the exposed look.

With regards to the firmware, a few changes had to be made so I did my best to pretend to be a C programmer. The biggest change was renaming a bunch of macros that had at some point been renamed and never updated across the TMK code base, you can see the PR I submitted for that here. After that was done it was basically just a matter of copying the bluetooth converter sample project in TMK and updating it to fit my actual keyboard. You can see the changes I made here. Please keep in mind that the keymap being used is very basic and there is a lot of clean-up that could be done. This was simply just to verify everything was working as it should.:w