SparkFun will be closed Monday 7/4/2022 for the 4th of July holiday. Orders placed after 2 pm MT on Friday 7/1/2022 will be processed on Tuesday 7/6/2022. SparkFun Support will also resume on Tuesday 7/6/2022. Have a safe holiday!
A while ago our mechanical engineer Casey was surfing the 'net and came across these sweet looking belt buckles. It was about the time we were wrapping up the MP3 Development Board so naturally he thought "I bet we could put the MP3 player into that thing!" And so the quest began to port the necessary hardware from the MP3 Development board onto a PCB that could fit into one of these belt buckles.
The goal of the project was to make an MP3 player that would fit into a belt buckle, that would respond to movement, and that could play for at least an hour or two without needing to be recharged. We succeeded! Read on to find out how to make your very own Belt Buckle MP3 Player.
Here's a list of the main components we used to build the Belt Buckle:
The biggest concern was how to power the device. We needed something that was powerful enough to run 100mA for at least a couple hours, and it had to be rechargeable. The Lithium Ion Battery Packs that we normally use in projects were in too big/cumbersome of a package. Mounting this battery would have been extra challenging, and it would have made the unit too big to wear "fashionably."
After quite a bit of searching I came across a supplier for these Lithium Ion Rechargeable Coin Cell batteries. Perfect! A 200mAH battery can run the MP3 player for at least a couple hours, and it will recharge relatively quickly too.
Wow, that's a whole lot of stuff to be putting on a board that doesn't have a very large footrpint. We'll be alright though. You can view the schematic to see how we connected everything, or you can download the Eagle files to get a better view (and build one yourself!). Let's take a look at how the PCB layout was done.
The first thing I always decide before starting a layout is what shape I want the PCB to be in. In this case, we are constrained by the enclosure. The PCB must fit into a small slot on the back of the Belt Buckle. So to decide the dimensions of the PCB, I just measured the inset on the back of the Belt Buckle and found that the PCB needed to be 3.03" wide by 1.45" tall. Once I had these dimensions I just drew the dimension of the PCB in Eagle accordingly.
Now that we have the dimensions created, we can go on to component placement. Usually I just arrange the components in a manner that makes connecting the signals easiest. For this project though we had to make some special considerations. For one, I had to place components on both sides of the board. At SparkFun we don't usually do this because it's a headache for production to build the boards. But the PCB was too small to fit everything on one side.
I decided I wanted to put as many components on the front side as possible so that when looking at the Belt Buckle you see a pretty cool looking circuit board. I definitely wanted the LED on the front too, so that when we light it up, everyone can see!
With all this stuff on the front of the board, it meant I had to put the batteries on the back side. I also put the USB connector on the back side so that it would be accessible without having to take the PCB out of the Belt Buckle. The audio jack and the navigation switch also were placed on the back so that they'd be accessible while someone was wearing the belt buckle.
In the picture above you can see how I decided to place the components on the back side of the PCB. The Audio Jack is at the top of the board so the headphones can go straight up from the Belt Buckle to your ears. In order to allow the user to take the batteries out of the player, no components could go directly above the battery connector. We have to avoid the possibility of a collision between the battery and a component because the component could accidentally cause the battery to short (and I know this because I did it on the first version of this board; it burned several traces and left a good mark on my finger! Be careful). So I put the USB connector on the bottom of the board and the navigation switch way off to the side where neither component will interfere with the battery.
Notice how there are footprints for two batteries, but only one is populated? Why would I do that, you ask? Well, the truth is I didn't mean to. I didn't review my gerbers close enough before sending them off. Take a look at this screenshot of the layout.
Draw your attention to the big pink square in the upper right hand corner. The microSD socket is placed on the top side of the board. The battery is directly under it. See the green square connector on the battery footprint? This is the Vcc contact for the battery. Notice how if the battery holder gets soldered in, and then the microSD socket gets soldered on, the Vcc contact would be touching the socket? Well, this is troubling because the microSD shield is connected to ground. So we'd have a short from Vcc to ground with a 200mA battery. Bad, very bad! oops...oh well, luckily I caught this one before anyone got hurt.
Now that we've managed to squeeze everything onto the PCB and connected the ratsnest we can move onto the fun part, writing the code! Getting this thing to operate the way I wanted it to was actually a whole lot of fun.
I started by loading on the SparkFun LPC2148 USB Bootloader which you can learn about by reading this tutorial. The bootloader allows me to place a firmware file onto the SD card and the LPC2148 will automatically reprogram itself with the new code. It allows for much faster code development than having to program the board serially every time I want to test new code.
After the bootloader was loaded onto my board I could start writing the "real" code, or the code that would actually run the MP3 player. Before writing any code I had to decide how I wanted to the device to operate. Since there wasn't a screen, choosing a song was out of the question. So the first thing I decided was that the player would just have to play random songs; that's the easy part. I still need the player to be able to start/stop, change volume, and change songs. I have three buttons and an accelerometer to do this with. So here's what I decided: The up and down buttons on the navigation switch would change the volume, and the middle button is used to pause/play the current song. The only missing function is changing songs. Naturally, I decided to use the accelerometer to detect a change in motion. Or, in layman terms, to change the song the user just has to do a "hip thrust." That's right, get your groove on! I also added some fun stuff so that if the accelerometer detects that the user is dancing, the triple color LED starts flashing. Neato!
Implementing the code wasn't too difficult. I started with the sample code from the MP3 Development Board, and ripped out all of the stuff I didn't need. Then I just changed some of the controls and added the LED functions. Presto! A Belt Buckle MP3 Player is born.
I hope you've been able to take one or two things from this tutorial. If you decide to build your very own belt buckle feel free to use all of our sample code/downloads. And leave us a comment below if you have any questions/comments/suggestions.