Donnerstag, 26. September 2013

Expedit Coffee Bar

As the title implies, this is a simple mod to create a small coffee bar out of an Ikea Expedit rack.
I covered the desk with an 1 mm aluminium sheet, also the border is enhanced with an rectangular aluminium stripe. Everything is glued directly to the rack's surface in order to avoid screw holes.

The coffee maker is placed on a more ergonomic level. The stainless steal parts are also from Ikea (CAPITA) .

The lighting is made of an acrylic white plastic and a RGB led stripe. I bought 4 pieces of wood in the local home store, already cut to 33,5x33,5cm. I used my jigsaw to cut holes in each one, glued the LEDs to the wood using hot glue and assembled everything.


I used a self designed controller for the LED stripes. It is based on an ATMega8, and can drive 5-LED stripes. The firmware supports an 8-bit PWM on every channel. To control the lights remotely and changing the lighting mode I used an infrared receiver.  


This shows my test and development board. 


I used n-channel MOSFETs for switching the led stripes to reduce the voltage drop and to increase the efficiency of the board.
This picture shows the controller (and some other boards) after etching. 

To decode the IR-signals I used the great Infrarot-Multiprotokoll-Decoder (IRMP) library from mikrocontroller.net.

This is a demo of my new ethernet Arduino board I'm developing. I attached an IR-LED to the board and wrote a little program with buttons to change the colors. The windows program sends an UDP-package to the Arduino board which generates the IR signal. The LED controller receives the IR signal and sets up the light correctly.

In the future I plan to develop an Android app to switch the lights. 
The final installation is not very spectacular. As power supply I used an XBOX 360 HD-DVD drive AC adapter, which was left from salvaging the blue laser diode years ago.

As usual you can download the board files form thingiverse:
http://www.thingiverse.com/thing:156555

Sonntag, 8. September 2013

Building a small (Gaming-) KeyPad for StarCraft 2

A month ago or so I started playing StarCraft 2 again. I'm not really good at it, actually, but it's fun to play with my friends. I've never ever got used to the hotkeys, most of my refuse to practice. As an engineer I've tried to solve problems by creating tools, not to practice stupid routines. The grind hotkey system seems a good idea, but it if you think about it, there is a serious design fault. As a right-handed person you have to use the left hand for the hotkeys. The grid on the screen is on the right side and the most used keys are on the left. This means you have to use your little finger for the most common actions - that's not very comfortable. 
Another thing is that switching between right and left shift is not very intuitive. 
My idea was to mirror the grid on a special keypad. Mostly, you think from the middle of your view to the outside. The same is true for your hands. The index finger means center, the little finger is your outer side. 

It's totally stupid to shift the hole grid to the left.
For the brain (at least for mine) it's much easier to mirror the action, because we are always thinking from the center of our view to the left and the right side. 

After thinking about this I wanted to try it. So I decided to build a programmable mini keyboard. And this is the result:


First I salvaged some old Cherry-MX keys from an old keyboard. This was indeed cheaper than buying the buttons.



The case is fully 3D printed. The cover for the electronics is made of carbon, I personally like the way it looks. I even added folding feet to change the angle of the keypad.


 

For the future I plan to paint the buttons with somekind of rubber paint, called "PLASTI DIP". Thats a rubber like paint witch give the surface a very good grip.


The design is a simple matrix. Because this is a "gaming" device, every single button should be pressed at the same time. This means you need a diode for every button.



I used six of these PCB slices for the buttons, the last two rows are a little bit different, due to the different size of the key caps, though electrically the same.

The finished button matrix: 
Due to the fact the SMD-Diodes didn't arrive at time, I've soldered the normal ones out of my personal stock in. It's always a good idea to buy at least 100 pieces of the most used common parts. 


 

This shows the overall wiring of the button matrix and the USB-controller board:


The thing is powered by an ATmega8U2. These little guys come with a preprogrammed DFU bootloader. To use it as a HID-Device I used the LUFA-USB Framework. I just had to edit the Keyboard Demo a little bit. Unfortunately the Atmega8U2 has only 8kB of flash. The preprogrammed bootloader uses already 4kB and the USB stack another 3, there is not much left, but enough. Originally I planned to add a virtual serial port to edit the keyboard layout, but after adding the keyboard functions I have only less than 400 Bytes left and I'm not sure if this is enough. 

For now if I hold the upper left key pressed while plugging it in, the original Atmel bootloader comes up and I can flash it with the FLIP-Programmer. This can be done by an easy jump:

void (*bootloader)( void ) = 0x0800; // Address is in Words not Byte !!!!
          
void BootloaderCheck(void)
{
   readButtons();
   if (BootButton)
     { 
     bootloader();
     } 
}
I thought this would be interesting because I did't find so much about how to use the the bootloader of the ATmega8u2 and I tried a lot until I got it to work.

The keyboard layout can be easily edited by changing the values in the array:
uint8_t KeyTable[6][6] = {
 {HID_SC_0, HID_SC_9, HID_SC_8, HID_SC_7, HID_SC_6, HID_SC_ESCAPE},
 {HID_SC_1, HID_SC_2, HID_SC_3, HID_SC_4, HID_SC_5, HID_MO_LEFTALT },
 {HID_SC_T, HID_SC_R, HID_SC_E, HID_SC_W, HID_SC_Q, HID_SC_TAB },
 {HID_SC_G, HID_SC_F, HID_SC_D, HID_SC_S, HID_SC_A, HID_SC_BACKSPACE},
 {HID_SC_B, HID_SC_V, HID_SC_C, HID_SC_X, HID_SC_Z, HID_MO_LEFTSHIFT},
 {0x00,    0x00,  0x00,    0x00, HID_SC_SPACE, HID_MO_LEFTCTRL}
 };


Conclusion:

Back to the original intention: playing StarCraft 2. I played some games with it and you learn using the hotkeys incredibly fast. As I thought the mirrored grid is very intuitive. You don't have to move the hand as much as if you use the normal hotkeys and with the two rows of numbers, every short group is easily reachable. The rectilinear grid of the buttons is more ergonomical than I thought. 
Over all I like it (and it was fun to build a keyboard ;) ), even there is now a little space problem on my desk:


I put the 3D-Files, the PCB and the Sources on thingiverse: