[Steve] created an AVR programmer using an old USB keyboard. We feature a bunch of AVR programmers, but this one is made from parts that many people will have lying around. There are two components: the controller PCB from a USB keyboard, and an optocoupler for emulating key presses.
In order to send data to the AVR, [Steve] used the LED outputs on the keyboard. These LEDs can easily be toggled according to the HID device specification. They provide a 5 volt output with current limiting resistors, which means they can be connected directly to the target AVR.
Reading data is a bit more complex. The optocoupler tricks the keyboard into believing that a single key has been pressed, firing off a data transfer. The MISO pin on the AVR is connected to the row and column of the shift key, which is read by the driver.
On the software side [Steve] created an avrdude interface driver. This allows the programmer to be used with avrdude, just like any other programmer. [Steve] does point out that it isn’t the fastest programmer since the keyboard tries to debounce the MISO input, greatly limiting the speed. However, since it’s made from stuff you might have in your junk bin, it’s a neat hack.
I did something similar as a school project – transfer of image data bit by bit using the keyboard LEDs. The USB device was a pSoC.. basically what I found was that the keyboard leds are not a reliable data transfer device, at least on Windows.
Did you communicate directly with the keyboard, or was the operating system’s HID driver doing the job? Since I unload the kernel driver and access the keyboard from userspace, that works fine and very reliable. Also this doesn’t interfer with the state of the ‘real’ keyboard attached to the machine. On Windows this should work by removing the default HID driver in the device manager, and using zadig to bind the generic libusb-driver to the device.
Yep, through the HID driver. So that may have been the problem.
One of the most original hacks I’ve seen.
WOW i never even can remotly pretend i thought of this one! very nice!
I don’t really see the use of the de-bouncing here as there are no physical buttons. can someone explain this to me?
The keyboard controller does it because it was designed to read mechanical buttons. I also believe the speed is limited by how fast keyboards transfer types to the computer(you cannot really type that fast but for a microcontroller…. that’s slow)
Oh yes, I didn’t read the website itself. Because I was wondering “why the hell would he be debouncing digital signals” in the first place.
badass hack. nice pick hack-a-day
and _these_ are the kind of hacks we should be reading about.
bump
Wow I had the same idea, never got around to making it happen. I even have the pcb as shown. Kudos for making it happen and not forgetting about it.
Depending on the hardware, he might be able to have the circuit cascade into pushing another button that the driver doesn’t listen to in order to get around the debounce.
This solves the egg or chicken paradox for building an own USB-AVR Programmer.
Congrats! Your HackADay has been featured at Reddit. BEST USE of a rubber dome controller YET!
http://www.reddit.com/r/MechanicalKeyboards/comments/13vjj3/best_use_of_a_rubber_dome_keyboard_yet_use_the/
Why not use a usb mouse as a return channel?
Because it needs extra hardware? I don’t see why not, but I don’t see what the advantage would be, as the keyboard already has the input and output that it needs.
This actually inspired me to create a little gadget for my girlfriend. She was suffering lack of num-section in her laptop, so I bought one of those USB numerical keyboards with USB hub. I split it apart and packed tiny-attiny13 and entrails of an old pendrive inside. AVR listens to what num-lock diode says, and depending on what it is (no, I am not going to tell you the secret sequence), enables pendrive power line via transistor. In order to achieve thrilling impressions in user, there are also few red smd leds blinking&shining through holes drilled in a special shape on the top of the keyboard case. All of those cheap USB devices seems to be so hackable!
too goood plz improve it more and more
Someone should make a variant of this that uses the integrated sound IC on most laptops as a programmer/reader using a mic and both L and R channels.