DIY Music Hat

Quite often, you will find yourself wanting to listen to music. Whether you are in your room or working, you might find yourself reaching for some earbuds. While they certainly work great, they also come with their fair share of problems. My cheap pair of earbuds lost their protection and really don’t sound that great. They also very easily get tangled. You might also prefer speakers because they can be more comfortable, louder, and have better sound quality, but they are not nearly as portable as earbuds.

But what if I told you that you don’t have to choose a side and get the benefits of both. By simply attaching a pair of speakers to a hat, you can bring your music with you. There already exist hats like this online, but I thought that this was the perfect opportunity to put this hat and these tiny speakers to work. So, without anymore waiting, let’s get started.

Before we get to use the hat, let’s work out how we will actually play music. While we could simply just directly connect an audio jack to a speaker and play music directly, it is not loud at all, and is quite frankly, hard to hear. In other words, this level of volume is only suited for earbuds. As we can see, the peak2peak voltage is only a few mV.

So, we will need an amplifier to make the music audible to be heard not only by the one wearing it, but also the people nearby, if so desired. While I do have several options for creating said amplifier, the best option, it seems, is the extremely well known and widely used LM386. This ic is a low power audio amplifier meant for battery powered applications. The reason why this IC is ideal for a project like this is because of its low power, meaning that it is perfect for these small speakers and battery powered applications. It also has a very small external part count, which is great because we are limitied on space in the hat. Finally, it has a wide operating voltage, so we can use a wide variety of options to power it as necessary.

Before, making the circuit on the breadboard, I had to select how I would power the amplifier. There are several ways to do this, ranging from a lipo battery to a really long DC power jack? Ultimately, I settled on using this 9 volt battery, because of its reasonable size and the fact that it is already of a considerable voltage. I would have to design an entire circuit around the lipo battery to boost the voltage and also protect it from overdischarge.

And so, I pulled out my breadboard so I could quickly prototype a circuit. Luckily, the datasheet has several examples that we can examine and modify. Starting with the basic circuit, we can hear that the audio coming out certainly is louder, but the quality really is not that great. The first thing to add would be the bypass capacitor on pin 7, and it really helps with audio quality. Also, don’t forget to add a decoupling capacitor between ground and the voltage source, or else it sounds like complete garbage. I also left the gain at the default 20 to reduce part and avoid the distortion that comes with the higher levels of gain. And after playing a song, we can hear that it sounds alright, but there is still one more improvement that we can make.

Since these tiny speakers are not very great at playing low frequencies, we can look at the bass boost example in the data sheet. This will make sure that we don’t loose so much in terms of bass while maintaining a good enough audio quality. This part is optional, however, if you find that your speakers sound alright or even better without this feature. Rock definetly sounds better with the bass boost enabled though. Running another test, we can certainly hear the difference with the bass boost feature enabled. And as always, the schematic will be in the description in case you are confused as to how I put this circuit together.

And so, feeling satisfied with the circuit design, we can make it permament. But first, I have to select a hat to use. After looking at a few of my hats, I found one that I am ok with sacrificing. The others were just too cool to use for this project.

After selecting an appropriately sized perfboard, I began soldering the components together and after I was finished I connected it together to test it, and it sounds alright. I also had to make another one just like it for the stereo configuration.

Now, with the board out of the way, we can place the speakers, the boards, the audio jack, and the battery. I found that placing the boards on the top of the hat gave it an interesting aesthetic and the audio jack on the back was the best spot for the audio cable to reach down to the phone or mp3 player in a pocket. The speakers went at the cap, because it is convenient and easy to hear from that spot.

And so, I desoldered the wires on the speakers and put on longer wires to reach the boards. I then hot glued the speakers and boards into their places. I also added a switch inbetween the battery and the boards so that the hat can be turned off. After gluing the battery and the audio jack, we can test it once again and make sure that it works. And it does!

Now, I can play music wherever and whenever I want.

 Share!