cosmetics 1

This commit is contained in:
dennisdebel 2018-05-11 01:28:57 +02:00
parent ab04cc1fc9
commit 5365374743
2 changed files with 6 additions and 236 deletions

View File

@ -227,9 +227,9 @@ You're free to come up with a technique to connect the components together as lo
14) the negative pole of the battery must connect to: 14) the negative pole of the battery must connect to:
the negative pole/gnd of the speaker * the negative pole/gnd of the speaker
gnd of the ATtiny (pin 4) * gnd of the ATtiny (pin 4)
gnd of the SD card (at two contacts, use a jumper wire as seen in (step 18)) * 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). 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).
@ -254,6 +254,9 @@ You're free to come up with a technique to connect the components together as lo
* 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.
### FURTHER READING AND CREDITS ### FURTHER READING AND CREDITS
http://highlowtech.org/?p=1695 - how to use arduino to flash attiny etc. 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://elm-chan.org/works/sd8p/report.html - original creator, source files, great site!

233
howto.txt
View File

@ -1,233 +0,0 @@
*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!
[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 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/)
It can and will therefore be hyper-specific, incomplete, inconsistent or plain wrong at some points.
## 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).
#### 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)
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.
#### 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.
The commands after the dollar sign below are all executed from this folder aka typed in the terminal followed by the ENTER key.
(so dont 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 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)
type: $ make
Now you have a main.hex
FLASHING HEX
$ 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/then/ownCloud/space/linuxpresday/attiny-instructable-master/1_leds/main.hex:i
BOOM!
To test, 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). (http://www.instructables.com/id/Honey-I-Shrunk-the-Arduino-Moving-from-Arduino-t/)
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
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
Sprites mod has an excellent schematic: http://spritesmods.com/?art=doorbell&page=2
(schema.png)
-put content on sd card-
see below
__ _____ ____ _ ______ _ _ ___ ____
\ \ / / _ \| _ \| |/ / ___|| | | |/ _ \| _ \
\ \ /\ / / | | | |_) | ' /\___ \| |_| | | | | |_) |
\ V V /| |_| | _ <| . \ ___) | _ | |_| | __/
\_/\_/ \___/|_| \_\_|\_\____/|_| |_|\___/|_|
PARTS NEEDED
(micro) SD CARDS (ebay) <1eur
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) 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 dont 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.
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 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…..
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 (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
Youre 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. Cant 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 doenst 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!
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!
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.