{"id":325,"date":"2014-08-26T00:18:09","date_gmt":"2014-08-26T00:18:09","guid":{"rendered":"http:\/\/bitcows.com\/?p=325"},"modified":"2014-08-26T00:18:09","modified_gmt":"2014-08-26T00:18:09","slug":"diy-sd-card-reader-and-audio-player-for-arduino-uno","status":"publish","type":"post","link":"https:\/\/bitcows.com\/?p=325","title":{"rendered":"DIY SD Card Reader and audio player for Arduino UNO"},"content":{"rendered":"<p>Files needed to talk to the card to play music:<br \/>\n<a href=\"https:\/\/github.com\/djmason9\/TMRpcm\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/djmason9\/TMRpcm<\/a><br \/>\nYou will need to install these into the Arduino App. (<a href=\"http:\/\/arduino.cc\/en\/Guide\/Libraries\" target=\"_blank\" rel=\"noopener\">See Import Library<\/a>) for details<\/p>\n<p>Don&#8217;t have a break out board for the card reader? Make one! NOTE: only use 3.3V on this.<br \/>\n<img decoding=\"async\" src=\"http:\/\/bitcows.com\/wp-content\/uploads\/2014\/08\/IMG_7433.jpg\" alt=\"SD Card\" width=\"300\" class=\"alignnone size-full wp-image-331\" \/><\/p>\n<p><a href=\"http:\/\/bitcows.com\/wp-content\/uploads\/2014\/08\/IMG_7434.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/bitcows.com\/wp-content\/uploads\/2014\/08\/IMG_7434.jpg\" alt=\"IMG_7434\" width=\"300\" height=\"300\" class=\"alignnone size-medium wp-image-332\" \/><\/a><\/p>\n<p><strong>Connecting the pins<\/strong><\/p>\n<pre class=\"prettyprint\">\nArduino Pins | Card Pins\npin 10       | 7           | CS \/ DAT2 \/ \npin 11       | 6           | DATA IN \/ CMD\npin 12       | 1           | DATA OUT \/ DAT0\npin 13       | 3           | CLK \/ SCK\n3.3v         | 4           | VDD \/ VCC \/ PWR\nGND          | 5           | VSS1 \/ GND\n-----------------------------------------\nGND          | 2           | GND\n<\/pre>\n<p>Card Pins Start 1-7, 1 being the side without the angle<\/p>\n<pre class=\"prettyprint\">#include &lt;pcmConfig.h&gt;\n#include &lt;pcmRF.h&gt;\n#include &lt;SD.h&gt;                      \/\/ need to include the SD library\n#define SD_ChipSelectPin 10          \/\/using digital pin 4 on arduino nano 328\n#include &lt;TMRpcm.h&gt;                  \/\/also need to include this library...\n\nTMRpcm tmrpcm;                       \/\/ create an object for use in this sketch\n\nvoid setup(){\n\n  tmrpcm.speakerPin = 9;             \/\/11 on Mega, 9 on Uno, Nano, etc\n\n  Serial.begin(9600);\n  if (!SD.begin(SD_ChipSelectPin)) { \/\/ see if the card is present and can be initialized:\n    Serial.println(\"SD fail\");  \n    return;   \/\/ don't do anything more if not\n  }else{\n    Serial.println(\"SD read\");\n    tmrpcm.play(\"someaudio.wav\");\n  }\n}\n\nvoid loop(){  \n\n}<\/pre>\n<p>Its important to note that you need to set up your audio files correctly.<br \/>\n&#8211; Sample Rate: 16000 kHz<br \/>\n&#8211; Bit Rate 8 bits per sample<br \/>\n&#8211; Mono<\/p>\n<p>The best way to do this I have found is to use iTunes.<br \/>\n<img decoding=\"async\" src=\"http:\/\/bitcows.com\/wp-content\/uploads\/2014\/08\/Screen-Shot-2014-08-25-at-4.51.25-PM.png\" alt=\"mp3 to wav itunes\" width=\"400\" class=\"alignnone size-full wp-image-339\" \/><\/p>\n<p>To learn more about how to read and write to the sd card <a href=\"http:\/\/arduino.cc\/en\/Tutorial\/ReadWrite\" target=\"_blank\" rel=\"noopener\">check out this artical<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Files needed to talk to the card to play music: https:\/\/github.com\/djmason9\/TMRpcm You will need to install these into the Arduino App. (See Import Library) for details Don&#8217;t have a break out board for the card reader? Make one! NOTE: only use 3.3V on this. Connecting the pins Arduino Pins | Card Pins pin 10 |&hellip;<\/p>\n<p class=\"more-link\"><a href=\"https:\/\/bitcows.com\/?p=325\" class=\"themebutton\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":332,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-325","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics"],"_links":{"self":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/posts\/325","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=325"}],"version-history":[{"count":0,"href":"https:\/\/bitcows.com\/index.php?rest_route=\/wp\/v2\/posts\/325\/revisions"}],"wp:attachment":[{"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=325"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=325"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bitcows.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}