I recently struggled through configuring an Arduino USB Host shield. In hindsight, it’s pretty simple but there was conflicting information I found and I’m not an expert with Arduino development. Below is the process I’d follow if I needed to do it all over again – this may save you some time if you’re in the same situation I was.
- Purchase the SparkFun USB Host Shield (and header pins if needed)- part number DEV-09947. Caution – there’s apparently an old version of the SparkFun shield, there are shields from other vendors, etc. If you do not have this exact product, then your setup may be different!
- Solder the pins onto the board. Be careful not to accidentally connect adjacent pins when soldering. I took a multimeter and checked for continuity between adjacent pins to help confirm the connections were good. There are 2 ground pins next to each other, so you should see a connection there, but not for any other adjacent pins.
- With the SparkFun board, it seems like you MUST supply external power on Vin or the barrel jack. 5V from the USB cable did not work for me.
- You must also run a jumper from pin D7 to RESET.
- The external power & jumper issues were the 2 biggest reasons I struggled with getting the board set up – these seem to be mandatory, at least for SparkFun DEV-09947
- The code/drivers you need to use for this board are on this GitHub page.
- I didn’t realize it at first, but there’s a diagnostic test which is extremely useful for checking whether your board is working correctly. Upload this sketch to your Arduino, then open the Serial Monitor to see the diagnostic info.
- Step 1 – you’ll see it recognize the board, and start a transfer test:
- Step 2 – you’ll see it attempt to test the GPIO pins – you’ll get a scary looking “GPIO test failed” message, but what I didn’t realize at first is that this can be ignored. Type something in box at the top of the Serial Monitor, then hit “Send” button and the diagnostic test will continue.
- Step 3 – you should see it cycle through a bunch of resets, then it will attempt to detect a USB device – make sure you have something plugged into the USB port on the shield. You should then see some summary info with a final message of “All tests passed”.
- Next problem I ran into – the light would not come on for the XBox wireless receiver when plugged into the shield, even though it lit up fine when plugged into my PC. This was a rookie mistake, but I needed the correct library/driver loaded in my sketch file. Once I did this, the device was recognized and everything worked great. So make sure you are referencing the correct driver (Bluetooth, PlayStation, XBox,etc) before uploading your Arduino sketch.
Now that I’ve got the shield & wireless receiver working, I’m wrapping up the last few details on my robotic tank. Follow me on Twitter to see the final result!