How to read USB Mass Storage with SparkFun USB Host Shield?

Hi,

In the product description of the SparkFun USB Host Shield it says “This means you could use your Arduino to interface with and control any USB slave device - thumbdrives, digital cameras, bluetooth dongles, and much more!.” I haven’t been able to find an arduino sketch that allows me to interface with usb thumbdrives. Is this actually possible? If not then you should change the description of the product.

Thank you,

Rose

Hi Rose.

Although the shield is capable of reading and writing to a USB drive, sadly we don’t have any example code for that. I can say that I’ve seen it done before and it does work.

Technically we don’t have ANY example code for the shield, but there is a [library for the shield that has some example code including a [sketch that works with a USB drive. This shield was developed at a time before SparkFun had hookup guides or example code and it seems we’ve never gone back and made a guide for it. You’re probably going to need to start with testusbhostFAT and modify that to suit your needs.

I haven’t tried the USB drive example, but I have tried the FTDI example and I can confirm that works like a charm. If you want to add the library through the library manager in Arduino, just search for “USB Host” and install “USB Host Shield Library 2.0 by Oleg Mazurov” and Arduino will add that and the examples to the IDE.

](USB_Host_Shield_2.0/examples/testusbhostFAT at master · felis/USB_Host_Shield_2.0 · GitHub)](GitHub - felis/USB_Host_Shield_2.0: Revision 2.0 of USB Host Library for Arduino.)

Hi Chris,

Sorry, I should have put more detail in my question. I have been using the Usb host shield v2 library for my project so far. I have the shield connected to a MIDI keyboard and it is working fine reading key presses. I was hoping to also be able to read usb drives from the shield for my project. Specifically I want to be able to read Midi files stored on the usb drive.

Thank you,

Rose

Rose, unfortunately we don’t have any example code for doing that. I wish I had more for you, but I have not been able to locate any code other than the example that comes with the library. You might try modifying that example to see if you’re able to adapt it for your needs.