USB:MP3 Shield

USB Shield

Preamble

I worked out that a USB Host shield was required, as the simplest and quickest solution, in order to use the Arduino with an XBox controller receiver, for robot remote control. Well, either for a Microsoft XBox controller receiver, or a PS2 – BlueTooth – dongle. Either one of the two would suffice.

The kit

There are different types of USB Host board.

Basic

The cheapest is USB Host ADK Shield Support Google Android F Arduino UNO MEGA Duemilanove 2560, for £6.14

USB Shield
USB Shield

Note that as of January 2017, there are some cheaper shields available, see the update at the bottom of the page.

From Arduino USB Host shield,

Arduino Library

The Arduino USB Host Shield can be used with the “USB Host Library for Arduino” hosted by Oleg Mazurov and Alexei Glushchenko from circuits@home, Kristian Lauszus and Andrew Kroll on GitHub (download).

The USB Host shield library already supports XBox and PS3 and PS4 controllers.

This shield is based on the MAX3421E. It seems to be the one to get: cheapest, most compatible, featured in a number of tutorials and videos, etc.

Basic SparkFun USB Shield

This USB shield, SparkFun USB Host Shield – SparkFun Electronics, has a bug in earlier models

This new version corrects the pin out for the GPX and RESET pins.

SparkFun USB Shield
SparkFun USB Shield

An aside about MP3 shields

Making a MP3, using EagleCAD from Cheap and Easy MP3 Shield for Arduino : Follow on … Again, no direct USB access though.

Play mp3 from usb flash drive – Arduino Forum mentions the vs1005 extensively, quoting the specifications. Points out how to read the D+ and D- lies by swapping a 1.5KΩ pull up on D+ for 2 15kΩ pull down resistors, on both D+ and D-.

Adafruit “Music Maker” MP3 Shield for Arduino w/3W Stereo Amp – v1.0 uses the VS1053.

Another MP3 player

The Music Player Shield for Arduino (MP3, SD card, USB host …

USB MP3 Shield (CECL08D)
USB MP3 Shield (CECL08D)

The music player shield is based on CECL08D. The CECL08D chip can be used to decode MP3/WAV format audio file. The music player shield has SD card socket and USB interface, supporting USB and SD card play. Just plug and play! Again only doing MP3 playback, and U-disk functionality only.

Extra features (MP3)

This shield has MP3 and amplifier and SD card reader, USB SD U-disk MP3 Shield 64Mbit Flash with Audio Amplifier for Arduino UNO R3, £11.91

USB:MP3 Shield
USB:MP3 Shield

The manual.  The library. The plan.

USB:MP3 Shield Plan
USB:MP3 Shield Plan

Evidently does not support hot swappable USB (is that a hardware or software (more likely) thing), from the library’s page Mp3Shield (github).

Warnings:
	1. SD card and USB-Disk must be plug in before Power On. The Arduino MP3 
		Shield don't surpport Hot-swappable.

USB Host Shield Library, For Connecting Other USB Devices, mentions hot plugging, see USB  Host Capacitance:

Without extra capacitance, hot plugging a USB device will reboot Teensy, due to a momentary drop in voltage.

There is an instructable guide, Arduino MP3 Shield – Instructables. This concentrates on the MP3 side of things though.

Here is a video review of the MP3 features of the board

Looking at the manual, you can only communicate to the board via the serial, to play and move mp3 files. The USB does not seem to be connected properly, only as a U-Disk (true?). That is to say that it can only be used to connect a USB stick or disk, and then those files are accessed via the software in order to play them – it can not be used as an actual USH host for the Arduino.

Speech Shield

Related to the MP3 shield is the Speech shield, see the youtube video Arduino Text to Speech – however, no USB functionality is included.

Update 2017

As of January 2017, there are cheaper USB host shields available, such as USB Host Shield for Arduino UNO MEGA 2560 Support Google Android ADK USB HUB, for £5.60. Or the USB Host Shield 2.0 Arduino UNO MEGA ADK Compatible Google Android ADK, for £5.37, or USB Host Shield V2.0 for Arduino ADK Compatible For Google for Android ADK, £5.35.

Also, there are other options, which are not shields per se. Such as the USB Host Shield 2.0 Arduino UNO MEGA ADK Compatible Google Android ADK, for £4.86, which, like the usual format shields, operate via the SPI interface:

 

See also Projects – USB Host Shield

Using this scaled down version, one would not be constrained by which pin to use to select the USB, although, the library will require modification, see Change select pin of USB Host library. See also the USB Host Shield Hardware Manual, which confirms this in the Interface modifications section.

Library Modification to change the select pin

The modification required is in the USBCore.h header file, line 43:

typedef MAX3421e MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo, Due etc.), Intel Edison, Intel Galileo 2 or Teensy 2.0 and 3.x

So to use pin 5, for example, en lieu of pin 10, the line would become:

typedef MAX3421e MAX3421E; // Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo, Due etc.), Intel Edison, Intel Galileo 2 or Teensy 2.0 and 3.x

The clue was in the comment on line 27 in UsbCore.h

/* shield pins. First parameter - SS pin, second parameter - INT pin */

With this suggested modification to the code, Pin 5 would go to the USB Host SS line and then there would be no conflict with the Ethernet board that uses Pin 10 for its SS line.

Explanation

On the standard format shields, the interface, i.e. the USB host library uses pin 10 to select the MAX3421E –  from Arduino USB Host shield,

Arduino communicates with the MAX3421E using the SPI bus (through the ICSP header). This is on digital pins 10, 11, 12, and 13 on the Uno and pins 10, 50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the MAX3421E. Pins 7, 8 and 9 are used for GPX, INT and RES pins.

Now this could cause incompatibility with some SD shields, which may be wired to use pin 10 to select the SD card reader – from Some things to keep in mind when using the SD Library:

The communication between the microcontroller and the SD card uses SPI, which takes place on digital pins 11, 12, and 13 (on most Arduino boards) or 50, 51, and 52 (Arduino Mega). Additionally, another pin must be used to select the SD card. This can be the hardware SS pin – pin 10 (on most Arduino boards) or pin 53 (on the Mega) – or another pin specified in the call to SD.begin(). Note that even if you don’t use the hardware SS pin, it must be left as an output or the SD library won’t work. Different boards use different pins for this functionality, so be sure you’ve selected the correct pin in SD.begin().

and very likely with the Ethernet shields, which uses pin 10 to select the W5500 (i.e. the Ethernet port) – from Arduino Ethernet Shield V2

Arduino communicates with both the W5500 and SD card using the SPI bus (through the ICSP header). This is on digital pins 10, 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used to select the W5500 and pin 4 for the SD card. These pins cannot be used for general I/O. On the Mega, the hardware SS pin, 53, is not used to select either the W5500 or the SD card, but it must be kept as an output or the SPI interface won’t work.

Note that because the W5500 and SD card share the SPI bus, only one at a time can be active. If you are using both peripherals in your program, this should be taken care of by the corresponding libraries. If you’re not using one of the peripherals in your program, however, you’ll need to explicitly deselect it. To do this with the SD card, set pin 4 as an output and write a high to it. For the W5500, set digital pin 10 as a high output.

Mini USB Host board pin out

uhm11_manual

All in one Arduino and USB MAX3421ee board

Alternate USB host board using Microchip 24FJ64GB002

See USB Host Mini

Mini USB Host
Mini USB Host
Advertisements

6 thoughts on “USB Shield”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s