Pimped Robotic Cherry G80 3000 Keyboard
- Published: Tuesday, 19 November 2013 00:16
- Written by Justblair
Some hacked together projects are born to solve problems, some provide proof of concept. This project did neither, I did it because one day I had an idea that I thought would be cool and so I just did it.
The project itself is pretty simple, but I think the result is as cool as I had hoped. Dear Internet, I give to you my robotic keyboard.
The Cherry G80-3000 is a one of the more affordable mechanical keyboards on the market right now. Sporting Cherry MX Clicky mechanical keys this is a far superior keyboard to your average OEM offerings that most people type on. Mechanical keyboards usually cost a lot more money than the Cherry branded G80-3000. Of course buying a keyboard at the cheaper end of the market, you can expect that there will be some differences. The Cherry G80-3000 does not include a metal plate like it’s more expensive cousins and it does not include any extras such as backlit keys or USB ports either. However it is a lot lighter than other mechanical keyboards and there is rather a lot of fresh air inside it’s plain black ABS case.
It was it’s lightness and fresh air that inspired this rather silly project.
This keyboard now sports a number of extra features that elevate it from the standard Cherry G80-3000.
- RFID (Radio Frequency Identification) Password Management
- Capacitive sensing of user
- USB Port
- Robotic feet
- Aux Port for further features!
The most striking feature of my Pimped keyboard is the automatic feet. This was also the most troubling to get right.
You can see in the movie clip this keyboard senses the approach of human hands and raises itself to a comfortable typing position. When you are finished typing the keyboard goes back to rest. The system requires no contact from the user to raise the keyboard, it just appears to rise as if by magic.
The other additional function is the RFID reader.
The RFID reader recognises RFID devices such as key fobs or cards and types passwords when it recognises one that belongs to me.
This project took some time, mostly because a couple of early failures led to procrastination on my part.
Project Parts List
- 1 x Cherry G80-3000 Keyboard
- 1 x MT-DB-U4 Development Board
- 1 x Electronic brick - 125Khz RFID Card Reader
- 1 x cheap USB hub
- 1 x USB PC Back Plate
- 4x HXT 900 9G Servos
- 2 x 3D Printed Feet
- 4x 684 ZZ (4 X 9 X 4mm) Bearings
- 2x M4 machine screws
- Heat Shrink
- 1 x rocker switch
- 1 x 10 pin female header
- Various electronics connectors, proto board etc.
The project itself is based on an MT-DB-U4 (ATmega32U4 USB) Development Board from MattairTech. I love this little board for all sorts of reasons, but mostly because it uses the same microcontroller as the Arduino Leonardo. When I bought this board the Leonardo was not quite out, but I managed to upload the Arduino Boot loader to it with a little changing around of the code. In later versions MattairTech now offer a choice of boot loaders, one being the boot loader from the Arduino Leonardo. This makes it easy to program the microcontroller using the Arduino IDE as well as giving access to the libraries developed for Arduino.
The HXT 9G Servos replaced the Original servos that I chose for this project. Originally I used 3.7g no-name servos. The 3.7g micro servos were chosen originally because they matched exactly the dimensions of the original feet hinges on the Cherry G80-3000 Keyboard. Not being a mechanical engineer I had to make a guess that these would be strong enough and my initial tests showed they were. In fact I was able to lift the keyboard using just two of these servos. So I pressed ahead with these servos and everything appeared good. Unfortunately once the new robotic feet were made and in place it seemed the servos lost power after just a evenings playing around. So I then tried doubling up with another two. This again worked for just an evening before these too became too weak to lift the keyboard. This was frustrating as I had taken the time to design feet that matched the keyboards originals closely.
After several months of non-action I eventually redesigned the feet so that I could use the more powerful and larger HXT900 servos. These are much more powerful than the original micro servos and seem capable of lifting a whole lot more weight in future should I add further modifications to the keyboard.
The Cherry G80-3000 keyboard is held together with plastic tabs rather then screws. To open it is just a matter of inserting a flat headed screwdriver into the tabs and prising them open. Inside the keyboard is a decent amount of space, especially at the very top of the keyboard above the function keys.
The first alteration that I made was to disassemble a cheap unpowered 4 way USB hub bought from E-bay. I purchased basically the cheapest and nastiest item I could. The one that I went for had 4 ports which took the form of wires leading to female ports. This was ideal as I could remove the male and female plugs and solder direct to the wires.
I reused the original USB cable from the Cherry G80-3000 soldering it to where the male USB connector had been on the Hub. Three of the 4 ports of the hub are used in the project, one is attached to the keyboards original controller, the second to my MT-DB-U4 Development Board (Which emulates a second connected keyboard) and the third I attached to a female USB socket mounted on the right hand side of the keyboard. The final port is still unused, I have left the cable attached to the hub so that I can add more features in the future. I will possibly use it to attach a bluetooth adaptor in future, that would be ideally placed for controlling a mouse.
The USB female socket was removed from a PC back plate and has M3 Mounting holes. I filed out a rectangular hole in the Cherry G80-3000 case and used counter sunk machine screws to hold the female USB port in place. I have used silver coloured screw heads at the moment because i had some to hand, but I will fit some black ones as and when I find some.
The original feet that came with the Cherry G80-3000 keyboard were removed and the plastic hinges ground out from the keyboard case. Two HXT900 servos make the new motorised hinges for the keyboard feet.
I designed the keyboard feet in OpenScad, open sourced 3D modelling software. The feet themselves are made up of a 3D printed ABS plastic foot. On the end of the foot where normally you find a rubber pad, I have instead added a miniature roller.
The plastic foot is printed including support After the part is trimmed and sanded, I treated the foot in acetone vapours. A container with some acetone in it is heated to 100c. The part is placed inside the container on a shelf. As the Acetone boils off it’s vapours melt the surface of the ABS plastic part. This has the effect of smoothing the part and making it stronger. You can see a before and after shot (right). The Roller is constructed from two 684 ZZ (4 X 9 X 4mm)
Bearings placed side by side on the threaded part of a M4 Machine screw. To make a tyre for the roller I used two layers of heat shrink insulator trimmed to fit.
To prevent the bearings rubbing against the plastic foot I used metal washers. Unfortunately M4 washers were simply too big for the purpose, so instead I used M3 washers and drilled out the hole to 4mm. The washers look slightly the worse for wear after the modification, but they are hidden when the foot is assembled.
I then assembled the foot, using the M4 Machine screw to cut it’s own thread in the plastic foot. The M4 machine screw was then cut down to size and converted to become a grub screw by cutting a slot head into the end.
When assembled the foot looks pretty good. The close up shots don’t really do it justice!
Two servos per foot are hot glued to the bottom of the keyboard case and the servo horns friction fit into the hinge end of the roller feet. The servos are controlled by a pin each on the microcontroller and work together to lift the keyboard.
The keyboard detects the presence of humans above the keys using capacitive sensing. A long wire is hot glued around the upper half of the keyboard case creating an invisible fence around the keys. A resistor is attached to one of the pins (the send pin) of the microcontroller and then to both the sense wire and another pin of the microcontroller (the receive pin).
The sensing wire behaves like one side of a capacitor, when a human comes near the human behaves like the other half of the capacitor, allowing it to function. The Send pin on the microcontroller is pulled high momentarily, feeding the “capacitor” with a voltage. By timing how long it takes for the receive pin to be pulled high we can tell how much capacitance exists as our capacitor will take time to charge up. If there is no human presence, the receive pin will register the higher voltage more quickly and we then know that their is no human present.
Happily for me a capacitive sensing library already exists for the Arduino IDE, so all I had to do was choose a high value resistor and add the code to my sketch.
When using the library with the included example code I found my results were inconsistent. It turns out that the Capsense library periodically auto-calibrates itself. This was what was causing the problems as when typing for any length of time, the auto-calibration was affecting the sensitivity. The solution was to switch off auto-calibration in the code and create a manual calibration method instead. The manual calibration occurs when the rocker switch that I added to the side of the keyboard is switched to on. The rocker switch serves a second purpose. Should the user get fed up of the servos lifting and lowering the keyboard the rocker switch can disable the behaviour.
The RFID reading ability is provided by a 125khz RFID module. The module is connected to the hardware serial port of the Microcontroller and when it reads a RFID chip it sends the serial number of the card. The module has a loop antenna that is simply taped onto the top side of the Cherry G80-3000.
The antenna is powered so that it creates a magnetic field just above the keyboard. When a RFID device is brought within the magnetic field it’s own loop antenna converts the magnetic field into a voltage. This voltage is just enough to power it’s own transmitter which broadcasts a unique ID. This ID is received by the keyboards module and sent to the microcontroller. RFID is a reasonably secure authentication method but I must stress that this system is not for use in systems that are security critical. For my purposes this is secure enough.
The MT-DB-U4 Development Board is bonded to the base of the keyboard case and breaks out to a piece of proto-board that provides the headers for all the modules to connect to. I added a 1500uf capacitor to the 5v line here to take care of voltage surges caused by the servos activating. I have no idea if this is required, but it seemed like a good idea.
Finally I added a 10 pin connector to the rear of the keyboard case. I have plenty of ports left unused on the MT-DB-U4 Development Board, so I thought it would be nice to have a the option to plug other devices into this “Aux” port. In the future I might create secondary input devices that plug into this port.
I have tried as much as is possible to keep the keyboard looking stock.
The source code for this project is available from my github page https://github.com/Justblair/Arduino-Leonardo-Keyboard-Pimp
The files for the 3D objects can also be found on Thingiverse http://www.thingiverse.com/thing:187075