Good evening, I've got the following problem that I'm trying to solve. I'm currently doing a masters project in electronics, involving some analogue and digital signal processing. This all works rather well using an ADC and a DSP. However, I'm now trying to achieve the following: Based on the analysed data the DSP recognizes one of 6 cases and uses 3 GPIO pins as outputs for these. I'd like to be able to send simple keycommands to a PC via USB based on what case has been recognized. Is there a simple, readily available, device that acts as a USB HID (keyboard) device that automatically sends "left arrow" "right arrow" etc to the PC ? I'm looking for a solution thats relatively easy to implement, as I don't have much time to implement this, which isn't a main part of my project. Any tips / ideas are greatly appreciated. Thanks
A PS/2 keyboard is quite easy to implement, if you need a solution on a very short time scale...
easier to implement than USB HID ?
PS/2 is a simple serial asynchronous connection, and the data the keyboard sends is easy to implement. For a HID client implementation (USB) with an ATmega have a look for V_USB; they have a project which does about what you need (http://www.obdev.at/products/vusb/hidkeys.html). It sends keystrokes over USB depending on some inputs (keys).
Thanks, I had a look at their demo HIDkeys, looks great, only issue is that I don't have the required number of output pins on the device I'm using. Otherwise I'd just use the HIDkeys circuit and code, change the key assignments and pull the required pins low using output pins of my device. I've looked at the USB-I2C device at http://www.firmwarefactory.com/USB-I2C.aspx Do you think I can rig that to identify as a keyboard and just send the required messages to it via I2C when I want to "press a key"? Thanks Chris
There's a commercial PS/2 keyboard emulation add-on for Bascom (www.mcselec.com), which makes sending scan codes to a PC a piece of cake... If you're using C, there should be ready-to-use code as well. The search phrase would be "arcade" (people building there own game controllers with PS/2 connections). Good luck Klaus
The NXP LPC1343 CortexM3 has USB HID and USB Mass Storage drivers in its on-chip rom. fchk
Just had the idea to simply use a I2C 8bit I/O extender. That way I could use the HIDkeys circuit and code an simple pull one pin at a time to trigger a "key pressed". According to the ATMega8A datasheet 12MHz at 3.3V is outside the Safe Operating Area. Has anyone got any experience running the ATMega8A at 3.3V and 12MHz? I don't really fancy introducting yet another voltage level to my circuit, with another set of level shifters etc.
microchip has for their PICs with USB examplecode which implements a HID keyboard and mouse. this is for free also the compiler and development software.
Is this for a one-off design or are you planning to mass produce this? In the second case I can only recommend to stay away from PS/2 as it is an aged and never well documented interface. It can take you a few years to get the protocol stack sufficiently debugged because there are so many implementations around that vary in significant non-obvious details.