[null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/schematic-view.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/schematic-view.jpg", "formatted_filename": "schematic view", "alt_text": "schematic-view.jpg"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/physical-view.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/physical-view.jpg", "formatted_filename": "physical view", "alt_text": "physical-view.jpg"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/09.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/09.jpg", "alt_text": "09"}, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/10.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/10.jpg", "alt_text": "10"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/11.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/11.jpg", "alt_text": "11"}, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/12.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/12.jpg", "alt_text": "12"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/13.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/13.jpg", "alt_text": "13"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/14.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/14.jpg", "alt_text": "14"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/15.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/15.jpg", "alt_text": "15"}, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/16.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/16.jpg", "alt_text": "16"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/17.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/17.jpg", "alt_text": "17"}, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/18.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/18.jpg", "alt_text": "18"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/19.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/19.jpg", "alt_text": "19"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/20.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/20.jpg", "alt_text": "20"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/21.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/21.jpg", "alt_text": "21"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/22.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/22.jpg", "alt_text": "22"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/23.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/23.jpg", "alt_text": "23"}, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/24.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/24.jpg", "alt_text": "24"}, null, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/25.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/25.jpg", "alt_text": "25"}, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/26.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/26.jpg", "alt_text": "26"}, {"document_url": "https://git.vvvvvvaria.org/then/secure-digital-club", "unformatted_src": "/then/secure-digital-club/raw/branch/master/images/27.jpg", "src": "https://git.vvvvvvaria.org/then/secure-digital-club/raw/branch/master/images/27.jpg", "alt_text": "27"}, null]
repo for instructions and code to produce a audio (wav) player from a simple sd card and an attiny(85) avr chip
14 Commits
1 Branch


Welcome to the Secure Digital club

Here you will find instructions and code to produce an audio (.wav) player using a SD card, a speaker, 3v coin-cell and an attiny(85) micro-controller. Oh yes, and your favorite tunes!

Varia Open-Day workshop participants, feel free to skip right ahead to the Workshop section below.


This repository is by no means intended as tutorial/how-to but as a personal archive of notes how to re-create the amazing work by Elm Chan

It can and will therefore be hyper-specific, incomplete, inconsistent or plain wrong at some points.


To get your micro-controller to do what you want, it needs some instructions. If you have a pre-flashed ATtiny85 micro-controller your can skip to the Workshop part of this read-me (below).


Prepare your Arduino

Hook up your ATtiny

Power the ATtiny with 5v from the Arduino.

For a schematic view, refer to here or here. ATtiny pin-out here.

Burning ATtiny


Burning Bootloader

To clarify, you are not burning a bootloader here. You are resetting the fuses on the ATtiny to set the internal clock at 16Mhz (it normally runs at 1Mhz).

Getting code on the ATtiny

To go from human-readable (C/C++) instructions to machine code we need to compile. For this task we need a compiler…

NOTE: There are possibly easier ways to do this, like straight from the Arduino IDE.

avrdude (bundled with Arduino IDE on OSX)

The commands after the dollar sign below are all executed from this folder using the terminal and are followed by the ENTER key. (so don’t type the dollar sign)

$ ./avrdude

This command runs the program avrdude, but without further input just lists all available commands.

Create Makefile

To compile code (.c) to binary .hex the avrdude compiler needs instructions as well. For this we need a ‘Makefile’. You can create a new one or modify an exiting one. For beginners I suggest using and modifying the Makefile in the Blink example in this repo (code/blink/makefile). Or just trying to get your ATtiny to blink in the first place, as per this tutorial!

IMPORTANT: make sure all the paths to files, config files etc are correct! (on osx, avrdude etc is not in your ‘path’, or /usr/bin/, so you need full paths to these apps! see the tutorial here and source here)

After you have modified your makefile and written your C code you’re ready to compile. To compile, type:


This will generate a ‘main.hex’ file that can be uploaded or ‘flashed’ to your micro-controller.

Flashing HEX and BLINK

In the terminal type:

$ cd /Applications/Arduino.app/Contents/Java/hardware/tools/avr

$ ./bin/avrdude -C etc/avrdude.conf -c avrisp -P /dev/cu.usbmodem1421 -b 19200 -p attiny85 -U flash:w:/Users/your user_name/your/main.hex:i

Notice the paths.

If all is well your code will be uploaded and running! Time to connect a resistor and led; just need to connect pin 5 (PB0) and/or 6 (PB1) of your ATtiny with an LED respectively (of course you need to add a resistor with at least 150 Ohm before). See this tutorial for more info.

Play music

The compiled .hex for ATtiny85 at 8MHz can be found in this repository (binaries/tiny.hex). To flash:

Now you need to connect the ATtiny to an SD card (reader) or even a SD card mirco SD adaptor. SpriteTM has an excellent schematic (first one) here. Or continue below for a even more minimalistic approach.

Please also refer to the Workshop section below for information on how to format your SD card and the music files.



Hardware per unit



Formatting sound-files

Place (up to 48 kHz, 8-bit, mono) PCM .wav files on a FAT (32) formatted SD card inside folder called “wav”.

NOTE: When flashing the ATtiny at 16Mhz the sound files seem to play a bit fast. You can flash a 8MHz bootloader, but this requires you to speed up the sound files times two (‘-speed 2’). This IS required when using an ATtiny85 10pu (runs at max 10Mhz).


To convert a whole folder of files:

$ for i in *.mp3; do ffmpeg -i "$i" ${i%.*}.wav; done


$ for i in *wav; do sox "$i" -r 48000 -c 1 -b 8 ${i%.*}-conv.wav; done

Your correctly converted files will have the ‘-conv.wav’ extention. Delete the rest and put all the files ending in ‘-conv.wav’ in a folder called ‘wav’ on your FAT32 formatted SD card.

FYI: We are still working on a one-liner…


SpriteTM has an excellent schematic (first one) here. But we can go more minimal (hint: ‘forget’ the capacitors): Schematic drawing of the physical construction: For construction on micro SD, see Elm Chan’s schematics


You’re free to come up with a technique to connect the components together as long as you keep the schematic in mind (or not ;0). Among popular techniques are: breadboarding, manhattan (great tutorial here btw) or deadbug circuit design, more crazy circuits here. Can’t decide how to connect the components? Just start soldering up the components pin by pin, either starting from the SD card or the ATtiny. Another approach is to think about what type of device you want to create; will it be a wearable device, a pocket device, a mantle piece? Or what functionality it should have (easy to replace batteries? updatable songs? reset button? skip track button?). Below is an description for a dead-bug style compact unit with replaceable battery, departing from the pins on the SD card in respect to the orientation of the ATtiny.

Soldering Tips


1) with pin 1 in the left top corner, bent flat the ATtint85 legs, be careful, these are fragile!

2) place the ATtiny with pin1 in the top left corner on the SD card orientated in such a way that the golden contacts are displayed.

3) Bent the ATtiny pins a little bit so pin 5 touches D0 on the SD card, pin 7 touches the CLK contact of the SD card and pin 8 touches the VCC on the SD card. Lift ATtiny pin 6 up a bit, so it doens’t make contact. 4) remember the ATtiny orientation and put it aside.

5) ‘wet’ or ‘tin’ all the SD card contacts with a bit of solder (you can omit the outer two), be careful not to melt the plastic. For easier soldering you can carefully cut the innards of the SD card from the plastic shell! 6) wet all the legs of the AT tiny with solder, you can omit pin 1.

7) place the ATtiny back in place, put a TINY bit of solder on your iron and you will be able to ‘tack’ the ATtiny in place in a breeze. 8) remove the battery form the clip if there is one (when heated, the 3v lithium cells tend to explode in your face).

9) wet the legs of the clip.

10) strip and tin a piece of wire (3.5cm) and connect it to the negative pole of the battery clip.

11) strip and tin a piece of wire (5cm) and connect it to the positive pole of the battery clip. See image 12) cut the plastic pins from the battery clip and (hot)glue it to the SD card. 13) bend the 5cm wire coming from the positive battery lead around the SD card towards the vcc pin of the SD card (and ATtiny ;), cut it to size, wet the end and solder it in place! 14) the negative pole of the battery must connect to:

15) so…from the negative pole of the battery clip, move along to the ATtiny pin 4, solder it down and bend it to the upper most gnd (vss) of the SD card . For the speaker use an extra piece of wire (step 19) and use a small piece of jumper wire to connect the two vss and gnd on the SD card (step 18).

16) cut a piece of wire (3.5cm) to connect ATtiny pin 2 to SD card pin D3 (dat 3), cut, strip, tin, solder. 17) cut a piece of wire, strip, tin, bent to connect SD cards gnd pin to negative battery clip. 18) cut, strip, tin a 2cm wire to connect ATtiny pin 6 to D1 of the SD card, careful not to burn your hands and make sure no wires are touching! 19) at this point i solder 4cm of multicore, flexible (in order to have a bit more freedom to position the speaker), wire to the audio out of the ATtiny (pin 3) and the negative pole of the battery for the speaker 20) slip in a battery and you have your boom-box! Notes and features


http://highlowtech.org/?p=1695 - how to use arduino to flash attiny etc. http://elm-chan.org/works/sd8p/report.html - original creator, source files, great site! http://www.instructables.com/id/Attiny85-Sd-Wav-Player/ - compiled code (hex) from here http://www.sonsivri.to/forum/index.php?topic=7156.0 https://www.esp32.com/viewtopic.php?t=2272 http://spritesmods.com/?art=doorbell&page=2 http://stefaanlippens.net/audio_conversion_cheat_sheet/ http://www.instructables.com/id/Attiny85-Sd-Wav-Player/ - tut for raspberry pi as programmer https://www.youtube.com/watch?v=9LjfkjwMqXI - diy programming shield https://www.youtube.com/watch?v=BexXvxmOGN8 - another one http://highlowtech.org/?p=1695 - programming the chip https://www.youtube.com/watch?v=RVC_nLZy-T8 - smart sdcard microsd adaptor hack: https://www.youtube.com/watch?v=tUapZ_JdHLE - interesting audacity tut halfway: http://txyzinfo.blogspot.nl/2012/11/AVR-attiny2313-wav-music-player-from-SD-card-microSD-MMC.html - cool https://www.youtube.com/watch?v=CDRRwNkzasQ http://paja-trb.cz/konstrukce/wav_player.html - pcb version, home etch-able.