Sunday, 12 February 2017

Attiny85 SD Player - Redo of Chan 2009 SD Wav Player in Arduino IDE

Chan 2009 player has C and assembly code. I try to redo so that only I need only the Arduino IDE and Attiny85 with arduino or a USB tiny programmer. You need only to upload an .ino file to Attiny85 for it to play music from a SD card.

Credit for internet knowledge that lead to my work:
1. https://harizanov.com/2012/05/toying-with-attiny84-and-sd-card-in-arduino-ide/ for a link to the wrapper.
2. http://gizmosnack.blogspot.sg/2013/04/tutorial-usart-and-avr.html for spi pin connection
3. http://elm-chan.org/works/sd8p/report.html for the sd code
4. https://learn.adafruit.com/adafruit-wave-shield-audio-shield-for-arduino/overview for the double buffering code

Hardware required:
1. Attiny85
2. SD card adapter

Optional
1. 200 uF capacitor to remove noise
2. a npn transistor to amplify the sound
3. a 100 ohm resistor
4. a push button

The above components are optional. You can leave them out in the circuit diagram below. It will still work.

Difficulties that I encounter:
1. There is no sound. I was struck at this problem for a day. And I found it is because of a short circuit in DI and CS port of the SD adapter. I remove the bad solder and there is sound.
2. Wrong connection from SD to Attiny85. SD DO pin (second pin from the left) should go to Attiny DI pin (PB0). SD DI pin (third pin from the right) should go to Attiny DO pin (PB1).

Here is the circuit diagram:


Some photos:







Here is the software .ino Please note the wav file is name love.wav in the source. Please get your own wav file by using iTune etc to produce a 8 bit 8000 hz wave file.

No comments:

Post a Comment