HID -- this is really all it takes??

http://macetech.com/blog/?q=node/46

For the moment forget what he is doing with it. Please and stop lol.

I see parts besides PCB are ATTiny45, 1 cap and 3 resistors = 1 HID keyboard. No special USB chip, etc.

And with Arduino as ISP, how hard to program the chip? Examples exist for keyboard, mouse and joystick at least.

I got to that web page through the USnooBie site and hey before now I thought that making HID would be harder!

Just one more way I am happier because I bought Arduino!

Okay now someone point out the lumps in this gravy and bring me back down!

Yes, I can probably make a working mouse/keyboard/joystick/gamepad using any weird sensor I can find within an hour.

Warning, the circuit you see in macetech.com might not work on all computers. It'll work on SOME computers, not ALL. I made the same mistake and discovered that you must have 3.6V zener diodes on the D- and D+ line if you want to use 5V as the power source.

I see the 3.6V Zeners, 5 for $1 at AllElectronics.com.

I already need a resistor assortment pack and many other bits (like caps for one) from there, looks like I should get a couple bucks worth of Zener diodes.

Yeah, that project was the old version. I made a newer one with zener diodes here: Capslocker Rebuild | macetech.com

It's a little picky, still. Seems to work on most PCs, not so easily on Macs though it knows it's a keyboard.

The downsides: can't do much else on the same uC, timing is critical. Easy to break compatibility.

For simple HID I would go with one of the newer ATmega with USB, like the 8u2. Then you can use the LUFA stack and make all kinds of USB devices.

Still...hard to beat seeing a tiny 8 pin chip doing the job. It's fun to play with for sure.

that little application its based on vusb and as frank26080115 said on most computers youll need to use diodes on the D-,D+ to limit the voltage on that lines you can read more here

Thanks for the links. I really do like the minimalist approach. I see ATTiny85 for under $2 at Mouser.

While getting ready to buy (soon) I've run across the not-completely-Arduino Teensy and Teensy++. They promise to do HID almost painlessly, with examples. Well, -maybe- later.

yeah the dip package its under 2$ (smd its a bit over $2) but be sure to order the attiny85-20 since you need to use the internal oscillator at 16.5mhz

I've got some 20 pin sockets they'll fit in that if I wire up properly will sub for circuit boards. Bit of hot glue to pot and have an instant base/insulation. I do need to make or get a USB plug...

After proving I can do a cheap HID, I have parts to build flight sim rudder pedals as you can't get decent ones for less than real money.

It is all that it takes from a hardware point of view. The software part is not that easy. I once wanted to implement a "caps lock be gone". The ideas was to register as a hid keyboard. Whenever said "keyboard" received the command to light up the caps lock LED it would send a caps lock keypress. This never really worked. The interesting part is that (a) this works for num lock without a flaw (b) according to wireshark the issue that the "light up the caps lock light" did not always got sent by the computer - but only for the fake keyboard.

Could you read the regular keyboard? Could you watch for the CapsLock to be pressed instead of watching for the light?

that behaviour differs between Windows, Linux, and Mac, and yes it does depend on which LED too

Frank, IIRC from your business card demo the user is instructed to hit caps Lock 3 times to start your contact info coming it to his notepad window....

GoForSmoke:
Frank, IIRC from your business card demo the user is instructed to hit caps Lock 3 times to start your contact info coming it to his notepad window....

Yea that works for Windows only apparently

i can confirm that :stuck_out_tongue: i burned the source on a custom atmega8 board (made some changes to the source) and when i tried it on ubuntu it was not working - but on windows worked without a problem

So the HID implementations are different? I wonder which is not quite standard?

that behaviour differs between Windows, Linux, and Mac, and yes it does depend on which LED too

According to the HID standard the behaviour should NOT depend on the OS. Anyway the behaviour was correct for "real" keyboards, only with my "keyboard" I saw hickups. I read the standard several times and monitored the bus. Till today I have not even the faintest clue why this failed. The only hint / difference was that all real keyboards registered as USB 2.0 devices whereas my fake keyboard registered as a USB 1.1 device.

Could you read the regular keyboard? Could you watch for the CapsLock to be pressed instead of watching for the light?

Yes I could but it would defeat the whole idea. The idea was a dongle that would just be added without any modification of the keyboard or the computer's configuration.
I could also rip the chips out of a standard keyboard but the idea was to use just a tiny85.

frank26080115:

GoForSmoke:
Frank, IIRC from your business card demo the user is instructed to hit caps Lock 3 times to start your contact info coming it to his notepad window....

Yea that works for Windows only apparently

If you change the card to use some of the copper for a capacitive sensor then you could change the instructions to touch the plugged in card on some spot to initiate? Hell, you could have different touch spots trigger different actions, at least within the limits of the chip(s) on the card. How much memory can you cram on -cheaply- that the Tiny can use?

As Cleese said in The Architect Sketch, I hadn't fully divined your intentions.

Is the light toggled or on/off? If the latter you could just periodically tell it to turn off.

I found this at a Linux site while looking around: USB Human Interface Device (HID) Configuration

It is important to remember that the HID driver handles those devices (or actually those interfaces on each device) that claim to comply with the Human Interface Device (HID) specification. However the HID specification doesn't say anything about what the HID driver should do with information received from a HID device, or where the information that is sent to a device comes from, since this is obviously dependent on what the device is supposed to be doing, and what the operating system is. Linux (at the operating system kernel level) supports four interfaces to a HID device - keyboard, mouse, joystick and a generic interface, known as the event interface. These are implemented by the Input device level.

Plenty room for wiggle:

You may not need any operating system support at all to use a USB keyboard if you have a PC architecture. There are several BIOS available where the BIOS can provide USB support from a keyboard plugged into the root hub on the motherboard. This may or may not work through other hubs and does not normally work with add-in boards, so you might want to add in support anyway. You definately want to add keyboard support if you add any operating system support, as the Linux USB support will disable the BIOS support. You also need to use Linux USB keyboard support if you want to use any of the "multimedia" types keys that are provided with some USB keybords.

Sorry GoForSmoe, but your hints are completely off the mark. As I said I was digging really deep into the subject. There is no "keyboard release caps lock command". Only a toggle caps lock command. Also the standard states that the host is responsible for keeping proper caps lock state. Hence there is no means for a keyboard to detect the state but the request from the host to enable the caps lock light. If the host does not send it (which it did not in my case) then you are out of luck. I am absolutely sure that the host was causing the issue because the command was not visible on the bus. However I still have no idea why the host behaviour was different for my device only.

Well you plug the thing into the PC you are using. Can you tell it the CapsLock state from the PC keyboard or notepad as part of starting the plug proper?