Here is a quick guide:
Please ask me if you have any questions or if anything is unclear.
I use a transistor to simulate the momentary key-presses that the keyboard controller expects, the base input is connected via a 15K resistor to isolate the signal enough to not mess up the way the keyboard controller scans the switch matrix.
The transistor does not need to be the F422 that I have used, pretty much any NPN transistor is usable as long as you have space for it.
As we all know, most keyboards feature a diode to ensure some kind of support for multiple simultaneous key-presses, this diode is replaced by the transistor, a controllable diode, and the old switch is in effect just shorted.
Next you need to find 5v, gnd and caps lock signal, some keyboards controls the anode of the caps lock LED, some control the cathode, therefore you can measure the two connections on the LED and one of them should be connected to either +5V OR gnd, so here you can connect the appropriate 5V or gnd wire, and the other pin on the LED has the Caps Lock signal that we also need. (see notes regarding the "==" and "!=" in the code, as this changes with the whole anode/cathode-thing)
There is also a 4,7K resistor so that the signal from the switch does not float when the caps lock switch is off.
Electrical drawings:
I planned on using a Attiny85 because I had some lying around, and they are tiny, as the name implies...
Unfortunately I did not have a programmer, but I was lucky to find the following guides for using an arduino as a programmer;
http://hlt.media.mit.edu/?p=1695
http://hlt.media.mit.edu/?p=1706
A added benefit of this was that I could use the simple Arduino code language to program it
and after some simple prototyping using a Arduino Nano, I changed some pin numbers in the program and programmed a attiny with the following code:
Code: Select all
int Lock = 0; // Input pin connected to MX Lock switch
int Capsled = 1; // Input pin connected to Caps Lock LED signal
int SwOut = 2; // Output pin connected to transistor acting as momentary caps lock switch
void setup() {
pinMode(Lock, INPUT);
pinMode(Capsled, INPUT);
pinMode(SwOut, OUTPUT);
}
void loop() {
int LockState = digitalRead(Lock);
int CapsState = digitalRead(Capsled);
if (CapsState == LockState){ // Compares the state of the switch and state of caps lock LED, change the "==" to "!=" if function is reversed
digitalWrite(SwOut, HIGH);
delay(10); // time in milliseconds the simulated caps lock switch is "pressed" increase if key changes are not registered
digitalWrite(SwOut, LOW);
}
delay(50); // delay to increase stability
}