Introduction: DIY Tiny Music Player
This project is based on the work of ChaN. All credits go to him.
I have added regulated audio headphone amplifier with LP filtering at the output. The music player contains only two chips: Atmel ATtiny85 and Texas Instruments headphone amplifier from the type LM4880, LM4881 or TPA6111A2. It can play RIFF-WAV files with 8-bit resolution and 48KHz sampling rate - not "HI-FI" quality, but in the era of MP3 music, can be accepted :-) . The music files are stored in MicroSD card. They are read by the mcrocontroller and transferred in PWM signal, which after filtering is passed through potentiometer to the inputs of the stereo amplifier. The amplifier can be loaded with standard headphones (16-32 Ohm) or applied to the "LINE" input of power amplifier. The player plays the songs in series - one after one. After reaching the last one, it jumps again to the first. If the knob is pressed during the playing of a song, the player starts the next one from the beginning.
Step 1: The Hardware
The design files in "Eagle" format are attached to the instructable.
As seen in the schematics almost all devices are doubled. This is because the PCB is done in the way, that it can support both through hole and SMD types. Of course only one type device should be soldered.
The BOM (list of used devices) can be extracted from the design data files.
I will mention only some specific parts:
As mentioned before, I use two chips:
ATTiny85 - in DIP8 or soic08 package
LM4880 - in DIP8 or so08 package or LM4881 in so08 or TPA6111A2 in so08 (all pin compatible, except the DIP)
The other components can be through hole type or SMD - your choice.
Step 2: All Parts Soldered
Some pictures of the ready player
Step 3: Software
The Hex file is attached to the project. How to burn it in the microcontroller can be found also in the Instructables.
I used USBtinyISP programmer and AVRdude. Upload first the *.hex file. After that the fuse bits must be set.
The fuse settings of the ATTiny85 are the following:
Lfuse : 0xE1
Hfuse : 0x5D
Efuse : 0xFF
I would strongly recommend to burn the fuses in the following order: Efuse (if needed - if the chip was used before - in other case the factory settings are identical to the required). After that the Lfuse must be burned. At third is burned the Hfuse.
You should know that after burning the Hfuse the chip is locked further for programming. It can not be accessed by the ISP programmer, because the RSTDISBL is set to "0", what defines the "RESET" pin as I/O and the chip can not be reset. The only way to unlock it is to use HV programmer. Playing with the player I have locked 3 chips and after that it took me two days to unlock them. How to do this is matter of other instructable, which I may be should write,
When the talk is about the software, here is the place to talk about the music files format. They must be RIFF-WAV type. Such file can be created by the use of the nice open source audio converter "Freemake". On the picture are shown the output file settings. You can convert your MP3 of WMF files without problems. All files must be saved in the root of the SD card or in folder called "wav". I would suggest that for the test you should use SD card containing only wav files.
Step 4: Debugging ...
According Murphy, at the first test the player was not working. Something, what always should be expected :-).
I had to start the debugging procedure.
At first I applied audio signal at the top terminal of the potentiometer to check the audio amplifier. It was working. I reprogrammed the microcontroller (twice - 2 additional chips) - the same result. My suspicion was that the problem is either in the card, either in the microSD card socket. I have soldered a SD card directly to the ATtiny pins - Success!!!. After that I have formatted the microSD card in FAT32 mode and put on it only a song. It was working. Adding more songs was also successful.
Step 5: Additional Info
The SD and microSD cards allow maximum supply voltage of 3.6V. The recommended operational voltage is 3.3V.
As shown on the pictures I have used a 3xAAA battery pack to supply the player. This is DANGEROUS! It makes 4.5V using alkaline batteries. To prevent burning of the memory cards, I have extracted one of the batteries from the pack and replaced it with a metal bolt. :-).
Thank you for you attention.
P.S. I have some PCB's remaining. If you want to build the player, I can sent you a piece for 8 USD (shipping included). These support only DIP versions of the chip and panel mount audio socket. Now I have offered the player as a DIY kit in different versions (with soldered or not soldered SMD chips, with programmed or not programmed ATtiny) These kits will be available on Tindie . Under desire fully assembled player can be delivered. E-mail for contact : firstname.lastname@example.org
We have a be nice policy.
Please be positive and constructive.