so for testing, i need a dip board,how do i solder smd to it, if smd needs a machine to solder?

is there another word for dip board, because its not bringing up anything in the uk.

The 5 volt circuit i built before, could i use that one instead? Cos these regulators are playing hard to find

Also I’m going to buy my sd card breakout board from spark fun, and the dip breakout board for the mp3 decoder from sparkfun, but \i wasnt sure which dip breakout board to go for because there is more than one type?

The MP3 decoder chips you’re looking at come in a 48-pin QFP (quad-flat-package) chip, and SparkFun doesn’t sell any QFP breakout boards. Aside from that, I wouldn’t recommend you buy a bare chip and a breakout board right now. SMD soldering is a whole different ballgame. You can do a lot with a good soldering iron but it is difficult to do correctly, and very easy to damage the parts you’re soldering. What I meant is that I think you should look for an mp3 decoder chip that you can buy already soldered to a breakout board, and it would be useful if that breakout board had two parallel rows of pins (DIP=Dual Inline Package) so you could plop it right into your breadboard. I’m not sure if such a board exists.

And no, you should not use your 5V regulator. This chip really needs two separate power supplies of 2.5V and 3.3V to function properly, and anything more than that can damage it. One nice thing though, your ATMega168 chip can run off of the 3.3V power line.


Yeah I notice you say mega168, the orangutan runs off mega8, I have a mega168 in my breadboard, primed for programming, and the mp3 player circuit uses a mega8. I also want when I have built the mp3 player on a breadboard to try modifying the code to play certain tracks when sensors pick up certain things. Now with your extensive, and fantastic teachings I think i can do that now, but want to know if you reckon the mp3 player could run off a mega168 without me having to tweak too much, else i need to by another chip.

Thats annoying about the mp3 decoder, why cant we stick to an electronics equivelent of SI units, and everyone does the same - Oh your American arent you? I dont know with you but over here and europe we all use the same units for engineering…

If each leg of the surface mount lands on a strip of copper on that perf board you sent me a link to, can i not just solder each leg to that stuff carefully and make my own dip board?


P.S Have you seen those voltage regs on rapid?

I don’t think you will need to buy another ATMega8 chip, you’ll just need to make slight changes to the names of some of the registers in your ATMega8 code to get it to compile to run on your ATMega168 chip. You’ll see, when you try to compile your ATMega8 code for an ATMega168 microcontroller you’ll get a couple of errors, they’ll all be register names that just need a little change. If you’re only using things like the I/O pins you might not need to make any changes at all.

As to soldering one of these chips to a board, these chips are very small, difficult to solder by hand, and certainly too small to solder to a standard 0.1" spaced perfboard. Here’s a place that sells the various MP3 decoder chips and breakout boards. The VS1003B is out of stock right now, but the board will work with the VS1002D, which they do have in stock (and might be similar enough, you might want to check with the guy who made that schematic. This isn’t a generic DIP (they call it DIL for Dual In Line) adapter board, it’s specifically made for these mp3 chips so it connects the multiple power and ground pins to each other and doesn’t bring out the unused pins, AND they will even solder the chip to a board for you! You’ll want the QFP48-DIL36 adapter board, this one:

That square shape in the middle is the footprint of the mp3 chip, and the row of holes along the top and bottom edges has the same spacing as your breadboard. That’s how small the chip is, so it’s not easy to solder it without connecting neighboring pins together.

Electronics components mostly use one of a few kinds of standard packages, so it’s not too bad once you’re familiar with most of them.


cool, will reply when all arrives

hey nexisnet, some parts have arrived, and just been having a look.

The 2.5 volt reg looks exactly the same as the 5v one i bought a while back, but the 3.3 volt reg is tiny, and has two and a half legs?


I’ve removed all the other photos and replace the first with a pic of the reg next to its part number from maplin, has it broken off or something? its tiny.

can i solder small jumper wires to each leg so that it can be pushed into a breadboard. theres no datasheet with it?

Everything else has arrived now, and I have built the power supply, except for that 2.5 volt reg. Looking at the schematic, to the left and right of the mega8 are two vcc’s that go to ground with a cap in the middle, and it says next to each of them, connect as close to pin as you can.

where are they on the mega8?

One last thing, from the power supply, wehere the circuit says VCC, IOVDD CVDD and AVDD, are these where the power comes out of?

Sorry to disappear for a bit, I spent last week at a robotics conference (had a great time and won a prize too!).

I think this is the datasheet for your regulator with the missing leg. That’s what the package is supposed to look like, it’s meant to be soldered flat to a board with the large back pad as the missing pin, and yes, you can just solder to the legs/stump.

The pins on your schematic that want to be connected to VCC (i.e. positive 3.3V power) that have capacitors between them and ground are the VCC pin (pin 7 on the PDIP package) and the AVCC pin (pin 20 on the PDIP package). The numbers on the schematic correspond to the pin order on the PDIP ATMega8 chip. The pin orders of the different packages are shown in the data sheet, like this (again, you have the PDIP chip):

The various labels like VCC and IOVDD just mean they want to be connected to each other, but drawing out the lines would complicate the diagram (all the VCC’s together, all the IOVDD’s together etc…). The voltage regulators output the power, and the other devices use it.


Well done, what did you do to win the prize? what did you win?

I have it all up and running now, my breadboard is looking quite proffesional. I made a little programming board with a piece of perf board so that i could plug the programmer into the chip without pushing jumpers into the hear (see photos)


Now i have to wait for the vs1002 to arrive and the sd card holder, then i can try my new mp3 player! Can be annoying living in england when the best websites for parts are in America…

I programmed the chip to just turn the two lights on, which worked so all seems good.

The only problem i was having was getting a button press to turn the lights on, I;m sure my little piece of code was correct.

Any how it looks like this now because buttons werent working.

#include <avr/io.h>
int main( void )
		DDRC |= (1<< PC5);
DDRB |= (1<< PB1);

PORTC |= (1<< PC5);
PORTB |= (1<< PB1);

  } return 1;


simple, but tells me everythings good.

Looks great! I love how your breadboard is growing new modules.


P.S. Hope your stuff comes soon, but I don’t know if anything could be as frustrating as living in Norway, where the AVR chip was invented, and where Atmel bases its AVR R&D, but has no local product distribution.

P.P.S. My lab won the “Best Video” award for this robot.

That robot is sooo cool, is that what you do - build cool robots for a living, hmmm maybe i should edge my mech eng in that direction…

Its quite neat i think, the way you can just add breadboard to bread board, if it gets too small. I had the electronics exam today for mech eng, but have been spending too much time worrying about this project, and dont think it went too well. AC current is way to boring, although i do like complex numbers…

anyway i;m going to read your other thread now.

In my car for my ipod i have a little bluetooth thing that plugs into the headphone jack, and bluetooths the music to the radio. If i wanted to build this function into my mp3 player, what bluetooth module would i buy? Is there something that needs no programming, just connect up and go?

Also, I remember you mentioned the mega168 has an interupt port. If I change my code so that the buttons are on interupt ports will it be quicker? what would need to be changed?


The schematic I;m following, has different names for the ports on its SD card breakout board to the ones on my breakout board.

I have:

It has: (the part after the - is where they are to be conected)

So I have connected mine up as follows


The other ones I couldnt find a common meaning for. Do you know where they should go?



Sorry, I don’t have a clue about what the named connections should be beyond what you’ve figured out yourself, I haven’t played with one of these chips before.

What specific radio transmitter do you have? Is it actually bluetooth, or just an FM transmitter? Does it have it’s own battery or does it draw power from, say, extra plugs on the top of an I-Pod?

Basically anything that is meant to just plug into a headphone jack and does the rest itself should work with your homemade mp3 player.


Hi again, how are you? long time i know, had to wait for some sparkfun parts to arrive, but finally they got here and now i can here a slowed down but recognisable bob marley off my bread board…
(need to sort that - could it be because i switched the mega8 from the schematic for a 168)

Everything is going to plan…

Below is a piece of code from the source code, that when a button is pressed it plays the next song,l which it determines from the songs index number - the order of which the songs are put on to the sd card.

from the code we have been discussing for a while, we (me with alot of your help!) got it so that when a number on the roulette wheel was chosen with the sliding pot, it would appear on the screen, I want it to also say that number now that i can… I have recorded all the numbers - 0 to 36, and have put them on the sd card in order, so that their index numbers will correspond to their actual number.

Using the information from the piece of code below can we adjust it so that it plays the index correct number when a number is chosen?

else if(!(PIND&NEXT)) //ÏÂÒ»Ê×						next songs
							if(songs > totalsongs)songs=1;
							//	Delay(0xffff);
								goto next;

My plan is to remove all mp3 player functions from the code and just have it as a number sayer…

Very cool, glad you got your player up and working (and nice way to tie your two projects together too).

I’m not entirely sure how the code you’re showing below works, but if you can jump to a song by it’s number then you’re all set. If you have to scroll forwards and backwards through the songs you could keep an index of what song you’re at right now (looks like you’ve already got a variable called ‘songs’) and when you select a roulette number you could call a for loop that quickly scrolls through n songs, where n is the difference between the roulette wheel number and the current song index.

Anyway, I hope that made sense. If not, could you post your whole source code?


Thanks Adam for your help on this, by the way i looked at your personal website, where were you when you were walking on ice! I also noticed you studied mechanical engineering, thats what i;m doing but my course has very little to do with microcontrollers - did you specialise later towards robotics? It becomes harder work to teach yourself another topic when the course does not cover it!

Back to work, I have placed a download link for the entire project writeen by someone on avrfreaks. Its a rar. If your not happy downloading it i’ll post it here, but its huge!


If you look inside the main code window, there is a function called play music. I want to remove all the volume up previous, next volume down etc, and just have it so that when a number is chosen on the “roulette wheel” it plays the equivelent mp3 (i have the mp3’s on the sd card numbers 0 - 36) but as i mentioned before, the variable songs relates to their index number not their name…

last thing, in the zip is the code that runs the mp3 decoder vs1003, mine is vs1002. Do you think something here could be the reason why it plays the mp3’s slow (which it does, dont remember if i mentioned that) or is i because the microcontroller is not running at full speed?

Thanks for you help


Woah, yeah, good idea not posting the entire text of the code here. If the functions do what they sound like they do, you should be able to fold your roulette code into this one, and call something like SetTrack(single_zero_wheel[pot_idx]), then call PlayMusic(). I think this will play the correct track, but it will then start playing other tracks as well. You could change the line:
#define DEFAULT_MODE 0
#define DEFAULT_MODE 1
Which should make the player repeat one track over and over again, which is not quite what you want (or is it?).

It looks like you would need to edit the PlayMusic function to get it to play a track only once. It looks like you should just be able to remove the line “goto next;” from near the end of the function, but without the hardware to test it on myself I can’t say any of this for sure. Alternatively you could just add really long pauses to the end of your MP3 files.

Since the chip directly reads the files form the SD card and plays the MP3’s I don’t see how anything you’re doing from your microcontroller could make it play slowly. My guesses would be that the chip either disagrees with the formatting of your mp3 files somehow, or that it’s own clock is slower than it expects (scratch that, you got a prefab board from SparkFun, you might want to ask about it there). Those are just guesses though.

The mechanical engineering programs I went through were very focused on theory rather than practical implementation (I think a mix of both would have been much better). I had one required “electromechanical systems” course, which focused almost entirely on the physical makeup of different semiconductor devices (the differently doped layers of silicon in transistors for example), and we did some very basic analog circuit design. I think we had one lab where we got to type up (copied directly from a handout) a simple LED flashing PIC program and download it into a chip, with little explanation of what we were doing or how it worked.

You’re absolutely right that it’s hard to teach yourself, especially when you have other courses to keep up with, and robotics is hard to get into as an undergraduate. For me it was primarily a problem of motivation (vs the immediate gratification of going out to movies than staying up playing Super Smash Brothers all night). One thing that really helped me was taking some excellent elective classes in programming general robotics, especially ones that were more lab-focused with semester-long group projects. The group and your grade in the class are good motivation, plus when you’re doing it for your own knowledge and course credit you feel like your getting double back (also, you can generally take graduate courses as undergraduate electives if you ask). I also totally lucked out my sophomore year and landed a student job in a robotics research lab. There were lots of electronics and software guys working there already, but no one working on the student projects knew how to use a decent CAD program. My high school required a semester of manual drafting (probably a holdover from when it was more of a trade school) and a semester of CAD modeling, so I got to participate in a bunch of different projects and learn all about them along the way.

Another thing you might think about is joining a robotics club, either through a school or your region. I never had the time (between extra classes and research projects), but from everyone I know who’s been in one says it was a great experience and source of information and resources, not to mention the most important part (to me anyway), the motivation.

That was right by my high school (the oddly shaped brown building in the background) in lower Manhattan in January 2000. Right here actually. That close to the ocean the Hudson river is salt-water, so it very rarely freezes over, but freshwater from snow falling on the river tends to form these little icebergs that get stuck in little harbors between piers. The bergs are small and moving in waves, the spaces between are just floating slush, and every year or two someone doing exactly what I did falls between pieces of ice and drowns (which I did not know at the time). Actually in two of the pictures I’m slowly standing up after falling on my back, miraculously right smack in the middle of a very large piece of ice. I think that was when we all stopped walking out on them. I like keeping the pictures around because they document what is, in perfect hindsight, probably the stupidest single thing I have ever done in my life. I don’t exactly regret it, but I certainly wouldn’t do it again. It’s more of a note to self: by the grace of God you got away with this, so don’t push your luck.


1 Like

Cheers Adam (thats quite an english word!) that was all very informative, I’ll see in third year when i get to pick my own modules, whether there is a robotics based module… that would help.

I’m at work now, but when i get back i’ll try what you said, and post some results. Yeah the slow thing is irratating, because i;m sooo close! I emailed the guy who wrote it, and he said that it was because i was using the vs1002 rather than the vs1003. I cant find anywhere in the code somehting that specifically relates to the vs12003, but he emailed me a similar version of the project he said would work, but it doesnt even play the track in slow, let alone fast. Hopefully i’ll sort it, its a stupid place to get caught up at.

I have asked the spark fun forum if they have any explanation of why its playing slowly, but it takes AGES there to get a reply!!!
On the spark fun site of the vs1002 sparkfun.com/commerce/produc … cts_id=519 they have some configuration code. Could this explain why mine is running slowly - because i havent configured it?
Will keep you updated


I have looked at the datasheets for both vs1002 and vs1003 to see if there was anything different to cause it to play slow, the only major difference seems to be that the vs1002 only plays mp3 files…

Is there a test i can do that you know of to find out how much slower it is being played - could i double the mega168 procesor speed so that it plays faster, or is that not possible - can i change the speed of the vs1002 to make it player faster? I looked through the code, but it doesnt look like anywhere anything is being told to play at a speed? could it be my wiring of the breakout board. I have left a few contacts unconnected because according to the sparkfun breakout board schematic they have alreay been earthed or whatever they are supposed to do.

the only thing i wondered was whether the TX and RX are supposed to be connected to anything…

If you get a minute please can you see if you see anything majorly different between the datasheets:


Thanks Adam


Had another look at the vs1002 datasheet. I am not using the MICP, MICN, TX, RX, GPIO0, GPIO1, GPIO2, GPIO3. all of which say use a pull up/down resistor if not used. I have not done that. What are pull up/down resistors and how do i calculate whether i need them and if this is the problem. Could it be the problem?

thanks again

ANOTHER EDIT: The guy who wrote the mp3 player has just pointed out that the clock registers are not the same - found in the vs1003.h header file. How will that effect my thing, and what do i have to change. Sorry ifthis is an open question…

Bingo! I think…

In the VS1003B.h file, there are these two lines:

#define CLOCK_REG 0xc000 //0xc00 is fow VS1003 or higher version
//#define CLOCK_REG 0x9800 //0x9800 is for VS1011 VS1002

Try commenting out the first, and un-commenting the second, like so:

//#define CLOCK_REG 0xc000 //0xc00 is fow VS1003 or higher version
#define CLOCK_REG 0x9800 //0x9800 is for VS1011 VS1002

Does that take care of it?


Perfect, that worked… Thank you.

Do you ever get a message where cant program because short circuit on miso line?
i keep getting it, fiddling around a bit and it works again…

Now i need to join the two programs and see if that works…

For the timer on the mega 8 we used the lines

TCNT0=~(124);//preload counter to overflow after 1 ms (125 counts)
TIMSK=(1<<TOIE0);//enable interrupt on timer0 overflow
TCCR0=(1<<CS01)|(1<<CS00);//set timer to normal mode with CPU clock/64 (125 kHz)

this causes an error - i think because its not the mega 8 but the 168. What do i need to change these to for the mega168?

Lastly, sorry, what is the analogue to digital pin for the 168?

I think then i am good to go and try the rest out myself.