Player wav files on the Attiny85 microcontroller


In this article we will look at the process of creating a very necessary and interesting electronic device that will allow you to play wav files directly from an SD, microSD or mini SD memory card. You can record a music file on a memory card, install such a device, for example, in a refrigerator, and every time you open its door, a beautiful melody will sound. Forget to close such a "music" refrigerator will no longer be possible. Another way to use the player is as a doorbell. On the Internet you can find a lot of different tunes, for all tastes. Thus, the boring sound of the factory bell can be replaced, for example, with the song you like. In addition, such a device can be used for an original gift to a loved one - just build the speaker in a beautiful box, which, when opened, will begin to sound a sound greeting. In addition to these examples, the player can find a lot of applications in everyday life.

Player layout


Player wav files on the Attiny85 microcontroller

The device circuit contains a minimum of details, its key element is a microcontroller of the AVR Attiny85 family. When power is applied, it immediately starts reading files from the memory card and using PWM outputs to play them through the speaker. The volume at the same time turns out not too high, in many respects it depends on the sensitivity of the speaker used. To get more volume, you need to connect an amplifier input instead of a speaker. However, the signal from the output of the microcontroller is too large to be supplied directly to the amplifier, so it is imperative to install a volume control between them, otherwise there is a risk of spoiling the amplifier itself. When you first turn it on, you need to set it to the minimum volume position, and then gradually increase it until you reach the desired volume level.

Pinout memory cards


Pinout of memory cards is shown in the picture:
Player wav files on the Attiny85 microcontroller

With 6 wires, two of which are power, the circuit is connected to the memory card. You can use both SD, and MicroSD and MiniSD, as long as the correct pinout is preserved. The most convenient way is to use an unnecessary MicroSD adapter in SD, then you can solder the wiring to the adapter itself, into which the memory card used is already inserted, I did just that.Before using in this scheme, the memory card must be formatted in the FAT file system. After formatting, wav files can be recorded on the card; they must be PCM format 8 or 16 bits, with a sampling frequency of no more than 48 kHz. There are many computer programs that allow you to convert regular mp3 files into wav format, one of which is GoldWave, I used it.
When the power is turned on, or the memory card is inserted, the circuit will start playback, when you press the button, the next file is included. Memory cards require a power of 3.3 volts, so a 78L33 stabilizer is installed on the printed circuit board offered for the article (it is not listed in the diagram). With the use of a stabilizer, the supply voltage of the circuit lies within 5-12 volts. This scheme consumes a small current, and therefore it can be powered from the battery. For this you need to take a boost converter 3.7 - 5 volts, as I did.
The circuit starts working immediately, does not require any configuration, it is enough just to flash the microcontroller. You need to set the fusion bits as shown in the picture below (a check mark means that this bit is programmed as in the PonyProg).

Related news

Player wav files on the Attiny85 microcontroller image, picture, imagery


Player wav files on the Attiny85 microcontroller 35


Player wav files on the Attiny85 microcontroller 54


Player wav files on the Attiny85 microcontroller 51


Player wav files on the Attiny85 microcontroller 57


Player wav files on the Attiny85 microcontroller 100


Player wav files on the Attiny85 microcontroller 29


Player wav files on the Attiny85 microcontroller 20