I followed up on the keypad/keyboard I started to build for the input device week, focusing on USB as the interface.
I finished most of the USB work then, but I’ll recap it here. I made a USB breakout board for my Fabduino:
I also designed and milled a keypad board. The goal was to use the Atmel QTouch library, which looks like it has some nice features built in.
Here’s the keypad schematic:
I soldered ribbon cable connectors to the keypad board to connect to the Fabduino. Since I made the via holes too small, I had a rough time getting wires through. It looks pretty bad with the hacked two-sided design:
I need to rethink the design and use the vinyl cutter for the two-layer portion.
I realized I missed the following things in the design, which have jumper fixes for now:
- USB D+ needs to go to pin INT0 (or INT1), that’s PD2 or PD3
- AIN0 (PD6) needs to go to ground for QMatrix designs
The collection of boards is getting messy. There are 6*3 + 2 connections from the keypad to the Fabduino, 1 pin jumped to ground, 2 data pins from USB, 1 data pin jumped to another, and power from the USB board. Probably worth redoing in a single board design.
Here’s the Fabduino with the USB breakout and keypad connectors attached:
After a lot of trouble, I got the QTouch library building and working successfully. I worked off of the QMatrix avr5g3_qm_example (meant for AVR Studio) and adapted a makefile from the VUSB project to build it with plain avr-gcc. The port configurations are in touch_config.h and the pin configurations are in main.c.
The code, libraries, and build tools are here. Right now I have it blink an external LED when a “key” is pressed, since I haven’t combined it with the USB key output code. The default settings are pretty sensitive: I get reliable detection from 0.5-1″ away.
The USB output code works by itself, though. My board prints “HELLO” repeatedly:
More progress to come… I may redesign a single keypad board with integrated logic and USB interface, to avoid the nasty mess of wires I have now. I’ll probably use the vinyl cutter to design bigger and easier two-layer designs.