What I want to build: a device into which I can plug in my keyboard and that will look like a USB keyboard if I plug it into a USB host of any kind that accepts a keyboard. The idea is for it to be all in hardware, such that no driver software is needed on the host. By default it'd proxy all key presses/releases, but of course I want to do some interesting things, like record, replay, maybe swap keyboard maps, etc. I'll want a few buttons on this gizmo. And optionally maybe have a small LCD display to echo key sequences (with an assumed keyboard layout).
So obviously, I need to implement a USB host and a USB HID device. Even if this were feasible in an Arduino, the ATMega328's 2k of RAM seem a bit tight for the recording ability I'm interested in.
Is the Teensy (3.2) an adequate Microcontroller for this?
And what else will I need? I came across a page explaining how it can be paired with the Arduino USB host shield. Is the shield necessary, or can the Teensy (with whatever other needed hardware, e.g. USB-A jack and pulldown resistors) be programmed to handle this directly? As for the USB device interface, should I use the micro-USB port on the Teensy card for it, or add a new one?
Reading up on it, I realized that the trickiest thing for a USB device will be power management, and properly reporting needs to the USB host. Also, the page explaining the USB host shield points out that the power demand when plugging in the keyboard will cause the Teensy to reboot if I don't put a capacitor there. But if the device is plugged in to the computer before to the keyboard is plugged in to the device, it won't be able to properly estimate maximum power demand to the host, so I'm thinking maybe that reboot is a good thing, and then presumably the computer will see us as a new device and request power needs anew, which we should be able to report? Incidentally, what are the power needs of the Teensy card itself?
Note: I have no direct experience with Microcontroller programing, this would be my first such project. But I have some digital design experience (PALs, CPLDs, with VHDL) from back in the day, know the basics of how keyboards and keyboard drivers work (scan codes, clear codes, etc.), and I'm fluent in C.
Thanks in advance for your insights!
So obviously, I need to implement a USB host and a USB HID device. Even if this were feasible in an Arduino, the ATMega328's 2k of RAM seem a bit tight for the recording ability I'm interested in.
Is the Teensy (3.2) an adequate Microcontroller for this?
And what else will I need? I came across a page explaining how it can be paired with the Arduino USB host shield. Is the shield necessary, or can the Teensy (with whatever other needed hardware, e.g. USB-A jack and pulldown resistors) be programmed to handle this directly? As for the USB device interface, should I use the micro-USB port on the Teensy card for it, or add a new one?
Reading up on it, I realized that the trickiest thing for a USB device will be power management, and properly reporting needs to the USB host. Also, the page explaining the USB host shield points out that the power demand when plugging in the keyboard will cause the Teensy to reboot if I don't put a capacitor there. But if the device is plugged in to the computer before to the keyboard is plugged in to the device, it won't be able to properly estimate maximum power demand to the host, so I'm thinking maybe that reboot is a good thing, and then presumably the computer will see us as a new device and request power needs anew, which we should be able to report? Incidentally, what are the power needs of the Teensy card itself?
Note: I have no direct experience with Microcontroller programing, this would be my first such project. But I have some digital design experience (PALs, CPLDs, with VHDL) from back in the day, know the basics of how keyboards and keyboard drivers work (scan codes, clear codes, etc.), and I'm fluent in C.
Thanks in advance for your insights!