A Mini USB Keyboard That Isn’t A Keyboard

A useful add-on for any computer is a plug-in macro keyboard, a little peripheral that adds those extra useful buttons to automate tasks. [Sayantan Pal] has made one, a handy board with nine programmable keys and a USB connector, but the surprise is that at its heart lies only the ubiquitous ATmega328 that you might find in an Arduino Uno. This isn’t a USB HID keyboard, instead it uses a USB-to-serial chip and appears to the host computer as a serial device. The keys themselves are simple momentary action switches, perhaps a deluxe version could use key switches from the likes of Cherry or similar.

The clever part of this build comes on the host computer, which runs some Python code using the PyAutoGui library. This allows control of the keyboard and mouse, and provides an “in” for the script to link serial and input devices. Full configurability is assured through the Python code, and while that might preclude a non-technical user from gaining its full benefit it’s fair to say that this is not intended to compete with mass-market peripherals. It’s a neat technique for getting the effect of an HID peripheral though, and one to remember for future use even if you might not need it immediately.

More conventional USB keyboards have appeared here in the past, typically using a processor with built-in USB HID support such as the ATmega32u4.

12 thoughts on “A Mini USB Keyboard That Isn’t A Keyboard

  1. Not sure I see the purpose of this. With so few keys , so far from the keyboard and with the board floating like that, don’t you risk breaking the usb connector eventually ? Why not simply script something that uses modifiers like CTRL and ALT to simply trigger the wanted macro ?

    1. Obviously it’s designed for a manager he doesn’t like, otherwise why would the buttons be as far as possible away from the USB port he’s trying to break for maximum leverage. Also note the cunning obstruction of the headphone port and the high speed USB 3.0 port.

  2. wait, is this fail of the week in disguise?
    Softusb would enable HID, plug and play in every usb device without needing a driver or companion program, and reducing the part count, the usb bridge isn’t needed!

  3. I do like the serial angle. I’ve personally had macro keyboard builds and hacks get bogged down in figuring out HID handling — telling the kernel that such-and-such a device needs to send all its input to process X, and shouldn’t be treated like any other keyboard — so doing an end-run around that by removing USB from the equation almost entirely is a good hack.

    That said, this story got me off my inertia to build the vintage calculator keypad-based shortcut keyboard I’d been intending to get to for quite a while now, but mine is just an Arduino Micro and the HID-Project libraries because it doesn’t actually need to be more than a keyboard and mouse.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.