diff --git a/README.md b/README.md index ebe2f88..a0d3716 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,273 @@ -# secure-digital-club +*Welcome to the Secure Digital club* -repo for instructions and code to produce a audio (wav) player from a simple sd card and an attiny(85) avr chip \ No newline at end of file +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](http://varia.zone/varia-open-day.html) workshop participants, feel free to skip right ahead to the [Workshop](#Workshop) section. + +## Intro +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](http://elm-chan.org/) + +It can and will therefore be hyper-specific, incomplete, inconsistent or plain wrong at some points. + + +## Flashing +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](#Workshop) part of this read-me (below). + + +#### Prerequisites +* Arduino Uno or Duemilanove (w/ an ATmega328, not an older board with an ATmega168) +* ATtiny45 or ATtiny85 (8-pin DIP package) attiny85V-10pu(1.8v-5.5) NOT the attiny85-20pu(2.7-5.5) > consumes to much power +* 10 uF capacitor +* Breadboard +* 8x jumper wires +* Arduino IDE + +#### Prepare your Arduino +* Open Arduino IDE, add ATTiny support, [see here](http://highlowtech.org/?p=1695) +* Load: File>Examples>11.ArduinoISP +* Connect Arduino Uno to computer and select the right board and port from the Tools menu (aka Arduino Uno) +* Upload the sketch to the Arduino Uno +* Disconnect the Arduino Uno + + +#### Hook up your ATtiny +* Wire up the Arduino to the ATtiny: + * Pin connections: + * ATtiny Pin 2 to Arduino Pin 13 (or SCK of another programmer) + * ATtiny Pin 1 to Arduino Pin 12 (or MISO of another programmer) + * ATtiny Pin 0 to Arduino Pin 11 (or MOSI of another programmer) + * ATtiny Reset Pin to Arduino Pin 10 (or RESET of another programmer) + +Power the ATtiny with 5v from the Arduino. + +For a schematic view, refer to [here](https://git.vvvvvvaria.org/then/secure-digital-club/src/branch/master/wiring-diagrams/arduino-to-attiny-wiring.png) or [here](http://highlowtech.org/wp-content/uploads/2011/06/Screen-shot-2011-06-06-at-1.46.39-PM.png). +ATtiny pin-out [here](https://cdn.sparkfun.com/assets/f/8/f/d/9/52713d5b757b7fc0658b4567.png). + +### Burning ATtiny +NOTE: THE FOLLOWING STEPS ARE NEEDED FOR EVERY ATTINY YOU PLAN ON USING WITH THIS PARTICULAR CODE. + +#### Burning Bootloader +* Connect Arduino to computer again +* In Arduino IDE select: + * Tools – Board – ATtiny85 @ 16Mhz (internal oscillator; BOD disabled) + * Tools – Programmer – Arduino as ISP + * Tools – Serial Port – that your Arduino is connected to + +* Finally: + * Tools – Burn 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) +* On osx, open a Terminal and type: +``` cd /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/ ``` + +* Press enter +* You're now in the folder with all the avr stuff. + +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](http://www.instructables.com/id/Honey-I-Shrunk-the-Arduino-Moving-from-Arduino-t/)! + +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](http://www.instructables.com/id/Honey-I-Shrunk-the-Arduino-Moving-from-Arduino-t/) and source [here](https://github.com/internaut/attiny-instructable)) + +After you have modified your makefile and written your C code you're ready to compile. To compile, type: + +``` $ make ``` + +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](http://www.instructables.com/id/Honey-I-Shrunk-the-Arduino-Moving-from-Arduino-t/) for more info. + + +##### Play music +The compiled .hex for ATtiny85 at 8MHz can be found in this repository (binaries/tiny.hex). To flash: + +``` $ ./bin/avrdude -C etc/avrdude.conf -c avrisp -P /dev/cu.usbmodem1421 -b 19200 -p attiny85 -U flash:w:/Users/your user_name/your/tiny.hex:i``` + + +Now you need to connect the ATtiny to an SD card (reader) or even a SD card mirco SD adaptor. [SpriteTM](http://spritesmods.com/) has an excellent schematic (first one) [here](http://spritesmods.com/?art=doorbell&page=2). 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. + + + +# Workshop + + +#### Prerequisites + +###### Hardware per unit +* 1x (pre flashed) ATtiny85V-10pu(1.8v-5.5) NOT the attiny85-20pu(2.7-5.5) > consumes to much power (p02.jpg) +* 1x speaker (4, 8, 16 ohm? < under construction) (p01.jpg) +* 1x cr2032 (3v lithium cell) (p03.jpg) +* 1x (micro) SD card (with or without adaptor) (p04.jpg) or (p08.jpg) +* 1x battery holder (lithium cells don't like the heat of your iron and will explode in your face) (p05.jpg) +* music! + +Optional + * female mono jack (p06.jpg) + * 4k7 resistor (p07.jpg) + +###### Software +* FFMPEG +* SOX + +#### 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 files play a bit to fast. You can flash a 8MHz bootloader, but this requires you to speed up the sound files times two. This seemed to sound better..but yeh...you already know what it is... + +###### Workflow +* Format your Sd card as FAT +* In your terminal: + * ``` $ ffmpeg -i input.mp3 output.wav ``` + * ``` $ sox output.wav -r 48000 -c 1 -b 8 putmeonsd.wav ``` + +To convert a whole folder of files: + +``` $ for i in *.mp3; do ffmpeg -i "$i" ${i%.*}.wav; done``` + +followed by + +``` $ 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... + +#### Schematic + +[SpriteTM](http://spritesmods.com/) has an excellent schematic (first one) [here](http://spritesmods.com/?art=doorbell&page=2). But we can go more minimal (hint: 'forget' the capacitors). + +**WORK IN PORGRESS** + +CONNECTING micro SD CARD TO ATTINY85 +* see: schemasd8p_mo.png +* and: sdcard-pinout.png + + +Soldering to the SD CARD (not micro sd): +* vss1 and vss2 are GND (can be connected together) + see: sdcard-pinout.png + +**WORK IN PORGRESS** + +#### Construction +You're free to come up with a technique to connect the components together as long as you keep the [schematic](#Schematic) in mind (or not ;0). Among popular techniques are: breadboarding, [manhattan](https://hackadaycom.files.wordpress.com/2016/05/0gfwt.jpg?w=400) (great tutorial [here](https://www.parasitstudio.se/building-blog/manhattan-style-pedalbuilding) btw) or [deadbug](https://m.eet.com/media/1180890/thermoml.jpg) circuit design. 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 +* clean the tip of your soldering iron before every usage! +* 'wet' all parts that will come together a.k.a. 'tin' or put solder on all parts before joining them. +* solder will flow to the hottest place ;) and your tip is almost always the hottest…keep this in mind..you can and must make use of this. + + +###### Steps + +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. See images (09.jpg) and (10.jpg) + + +4) remember the ATtiny orientation and put it aside. + + +5) 'wet' 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! See image (11.jpg) and (12.jpg). + + +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. See image (12.jpg) + +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 (14.jpg) + + +12) cut the plastic pins from the battery clip and (hot)glue it to the SD card. See images (15.jpg) and (16.jpg) + + +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! See images (17.jpg) and (18.jpg) + + +14) the negative pole of the battery must connect to: + the negative pole/gnd of the speaker + gnd of the ATtiny (pin 4) + gnd of the SD card (at two contacts, use a jumper wire as seen in (step 18)) + +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 (19.jpg). 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 (20.jpg). + +17) cut a piece of wire, strip, tin, bent to connect SD cards gnd pin to negative battery clip (21.jpg). + +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 (22.jpg)! + +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 (23.jpg) and (24.jpg). + +20) slip in a battery and you have your boom-box! + +(25.jpg) +(26.jpg) +(27.jpg) + +#### Notes and features +* Instead of a speaker you can also solder a minijack input or just solder the female jack to the speaker leads and enjoy both! +* Reset playback: connect vss (gnd) to DAT0 to restart playing from the first file (alphabetic order). +* Skip Track: connect vss (gnd) to DAT0 through a 4k7 resistor to skip a track. +* The circuit draws 0.03A the cr2032 lithium battery delivers about 200 mAh, so battery life is 200/3 = 66 hours, almost 3 days of operation time. + + +### FURTHER READING AND CREDITS +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. \ No newline at end of file diff --git a/howto.txt b/howto.txt index 1723d14..10886a8 100644 --- a/howto.txt +++ b/howto.txt @@ -1,66 +1,77 @@ +*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 coincell and an attiny(85) microcontroller. Oh yes, and your favourite tunes! - _ _ _____ _______ ___ -| | | |/ _ \ \ / /_ _/ _ \ -| |_| | | | \ \ /\ / / | || | | | -| _ | |_| |\ V V / | || |_| | -|_| |_|\___/ \_/\_/ |_| \___/ +[Varia Open-Day](http://varia.zone/varia-open-day.html) workshop participants, feel free to skip right ahead to the [Workshop](#Workshop) section. -FLASHING (PUTTING .HEX Files on your ATtiny) +## Intro +This repo 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](http://elm-chan.org/) --needed- -*Arduino Uno or Duemilanove (w/ an ATmega328, not an older board with an ATmega168) -*ATtiny45 or ATtiny85 (8-pin DIP package) -*a 10 uF capacitor -*a breadboard -*8x jumper wires -*Arduino IDE +It can and will therefore be hyper-specific, incomplete, inconsistent or plain wrong at some points. --flashing the arduino to act as programmer- -*Open Arduino, add ATTiny support > http://highlowtech.org/?p=1695 -*Load: File>Examples>11.ArduinoISP -*Connect arduino to computer and select the right board, and port from the Tools menu (aka arduino Uno) -*Upload the sketch to the arduino board -*Disconnect arduino +## Flashing +To get your microcontroller to do what you want, it needs some instructions. If you have a preflashed ATtiny85 microcontroller your can skip to the [Workshop](#Workshop) part of this readme (below). --wiring- -*wire up the arduino to the attiny, see schematic arduino-to-attiny-wiring.png or http://highlowtech.org/wp-content/uploads/2011/06/Screen-shot-2011-06-06-at-1.46.39-PM.png -Pin connections: - ATtiny Pin 2 to Arduino Pin 13 (or SCK of another programmer) - ATtiny Pin 1 to Arduino Pin 12 (or MISO of another programmer) - ATtiny Pin 0 to Arduino Pin 11 (or MOSI of another programmer) - ATtiny Reset Pin to Arduino Pin 10 (or RESET of another programmer) -(ATtiny pinout refer to schematic: https://cdn.sparkfun.com/assets/f/8/f/d/9/52713d5b757b7fc0658b4567.png ) +#### Prerequisites +* Arduino Uno or Duemilanove (w/ an ATmega328, not an older board with an ATmega168) +* ATtiny45 or ATtiny85 (8-pin DIP package) attiny85V-10pu(1.8v-5.5) NOT the attiny85-20pu(2.7-5.5) > consumes to much power +* 10 uF capacitor +* Breadboard +* 8x jumper wires +* Arduino IDE -NOTE REPEAT THE STEPS BELOW FOR EVERY ATTINY CHIP YOUR PLANNING TO USE/PROGRAM:x +#### Prepare your Arduino +* Open Arduino IDE, add ATTiny support, [see here](http://highlowtech.org/?p=1695) +* Load: File>Examples>11.ArduinoISP +* Connect Arduino Uno to computer and select the right board and port from the Tools menu (aka Arduino Uno) +* Upload the sketch to the Arduino Uno +* Disconnect the Arduino Uno -*Connect arduino to computer again -*In arduino ide select: - Tools – Board – Attiny85 @ 8Mhz (internal oscillator; BOD disabled) - Tools – Programmer – Arduino as ISP - Tools – Serial Port – COMx (x being the com port that your arduino is connected to) -*Finally: - Tools – Burn Bootloader +#### Hook up your ATtiny +* Wire up the Arduino to the ATtiny: + * Pin connections: + * ATtiny Pin 2 to Arduino Pin 13 (or SCK of another programmer) + * ATtiny Pin 1 to Arduino Pin 12 (or MISO of another programmer) + * ATtiny Pin 0 to Arduino Pin 11 (or MOSI of another programmer) + * ATtiny Reset Pin to Arduino Pin 10 (or RESET of another programmer) -To clarify, you are not burning a bootloader here. You are resetting the fuses in the Attiny to clock it at 8Mhz (normally runs at 1Mhz). -Next, get the firmware into the chip. With that I mean the hex file you want in your chip +For a schematic view, refer to [here](https://git.vvvvvvaria.org/then/secure-digital-club/src/branch/master/wiring-diagrams/arduino-to-attiny-wiring.png) or [here](http://highlowtech.org/wp-content/uploads/2011/06/Screen-shot-2011-06-06-at-1.46.39-PM.png). +ATtiny pinout [here](https://cdn.sparkfun.com/assets/f/8/f/d/9/52713d5b757b7fc0658b4567.png). +### Burning ATtiny +NOTE: THE FOLLOWING STEPS ARE NEEDED FOR EVERY ATTINY YOU PLAN ON USING WITH THIS PARTICULAR CODE. --flashing the firmware with avrdude (bundled with arduino on OSX)- +#### Burning Bootloader +* Connect Arduino to computer again +* In Arduino IDE select: + * Tools – Board – ATtiny85 @ 8Mhz (internal oscillator; BOD disabled) + * Tools – Programmer – Arduino as ISP + * Tools – Serial Port – that your Arduino is connected to + +* Finally: + * Tools – Burn Bootloader + +To clarify, you are not burning a bootloader here. You are resetting the fuses on the ATtiny to set the internal clock at 8Mhz (it normally runs at 1Mhz). + +#### Getting code on the ATtiny + + +-flashing the firmware with avrdude (bundled with Arduino IDE on OSX)- *On osx, open a Terminal and type: cd /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/ *Press enter ;) -*Youre now in the folder with all the avr stuff. +*You’re now in the folder with all the avr stuff. -The commands ater the dollarsign below are all executed from this folder aka typed in the terminal followed by the ENTER key. -(so dont type the dollar sign) +The commands after the dollar sign below are all executed from this folder aka typed in the terminal followed by the ENTER key. +(so don’t type the dollar sign) $ ./avrdude (lists available commands) --create makefile- -*to compile code (.c) to binary .hex using a 'makefile', create a new one or modify an exiting one (see led example) + +CREATE MAKEFILE +*to compile code (.c) to binary .hex using a 'makefile', create a new one or modify an exiting one (see Blink example in this repo) *make sure all the paths are correct! (on osx avrdude etc is not in your 'path', or /usr/bin/, so you need full paths to these apps!) (ref: http://www.instructables.com/id/Honey-I-Shrunk-the-Arduino-Moving-from-Arduino-t/ and: https://github.com/internaut/attiny-instructable) @@ -70,8 +81,7 @@ type: $ make Now you have a main.hex --flashing hex- - +FLASHING HEX $ cd /Applications/Arduino.app/Contents/Java/hardware/tools/avr @@ -85,16 +95,11 @@ To test, just need to connect pin 5 (PB0) and/or 6 (PB1) of your ATtiny with an --flash SDCARD CODE- +SDCARD PLAYER CODE $ ./bin/avrdude -C etc/avrdude.conf -c avrisp -P /dev/cu.usbmodem1421 -b 19200 -p attiny85 -U flash:w:/Users/then/ownCloud/space/linuxpresday/attinydj/install/tiny.hex:i --put content on sd card- -place (48 kHz, 8-bit, mono) wav files in an FAT (32) formatted sd card folder called "wav". -(ref:http://www.instructables.com/id/Attiny85-Sd-Wav-Player/) - ->> oef check this>> http://elm-chan.org/works/sd20p/report.html (put 001.wav file in root) CONNECTING micro SD CARD TO ATTINY85 see: schemasd8p_mo.png @@ -109,58 +114,8 @@ CONNECTING micro SD CARD TO ATTINY85 Sprites mod has an excellent schematic: http://spritesmods.com/?art=doorbell&page=2 (schema.png) - -ref: - 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 - - - - -FURTHER READING AND CREDITS: -http://elm-chan.org/works/sd8p/report.html -- original creator, great site! -http://www.instructables.com/id/Attiny85-Sd-Wav-Player/ -- tut for raspberry pi as programmer - - - - - ---- -attiny sd player... attiny soldered directly on cheap sdcard - -diy programming shield: -https://www.youtube.com/watch?v=9LjfkjwMqXI - -better> https://www.youtube.com/watch?v=BexXvxmOGN8 - - -brogramming the chip -http://highlowtech.org/?p=1695 - - -smart sdcard microsd adaptor hack: -https://www.youtube.com/watch?v=RVC_nLZy-T8 - - - -uiteindelijk: -http://www.instructables.com/id/Attiny85-Sd-Wav-Player/ -http://elm-chan.org/works/sd8p/report.html (fuses not needed rite? see: https://www.youtube.com/watch?v=RVC_nLZy-T8 ) - -harde site http://elm-chan.org/ - - -interesting audacity tut halfway: -https://www.youtube.com/watch?v=tUapZ_JdHLE - - -hard: -http://txyzinfo.blogspot.nl/2012/11/AVR-attiny2313-wav-music-player-from-SD-card-microSD-MMC.html -https://www.youtube.com/watch?v=CDRRwNkzasQ - -more advanced, with pcb etcahble: -http://paja-trb.cz/konstrukce/wav_player.html +-put content on sd card- +see below __ _____ ____ _ ______ _ _ ___ ____ @@ -170,7 +125,7 @@ __ _____ ____ _ ______ _ _ ___ ____ \_/\_/ \___/|_| \_\_|\_\____/|_| |_|\___/|_| -musical keycord + PARTS NEEDED @@ -179,19 +134,23 @@ PARTS NEEDED https://www.ebay.nl/itm/Job-lot-of-44-Used-Micro-SD-Memory-Cards-All-2GB-Various/253593350905?hash=item3b0b5772f9:g:rsEAAOSwyi1a5s7G&autorefresh=true per unit: -1x atttiny85 (farnell) +1x atttiny85 (farnell) attiny85V-10pu(1.8v-5.5) NOT the attiny85-20pu(2.7-5.5) > consumes to much power 1x speaker (eculit?) 1x cr2032 (3v lithium cell) 1x (micro)sdcard +1x battery holder (lithium cells don’t like the heat of your iron and will explode in your face) BATTERY -the circuit draws 0.03A the cr2032 lithium battery delivers about 200 mah, so battery life is 200/3 = 66 hours, almost 3 days of operation time. +the circuit draws 0.03A the cr2032 lithium battery delivers about 200 mAh, so battery life is 200/3 = 66 hours, almost 3 days of operation time. SOUNDS -According to ELM CHang: “The SD audio player supports only RIFF-WAVE format sound files known as Microsoft wave file in LPCM, 8/16-bit, mono/stereo and upto 48kHz sampling rate”. +According to ELM Chang: “The SD audio player supports only RIFF-WAVE format sound files known as Microsoft wave file in LPCM, 8/16-bit, mono/stereo and up to 48kHz sampling rate”. (http://elm-chan.org/works/sd8p/report.html) +-put content on sd card- +place (48 kHz, 8-bit, mono) wav files in an FAT (32) formatted sd card folder called "wav". +(ref:http://www.instructables.com/id/Attiny85-Sd-Wav-Player/) But this is not the case….. @@ -199,25 +158,76 @@ workflow: convert mp3 to wav, convert wav to speed it up 2x $ ffmpeg -i input.mp3 output.wav $ sox output.wav -r 48000 -c 1 -b 8 short2x48-8.wav speed 2 -To convert a whole folder (zhell, osx, etc..): +To convert a whole folder (zshell, osx, etc..): $ 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 speed 2; done +FEATURES: +-reset: connect vss (gnd) to DAT0 to restart playing from the first file (alphabetic order) +-skip track: connect vss (gnd) to DAT0 through a 4k7 resistor to skip a track + +CONSTRUCTION +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: deadbug, breadboard or volumetric circuit design. Can’t decide how to connect the components? Just start soldering up the components pin by pin (starting from the sdcard or 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?). + +soldering: +1(clean it every time you use it and periodically!) +2 wet all parts that will come together +3 solder will flow to the hottest place ;) and your tip is almost always the hottest…keep this in mind.. + + +Below is an description for a deadbug style compact unit with replaceable battery: + +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’ 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 +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, with the end and solder it in place! +14) the negative pole of the battery must connect to: + the negative pole/gnd of the speaker + gnd of the ATtiny (pin 4) + gnd of the SD card (2x, or use jumper(step 17)) +15) so…from the negative pole of the clip i move to the ATtiny pin 4, solder it down, bent it to the upper most gnd (vss) of the SD card. For the speaker i use an extra piece of wire and i use a smal piece of jumper wire to connect the two vss and gnd on the SD card +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. +slip in a battery and you have your boombox! -ref: -http://stefaanlippens.net/audio_conversion_cheat_sheet/ -http://elm-chan.org/works/sd8p/report.html +notes: +instead of a speaker you can also solder a minijack input or just solder the female jack to the speaker leads and enjoy both! -COSTS -6x sdcards (marktplaats) 6,50+5,85 … = 12,35 -6x attiny a 1,08 = 6,36 -6x CR 2032 a 0,884 = 5,404 -6x speaker… + + + +FURTHER READING AND CREDITS: +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. \ No newline at end of file diff --git a/images/09.jpg b/images/09.jpg new file mode 100644 index 0000000..b2f7947 Binary files /dev/null and b/images/09.jpg differ diff --git a/images/10.jpg b/images/10.jpg new file mode 100644 index 0000000..c09b396 Binary files /dev/null and b/images/10.jpg differ diff --git a/images/11.jpg b/images/11.jpg new file mode 100644 index 0000000..45e7023 Binary files /dev/null and b/images/11.jpg differ diff --git a/images/12.jpg b/images/12.jpg new file mode 100644 index 0000000..2d69a91 Binary files /dev/null and b/images/12.jpg differ diff --git a/images/13.jpg b/images/13.jpg new file mode 100644 index 0000000..d15c4d3 Binary files /dev/null and b/images/13.jpg differ diff --git a/images/14.jpg b/images/14.jpg new file mode 100644 index 0000000..fda89e9 Binary files /dev/null and b/images/14.jpg differ diff --git a/images/15.jpg b/images/15.jpg new file mode 100644 index 0000000..c03dc5e Binary files /dev/null and b/images/15.jpg differ diff --git a/images/16.jpg b/images/16.jpg new file mode 100644 index 0000000..494c948 Binary files /dev/null and b/images/16.jpg differ diff --git a/images/17.jpg b/images/17.jpg new file mode 100644 index 0000000..e8100a1 Binary files /dev/null and b/images/17.jpg differ diff --git a/images/18.jpg b/images/18.jpg new file mode 100644 index 0000000..cebf9d5 Binary files /dev/null and b/images/18.jpg differ diff --git a/images/19.jpg b/images/19.jpg new file mode 100644 index 0000000..2f6533e Binary files /dev/null and b/images/19.jpg differ diff --git a/images/20.jpg b/images/20.jpg new file mode 100644 index 0000000..c030a5b Binary files /dev/null and b/images/20.jpg differ diff --git a/images/21.jpg b/images/21.jpg new file mode 100644 index 0000000..d614271 Binary files /dev/null and b/images/21.jpg differ diff --git a/images/22.jpg b/images/22.jpg new file mode 100644 index 0000000..4a8c658 Binary files /dev/null and b/images/22.jpg differ diff --git a/images/23.jpg b/images/23.jpg new file mode 100644 index 0000000..7c7c5b5 Binary files /dev/null and b/images/23.jpg differ diff --git a/images/24.jpg b/images/24.jpg new file mode 100644 index 0000000..c02aa69 Binary files /dev/null and b/images/24.jpg differ diff --git a/images/25.jpg b/images/25.jpg new file mode 100644 index 0000000..582ac55 Binary files /dev/null and b/images/25.jpg differ diff --git a/images/26.jpg b/images/26.jpg new file mode 100644 index 0000000..69c4043 Binary files /dev/null and b/images/26.jpg differ diff --git a/images/27.jpg b/images/27.jpg new file mode 100644 index 0000000..b3660ec Binary files /dev/null and b/images/27.jpg differ diff --git a/images/p01.jpg b/images/p01.jpg new file mode 100644 index 0000000..47f1442 Binary files /dev/null and b/images/p01.jpg differ diff --git a/images/p02.jpg b/images/p02.jpg new file mode 100644 index 0000000..a57ebf7 Binary files /dev/null and b/images/p02.jpg differ diff --git a/images/p03..jpg b/images/p03..jpg new file mode 100644 index 0000000..6d74c66 Binary files /dev/null and b/images/p03..jpg differ diff --git a/images/p04.jpg b/images/p04.jpg new file mode 100644 index 0000000..957c63c Binary files /dev/null and b/images/p04.jpg differ diff --git a/images/p05.jpg b/images/p05.jpg new file mode 100644 index 0000000..de1f331 Binary files /dev/null and b/images/p05.jpg differ diff --git a/images/p06.jpg b/images/p06.jpg new file mode 100644 index 0000000..86f63a7 Binary files /dev/null and b/images/p06.jpg differ diff --git a/images/p07.jpg b/images/p07.jpg new file mode 100644 index 0000000..8ba18f2 Binary files /dev/null and b/images/p07.jpg differ diff --git a/images/p08.jpg b/images/p08.jpg new file mode 100644 index 0000000..6c797cc Binary files /dev/null and b/images/p08.jpg differ