søndag den 5. april 2015

Sony car stereo bluetooth mod

I have this not quite new Sony car stereo which does the job quite well except for the fact it doesn't have bluetooth. A while back I bought a USB powered bluetooth audio adapter, and thought to myself: Why isn't it integrated? Well now it is.

The hack involves a voltage regulator, a bluetooth dongle and some light soldering.
See the build log here: http://imgur.com/gallery/N9VNd

mandag den 1. december 2014

Wireless Das Keyboard using Logitech K270 controller

A couple of months ago I noticed my Das Keyboard had been collecting dust in the basement storage room. It's not a bad keyboard, and I missed the blue switches, so I decided to make some modifications to it. The wireless mod seemed to be the easiest accessible one. This is the story of how not to do that mod, concluding with some tips to help people mod their keyboards properly. Source code, pictures etc. are found at the bottom of the post.

The basics of the mod are:

  1. Find a cheap donor board with a wireless controller
  2. Trace the wires on the membranes of the wireless board
  3. Connect the switches on your new keyboard to match the wires on the donor membrane
  4. Connect the wires to the controller board
  5. Wireless keyboard


First attempt

First I found me a crappy wireless keyboard with a nice reciever. The computer store nearest to me had a Logitech K270 on sale, so I went for it. The reciever is a unifying reciever, so it's very small and easily replaceable should it decide to not work one day.

After disassembling the K270 I started tracing the matrix with the help from my girlfriend. It took maybe an hour or two, and was seemingly easy. I desoldered the PCB of the Das Keyboard, found an old three meter long (10ft) ethernet cable to use for wire, and started soldering the wires according to the matrix. Since the wires have different colors, I thought it would make it easier to not screw up. A whopping eight hours after beginning the process, I ended up with this very complicated piece of clusterfuck:


It's quite a lot of wire, and quite a lot of bad soldering because I got impatient (Lesson 1: use a small wire gauge). I hooked it up to the controller, and it didn't work correctly. It sent most of the keypresses but there were holes in the matrix. How do you find an error in ~20 meters (65ft) of wire scrambled on 105 keys? Short anwer: You don't. Long answer: Two arduinos, a shitload of breadboard wire, some coffee and start writing that code.

I happened to have a couple of arduinos lying around so I made my own keyboard matrix tester. One arduino sends a signal through the wires corresponding to the wires on the first membrane, the other arduino recieves the data and prints (through a serial port) which two wires were shorted.


This debugging procedure worked suprisingly well, and I found quite a few errors in my matrix mapping. It seems that a couple of the buttons had been switched around during the initial mapping, and around 10-15 buttons didn't work correctly.

So electronics one, me zero. I desoldered the entire thing, and decided to start from scratch, but this time have a more structured approach. Lesson two: keyboards are easy to fuck up, hard to fix.


Second attempt


The second approach was a little more in the spirit of keyboard science. I decided to scrap the key matrix my girlfriend had written down (sorry honey). Some of the switches got mixed up, and the entire thing just stopped making sense. I could probably have saved it, but the wiring was too sloppy. Instead I took some pictures of the membranes, maxed out the contrast and did some Photoshop magic. Now I could just fill a wire with a red color, and see it stand out on the membrane:

Now I was ready for some soldering. Unfortunately the crapload of wire I ordered from china had not arrived, so I decided to try to visaulize the wiring on the finished product. I made a small application that transforms my newly mapped keyboard matrix to 24 (the number of wires) sets of partially colored keyboard layouts for use with the excellent www.keyboard-layout-editor.com. The result looks like this:



So I went through my matrix again, found a few missing keys. and ended with feeling confident that my mapping was correct. I started soldering. It took a couple of hours, spread out on a couple of days, but in the end the result was a lot more pleasing to look at:



The controller soldered to a small prototype PCB for easier connections and a on/off switch:



Now for the temporary assembly:



I sanded the case when the blank finish pissed me off a couple of years ago, the plan is to cover it in some nice vinyl and add a USB charger port.

High-res membrane pictures and source code for the keyboard layout mapper are on GitHub.