Microcontroller as USB host and device

I have read plenty of articles on using ATTiny and similar micro controllers as a USB device (many phantom CapsLockers, etc). I want to make one that can read keyboard input and then pass on keyboard input (some changed and some unchanged) to the computer. Do you have any recommendations for microcontrollers that can do this (hardware or with firmware) easily? I'd prefer something: cheap, small, and preferably Atmega or similarly popular in the open source hardware community.

Connect a USB host chip and a USnooBie USnooBie , which is actually just the ATmega328P that you are used to, and using mostly the same code as the ATtiny projects you've already seen.

I don't know of any cheap, popular, easy-to-use USB host solutions. The closest I think I've seen is the FTDI vinculum2, which is cheap (one out of three?) It's also pretty weird.

For your particular application, you might be able to get away with talking PS/2 protocols to the keyboard, and USB device to the PC. Many USB keyboards are still capable of working on a PS/2 plug as well (with only some wire re-routing), and a microcontroller can pretty easily implement the host side of PS/2...

this looks like it'll do the job

http://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini/

The fez Domino has usb host and device capabilities and plenty of example code to set you on track
http://www.ghielectronics.com/catalog/product/133 @60 dollars its not too bad ,

or if your able to, you can just get their Nxp chip pre loaded with .netmf and build your own board for a lot less.
http://www.ghielectronics.com/catalog/product/116

oh thank heaven for open source

eddiea6987:
The fez Domino has usb host and device capabilities and plenty of example code to set you on track
http://www.ghielectronics.com/catalog/product/133 @60 dollars its not too bad ,

or if your able to, you can just get their Nxp chip pre loaded with .netmf and build your own board for a lot less.
http://www.ghielectronics.com/catalog/product/116

oh thank heaven for open source

Watch out, I think that chip, LPC2388, only has one USB OTG, I don't think you can handle both host and device at the same time. It is capable of both but only one at a time.

frank26080115:
this looks like it'll do the job

http://www.circuitsathome.com/products-page/arduino-shields/usb-host-shield-for-arduino-pro-mini/

Sweet! Thanks - now I have a cool new shield / microchip to buy and a cool site to read! This definitely looks like it will do it. I had actually planned on doing this project with USnooBie before you posted here, but may drop this on my Arduino mini to prototype and then convert over to a dedicated board to combine both things. We'll see what shakes out. I'm still definitely getting a USnooBie at some point very soon.

eddiea6987:
The fez Domino has usb host and device capabilities and plenty of example code to set you on track
http://www.ghielectronics.com/catalog/product/133 @60 dollars its not too bad ,

$60 - too high

eddiea6987:
or if your able to, you can just get their Nxp chip pre loaded with .netmf and build your own board for a lot less.
http://www.ghielectronics.com/catalog/product/116

Thanks for the tip. Unfortunately I'm not interested in .net at all.

eddiea6987:
oh thank heaven for open source

Now that we agree on!

Frank, I haven't used SPI yet (even with arduino) and didn't see any SPI examples with USnooBie. So, how hard would it be to interface your USnooBie with the USB host shield sold at circuitsathome? Seems like it should work. It's just five pins. Thoughts?

it's just an ATmega328P, it should be directly compatible with whatever library you throw at it as long as it doesn't occupy the USB D+ and D- pins.

Read http://www.circuitsathome.com/usb-host-shield-hardware-manual and also the schematic http://www.circuitsathome.com/chome_downloads/UHS_mini_10.pdf

Read Using USnooBie with Arduino , pay special attention to pin mapping

The SPI signals are obvious

As the webpage said, INT goes to pin 9 (meaning PB1)

Now you should be able to figure out how to wire it all up. The MAX_RST signal can go to any unused pin on the ATmega328P, I suggest you perform a reset of the MAX3421 upon resetting the ATmega328P just because it'll ensure that your firmware starts from a fresh state every time.

Set USnooBie to run at 3.3V using the jumper

The 5V pin from USnooBie is still available and you need to connect that to "RAW" on the USB host shield. Also read their site where it says

Mini shield lacks flexibility of its full size brother; however, here is one simple way to get 5V to VBUS using Arduino Pro Mini’s 3.3V on-board LDO. Power the board with 5V on RAW pin, cut the trace inside VBUS jumper, provide 5V from RAW to VBUS and get 3.3V from Arduino to the shield in the usual manner via 3.3V pin. While making this mod be extra careful and don’t short VBUS pad to USB connector shield. Also, this mod is easier to make when Arduino board is placed beneath the shield. Picture on the left shows necessary wiring.

You could just use a Teensy / other AtmegaXU2 dev board or an arduino uno with a usb host shield. They can all enumerate as USB HID with the proper firmware. If you want a one chip solution, the At90USB1287 supports host and device, but im not sure if it can do both simultaneously. Any of the devices listed here will work with LUFA as a usb device and a host shield for usb host: http://www.fourwalledcubicle.com/files/LUFA/Doc/091122/html/page_devicesupport.html

Good luck!

eddiea6987:
The fez Domino has usb host and device capabilities and plenty of example code to set you on track
http://www.ghielectronics.com/catalog/product/133 @60 dollars its not too bad ,

or if your able to, you can just get their Nxp chip pre loaded with .netmf and build your own board for a lot less.
http://www.ghielectronics.com/catalog/product/116

oh thank heaven for open source

I could not find any example code there - I think this might be spam