Saturday, November 8, 2014

GKOS Keyboard for Arduino

I built up a 6 switch keypad for use with the Arduino GKOS keyboard Library . I used small surface mount switches and super glued them to a PCB with a three foot ribbon cable.




This worked OK but it is hard to do key presses with more than 3 key chords with these switches. I will need to rebuild the keyboard using something like Cherry mechanical keyboard switches. With the minimal practice I have had with GKOS it seems like it is learn-able and usable with the help of a keyboard layout graphic. I would place this graphic on the side of the keyboard facing the user.



The Arduino Library provided by the Gkos_library is excellent and implements the full GKOS chord set. I did have a few issues getting it up and running and needed to make some quick updates to the library and the example code since it was developed a few years back. Here is the modified example code I used:


1:  /* Test your Gkos with the Serial Monitor of the Arduino IDE  
2:  This is a simple test to check that your GKOS keypad is  
3:  working, by showing on serial monitor the text you type.  
4:  */  
5:  #include <Gkos.h>  
6:   char* gEntry = "";   
7:  // Initialize Gkos library with pin numbers for keys A to F.  
8:  // Digital pins 14...19 are the same as analog pins 0...5  
9:   Gkos gkos(14, 15, 16, 17, 18, 19);  
10:  void setup(){  
11:   Serial.begin(9600); // Set up Serial library at 9600 bps.  
12:   // Use the Arduino SDE Serial Monitor to view the output!   
13:  }  
14:  void loop(){  
15:   gEntry = gkos.entry(); // Will return empty immediately if no entry  
16:   if (gEntry != 0){gPrint();}  
17:   // Add your other code here  
18:  }  
19:  void gPrint(){ // Convert commands depending on your application  
20:   if (strcmp(gEntry, "_Enter") == 0){  
21:     //Serial.println("");  
22:     Serial.write(10); Serial.write(13); return;  
23:   }  
24:   if (strcmp(gEntry, "_BS") == 0){  
25:     Serial.write(8); return;  
26:   }  
27:   if (strcmp(gEntry, "_Del") == 0){  
28:     Serial.write(127); return;  
29:   }  
30:   if (strcmp(gEntry, "_Tab") == 0){  
31:     Serial.write(9); return;  
32:   }  
33:   // Default   
34:   Serial.print(gEntry);  
35:  }  


Here is a link to the modified Library files to replace the existing ones:

Modified Library Files

The next step is to built a better keyboard and perhaps make it a little ergonomic. I am thinking of something in the shape of a standard game pad with the three switches on each side of the wedge operated by your index, middle, and ring fingers.



No comments:

Post a Comment