Update: Some people requested details on the LED replacement, so I made a new video (on the bottom of this post) to clarify the process.

I tried a keyboard with Cherry blue mechanical switches and I loved the feeling, a couple of weeks later I decided to buy one.  As I was about to spend 100 euros on a keyboard, I decided that I might as well pay 20 or 30 more and buy one with backlighting. Backlighting is pretty unimportant on a keyboard, but it does help a bit when using it on dark environments and, let’s be honest, it looks cool…

After searching for a bit, the cheaper peripheral that fitted the requirements that I could find was the Razer BlackWidow Ultimate and it also has extra programmable keys, so I picked one up in a store for 120euro (yes, for some reason razer peripherals are sold with a conversion rate of 1USD to 1EUR). During the day it was almost acceptable but, in darker environments, the blue backlight was really unpleasant. I bought a big bag of 3mm white LEDs on eBay (around 5usd), improvised a keycap remover and replaced the blue LEDs with the white ones:

Improvised keycap puller.

Improvised keycap puller.

All the blue LEDs were replaced.

All the blue LEDs were replaced.

It looks a lot better and feels a lot less harsh to the eyes in dark environments.

Quality-wise the hardware is not bad but I quickly found out the software is atrocious. What Razer calls Synapse 2.0 is one of the most obnoxious pieces of software I’ve erver used. It is large, it required me to login and it crashes half the time (the last one might be because of my environment, but everything else works fine so I won’t lose any time trying to make it work), unfortunately the macro keys, macro recording and, basically, everything macro-related doesn’t work without the software running. When selecting the backlight brightness with the combination Fn+F12 there are only OFF, DIM, NORMAL, BRIGHT and PULSATING (wich is pretty useless). In the configuration software there is a tab with a sliding trackbar control for selecting the brightness but, after selecting the desired brightness level (wich is updated immediately in the keyboard) and releasing the mouse button, the trackbar jumped to one of the predefined settings and the same happens on the keyboard. Unfortunately for me, I found out that my preferred light level to use at night under fluorescent lighting was between the “OFF” and “DIM” positions. I emailed razer support and, after a couple of emails, the final answer was:

Thank you for your patience. 

We would like to clarify this further. 
The lighting option cannot be adjusted to specific level of brightness like you are trying to achieve. 
You are only able to use the options available – OFF, DIM, NORMAL or BRIGHT. 

Hope that clarifies the matter, thank you.

Well, it became pretty “clear” that I bought a very expensive crappy product.

Not one to accept defeat easily I decided to try and implement a custom backlight controller. Fortunately it was easy to understand how they did it. Every LED’s anode is connected directly to +5V from the USB and each individual LED’s cathode has a resistor (470 ohm, if I’m remembering correctly).

Razer's backlight schematic.

Razer’s backlight schematic.

The resistors are then all connected to a SOT-23 transistor that looked like a general purpose NPN with the base connected with a 10k resistor to the microcontroller (freescale MC9S08).

Original location of the NPN transistor driving the LEDs.

Original location of the NPN transistor driving the LEDs.

After realizing it was going to be reasonably easy easy to build a custom brightnesss controller, I found out the top cover is actually slightly translucid, that means it is possible to sense the ambient light level without  using visible sensors. I made a simple PCB based on the ATtiny1634 (eagle project and source code available for download below):

Eagle schematic.

Eagle schematic.

The relay is latching, that means it only needs a quick pulse to change and remains stable without additional current, it is used to switch between the two sources of PWM, the one from Razer’s MCU and the AVR one. The light sensor is a common photoresistor and I used a BCP56 NPN transistor to drive the LEDs.

During  the preliminary tests I realized I needed to know when the PC was off, otherwise the backlight would remain connected (I’m using the keyboard connected to a powered USB hub), for this purpose I connected a 10k resistor between the PWM signal from Razer and the AVR pin PA4, this way the microcontroller knows that if Razer’s backlight signal is disconnected the PC is turned off and it needs to drop the brightness to zero.

The button is used to switch between modes with a long press (automatic brightness, manual brightness and razer’s original mode). With a short press it is used to toggle the manual brightness options.

The brightness can also be configured via the AVR’s serial port, it is connected to a 3.5mm audio jack located near the button.

Button and serial port jack.

Button and serial port jack.

Everything in place, ready to reassemble.

Everything in place, ready to reassemble.

This is the final result:

In conclusion, if you want a backlit mechanical keyboard just buy a ducky, or deck, or something other than a Razer, the software is really bad and without it the macro keys and macro recording are useless anyway…

Eagle files for the PCB: https://dl.dropboxusercontent.com/u/32621523/publicado/razer_backlight_eagle.zip

Code: https://dl.dropboxusercontent.com/u/32621523/publicado/ATtiny1634_Iluminacao_teclado.c

LED repalcement: