Posts

USB Host Shield in store.

Four configurations in Arduino blue

Four configurations in Arduino blue

[EDIT] This post is about legacy product which is no longer supported. Visit USB Host Shield project page for up-to-date information[/EDIT]

Arduino USB Host Shields are in the store. If you are not yet familiar with the project, please browse “USB Shield” category of the site and read the articles. In short, the purpose of this shield is to add USB Host interface capability to Arduino. The software libraries for this shield currently support control and bulk-in transfers, while bulk-out transfer is in the works. Access to GPIO pins of MAX3421E is also supported. Sketch examples, demonstrating USB device control queries and polling USB keyboard, are published. More code will be developed in the future.

At present, four configurations of the shield are available. The first one, called “Minimal”, contains USB core components only. It is compatible with 3.3V Arduinos, such as Arduino Pro from Sparkfun. Also, since no 5V is available, only communication with self-powered devices is possible. Moreover, not every self-powered device would work in this configuration. For unknown reasons, some external hard drives refused to answer until VBUS voltage was raised to 5V. On the other hand, all printers and digital cameras that I and several beta-testers tried worked fine as well as other people’s external hard drives. “Minimal” configuration is the best one for battery-powered projects since 3.3V Arduinos consume less electricity.

The second configuration is called “Simple” and works with Adruinos containing both 3.3V and 5V supplies, such as Duemilanove. In addition to USB core components it contains level translators to interface 3.3V and 5V parts. In this configuration, 3.3V is used to power USB core and receiving level translator, and 5V is used to supply Vbus and transmitting level translator. The “Simple” configuration is easy to understand and works with bus-powered and self-powered devices. It is most suitable for everyday use; if you don’t have special requirements, choose this one. I’m using this configuration in my development setup.

Other two configurations are somewhat advanced. The “5V only” one may be used with older 5V-only Arduinos. It contains level translators and 5V to 3.3V supply for MAX3421E. The “3 to 5” may be used with 3.3V Arduino and contains 3.3 to 5V converter to provide power to Vbus, LCD contrast bias and anything else up to 600ma. I don’t anticipate either of those two configurations to be very popular; “3 to 5” may become standard in the future, when Arduinos drop 5V support altogether.

I am hoping that my configurations are useful in many situations. If you think that some other configuration may be useful, please let me know. Also, if you have questions, please do not hesitate to ask.

Oleg.

37 comments to USB Host Shield in store.

  • Bert

    Hi Oleg,

    I’m a student doing a bluetooth based project, i’m quite new with all the hardwares so i have some silly questions for you. Do you think it might be possible for me to have your usb-shell connected to my bluetooth module so i can read in data from usb interface and send out data through bluetooth?

    • It is possible – the shield is compatible with any USB device, including USB Bluetooth ( I am assuming your Bluetooth module does have USB connector?). You would have to write all the code for Bluetooth support, but I guess this is among your project goals anyway.

      • Bert

        I am assuming your Bluetooth module does have USB connector?

        well, actually this is where my question lies. We are trying to find a USB interface for our bluetooth module…so i can read data from other devices through the USB shield and transmit them using bluetooth.

        • What is module name?

          • Bert

            i’m not sure yet, but i’m pretty sure that it will have serial port. another newbie question…is that the same thing as SPI?

          • FT232 from FTDI wll work as serial to USB device interface. However, in case of serial port it would be easier to skip USB Host altogether and communicate your module to Arduino via serial. SPI and serial are different interfaces.

  • Bert

    and… one quick question before i hit my sack…How do you burn the codes into your MAX3421E? Using any dev kits?

    • You don’t burn anything into MAX3421E. It is connected and controlled via SPI by means of reading/writing into various registers and code to do this runs on Arduino.

  • Richard

    If you plan to use USB Bluetooth, I would recommend the tiny USB dongles based on the CSR chipset. These are very low cost < $10 and the full documentation is available from CSR. Also already supported under linux, so some source available too. You might look at lwbt code and bluetooth specifications for HCI etc. Bluetooth is a challenge due to the addition of the bluetooth protocol layers on top of the USB layers.

    I did use the MAX3421E and succesfully enumerated and connected to the CSR dongle, then connected with a Wiimote using Bluetooth HID over HCI. The platform was a GHI uALFAT board and I wiped out their code, so got a fairly low cost MAX3421 development board with ARM processor.

    Stopped using the MAX3421 because of note on Maxim site "not to use for new designs", so future seemed uncertain. Now using AT32UC3B0256 which is
    more powerful than MAX for same price, but not as friendly as Arduino.

    I only just picked up on the USB Host Shield Project. Great work Oleg. I do like my Arduino, so will keep an eye on your progress and see if some of my AVR32 code for Wiimmote and PS3 controllers might be able to be transferred.

    • Richard – I would love to see your MAX3421E code!

      As far as availability of the part – it’s still in production. Maxim tends to announce end of life of their parts well in advance so I wouldn’t worry about it for now. I am also looking at Atmel OTG and may build a design this coming winter.

  • Richard

    Just a quick update on my progress with the USB Host shield. I got two PCB from Oleg at the begining of last week.
    No problems with the build. I added the LCD display. I found a tiny wireless keyboard for the Wii, which came with a USB
    dongle. Plugged it in and it worked fine with LCDkbd sketch.

    I wrote a sketch for the interface of the PS3 controller over USB. I have two controllers, one Sony and one Madcatz wireless with
    a USB dongle. Both of these work fine to the USB host shield. I only made one minor change to the library to increase the NAK
    count. The sketch tests all the function, buttons, joysticks, accelerometer/gyro, leds and rumble. This is not yet under bluetooth
    just USB. I can set the host bluetooth adddress on the controller though which is needed for bluetooth pairing.

    Did not make much attempt to reduce code or data size, so only have about 4K of program space and 240 bytes of data space left, but
    sketch is pretty long. The actual PS3 part is very small and could be made to a small library.

    Next is to move to the bluetooth part, from what I have found on the direct USB, I am pretty confident this will fit even on the
    168.

    Oleg, should I send you the sketch to maybe include in examples ?

  • Richard,

    It would be nice to see your sketch. Get a github login so I can add you to the list of collaborators for the project. As far as number NAK count – do you think it makes sense to have this parameter configurable?

    Oleg.

  • Richard

    USB_NAK_LIMIT is already provided for this. I find some devices very very slow to come back with descriptors and so exceed small NAK counts. We do poll pretty fast though. I had to change to an unsigned int in dispatchPkt function and then upped the value of USB_NAK_LIMIT to 32000. should probably look in more detail but his has worked for me before without problem.

    Will get github login, and send sketch anyway.

  • DeFex

    This is very interesting. Are USB-MIDI keyboards and other musical instrument supported?

    • I heard that someone has successfully interfaced MIDI keyboard to Arduino via the shield, but AFAIK no code has been published yet.

      • Thanks for the all the useful info on this site – I’ve learned a lot!

        I’m also trying to get the USB Host Shield working with USB-MIDI. I’m pretty sure all I need to do to acquire incoming MIDI messages is parse the contents of Control Transfer data packet – still unsure of how to implement such an action though. The relevant data seems to be sent as Bulk via a ‘Pipe’ from the device.

        Any pointers/tips would be much appreciated.
        Thanks again!

        • There is USB MIDI spec on usb.org – have you looked at it yet? Linux sources have plenty of information also.

          • I have looked at it and was confused by the multiple layers of terminology used. I’ll go back and attempt to understand it more.

            By experimenting with your shield, I learned much in such a short amount of time and I may have become a bit overeager/impatient to implement USB-MIDI 😉

          • Good news – I’m now able to retrieve MIDI data, via inTransfer, but the code seems to be restarting after each loop (running setup, indicated by printing “Start” to serial monitor)

            Is there any particular reason this would occur?

            Thanks again!

  • Schorsch

    Hello Oleg,

    very nice shield! One Question. I have a analog phone with a USB connection. It’s a FTDI FT232BL chip for the serial communication. So I can control the phone over the PC. It is possible to control the phone with your shield too?

    Schorsch

    • It shouldn’t be a problem once you figure out control protocol. While FTDI chip uses standard USB CDC class, the phone control is most likely proprietary. However, with a bit of reverse engineering I’m sure it can be done.

      • Schorsch

        Hello Oleg,

        that sounds good! How can I figure out the protocol? I dont know much about USB protocols. Maybe I can use the ftdi support to get these informations?!?

        • You can get CDC description on usb.org site. But that’s not enough – you also need to figure out the protocol of phone PC exchange. You’ll need a sniffer AKA protocol analyzer for USB or some other way to get the information; I doubt that phone manufacturer will be willing to share it with you.

  • Chris

    Hi,
    I have a noob question regarding this product. I am hoping to interface an IR receiver that outputs ASCII codes via USB to a Duemilanove. Does this shield have support for USB serial adapters?

    Cheers,

    Chris

    • Shield will work with serial USB adapters with not much difficulty, but you will need to write the code. Look at CDC specs at usb.org to see what’s involved.

  • albert

    Hi, Oleg. Great work!
    I’m very interested in learning Arduino and I would like to setup this as my “Hello World” project.

    If I want to get it work like at youtube video, which are the firmware I need to build? (be able to get data from PS3 controller and wiimote). Can you tell me how to get the complete project files?

    thanks again for such a great work!

  • ma70

    Will this work with WiFi dongles?

  • Jeremy

    Hi Oleg,

    This is great. Any tips on working with a USB GSM Modem? I’ve got a HUAWEI E160 and am familiar with the AT Commands I’ll need, but am having trouble using your code to send and receive commands. Do you know if anyone else has had success using this with a modem/phone?

    Cheers,
    Jeremy

  • Thomas

    Hi,
    Unfortunately I received a USB Host Schield rev1.21 version minimal instead a version simple.
    I would like to connect a device with 5V on VBUS, like a DSLR Camera.
    Can I change the minimal to a 5V version on VBUS and if yes which are the changes? Or where can I find the schematics with the different versions?
    I use a Arduino UNO

    Thanks for help