IAN LANG ELECTRONICS
Now here's a thing- when I started this last year I was doing it using Seeed V2, Windows Vista and Arduino 1.0.5
Someting has changed because when I came back to it in March on a machine running Windows 8, I downloaded the libraries on to it and a later version of the IDE.
Some of this does not work on that machine.
I went back to the old machine and guess what? Everything works fine. So, bear with me whilst I find out what's happened this time.
I just bet it's Windows-bloody 8 again.
If you are using Arduino 1 IDE then the SPI and SD libraries you need come bundled with it, so no need to worry about those. If not, why not???? Off you go and get it!
Now, follow the instructions on the Seeed page where you download the library but when it comes to copying the unzipped folder to the libraries, you'll find it's called Music_Shield_master. Copy it into the libraries folder of your Arduino IDE and rename it MusicPlayer to match the files inside. This is a peculiarity of github downloads and we always have to do something similar with downloaded zips.
Once it's copied and renamed, open your Arduino IDE.
Let's start at the beginning here because here at Lang Towers we are well aware that not all of our readers live in the United Kingdom and so to avoid confusion we'll start with the question "what is a Maplin?"
In the UK Maplin are a chain of shops that sell electronic bits. If you live in America, it's a bit like Radio Shack. In Germany , Conrad. They sell a lot of things from resistors to semiconductors, and just
recently a man called Steve at Maplin has dramatically increased the range of bits that can be hooked in to an Arduino, so a round of applause for him. One of them is the thing you see on the left, which is a shield that plays MP3, WAV, MIDI, and Ogg files. It also does recordings, but only on the Mega and that makes it an expensive build.
You'll need a micro SD card that's not bigger than 2GB which is a bit annoying as most of the big chains, Maplin included, start at 4GB, so here's my tip.
Trot on down to a mobile phone shop where they have proper technicians who fix and repair phones. Being proper technicians, they always have a vast array of junk squirelled about the place that might come in handy one day. Being shopkeepers, they'll sell it to you. I got a 1GB and a 2GB card (they don't put less than 4GB in a phone any more) for the princely sum of £3. Nice. 1GB went in the Maplin Shield and the 2GB went in my tablet.
Now chuck some MP3s on the card and let's get on with making it work. Cup of tea, anybody?
On the right is a cuppa and some of Mr Player's finest nicotine delivery systems because here comes a story before we get to the nitty-gritty.
This shield costs £25 and when you get it to work it's worth every penny. I'm hearing bits to the music I never even knew were there before in crystal clarity even at loud volumes. I'm well pleased with it. I wasn't at first though. Why? I'll tell you.
When you open the packet, you get a little booklet with it. This book tells you to download certain libraries to work it. Trust me on this: DON'T!!!!
The lbraries it tells you to download just plain don't work.
Now, I mentioned this to a man called Simon at Maplin on
Wednesday lunchtime. By Thursday teatime he'd found a fix, which impresses me greatly and puts Simon at the top of the list of people who will not be stood up against the wall and shot when I lead my glorious revolution to power. The reasoning is like this: The architecture is much the same as the Seeed shield, and so the Seeed version 2 libraries should work it. They do too. Brilliantly. Maplin tell me they're in the process of getting this sorted out with their suppliers, but until then you can get the Seeed libraries here:
As well as the Maplin shield, this should work for the Seeed V2 just as well. It won't work for the Sparkfun shield- If I get my grubby paws on one of those I'll write another article for it.
Hopefully you are seeing something like the above and the bit shaded in red is what we want. Bring the example 'createList' into your IDE and, making sure a. there's some MP3 files on your SD card, b. the SD card is in the shield, c. your Arduino is hooked up to your computer, and d. you have chosen the right kind of board and the right com port, upload it.
Don't laugh- I managed to get all four of those wrong at various points......... :P
Open your serial monitor and you'll see something like this and hear a track playing:
That's a list of the files on your SD card- it only shows the first few characters and the file extension.
Twiddle the volume buttons and it should go down and up. Push the lever to the sides and it will change tracks. You'll notice that the tracks are in random order. That's because of this line here:
and over the page we'll look at that and the rest in more detail. The last thing we are going to do on this page is push the lever straight down. It should pause. Push it down again to resume play from where it left off. Everything working? Spiffing. Over the page we go to look at this code and write some new stuff.