6

I am making an interface project that, when plugged into a computer, shows up as both usb flash storage and can type like a keyboard when some physical buttons on the board are pressed.

I have seen projects that do one or the other, but not both at the same time.

I have gotten it to work using a usb hub and two chips that are sharing the same storage (since I want the hot-key buttons to type out information stored in the flash drive side as well), with one acting like a HID and one acting as usb storage, but this has a few problems. First, it feels redundant. Second it's difficult to program since every time I plug the mess in it randomly assigns a name to each chip with no easy way of telling which to send the HID code to and with to send the USB Drive code to. I have to plug them in one at a time which wont work once this project is all on the same board. The last problem is the buttons work inconsistently since, im assuming, the two chips are not doing a nice job of sharing access to the text file it's trying to read for the text to 'type out' on the computer.

Is there a nicer way of doing this that uses one arduino acting in both roles accessing the one flash storage? Thanks!

2

The Leonardo can easily be used as a keyboard. There are also special codes to turn the USB-to-Serial chip on newe Unos into a keyboard (see here)

USB mass storage is another game all together. The Brondani EasyUSB is a simple chip that exposes 2MB of storage space on both the USB and microcontroller. They say they will be releasing larger capacities.

The easyUSB also has a serial link built into it from uC to computer.

If you really want, you can make your own USB stack to handle this on you own, but the pitifully small amount of ram on these chips would prohibit it.

1

You're looking to create a USB composite device. I don't see any examples within the arduino community, but I don't see a reason why you couldn't use the 16u2 as a composite device, it'll just require more effort than you'd normally put into an arduino project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.