element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Open Arduino
  • Challenges & Projects
  • Project14
  • Open Arduino
  • More
  • Cancel
Open Arduino
Blog Arduino SD Card Audio Player & LM386 Audio Amplifier board
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Open Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: gam3t3ch
  • Date Created: 14 Apr 2018 7:23 PM Date Created
  • Views 8964 views
  • Likes 14 likes
  • Comments 5 comments
  • openarduinoch
Related
Recommended

Arduino SD Card Audio Player & LM386 Audio Amplifier board

gam3t3ch
gam3t3ch
14 Apr 2018

 

So I had a project in mind for a while I love working with lm386 chips and working on making better audio with it so I decided the best route to do that was to make a custom arduino audio player that I could connect my lm386 audio boards to it and be able trouble shoot design and test with it.  Having this available to test was a awesome making the SD Card player to test out my boards so I can incorporate them into further projects and assure they are working 100% before doing so.  Now why would I do that when the kids are really cheap?  Well because its fun and great for learning and teaching about electronics.  So I have decided to use this as my main prototyping setup for it and will add some features here and there as I get parts in so that I can fully use it to my advantage.  The Arduino is a wonderful tool to help with prototyping and designing with ease.  I certainly wouldn't have thought I would have gotten into them so much.  But I have, and grateful for being able to design and implement things quickly with it versus having to go other routes.  Plus if I blow a arduino its not going to be the end of the world instead of a expensive board that I might not be able to replace quickly.

 

So I started with making the SD Card Reader / uploading the player to the arduino.  (I decided to use the pinout and files from Bitcows | DIY SD Card Reader and audio player for Arduino UNO )

Files needed to talk to the card to play music:  https://github.com/djmason9/TMRpcm

You will have to add this to your arduino library.

 

Connecting the pins as taken from the site there:

Arduino Pins | Card Pins
pin
10          | 7  | CS / DAT2 /
pin
11          | 6  | DATA IN / CMD
pin
12          | 1  | DATA OUT / DAT0
pin
13          | 3  | CLK / SCK
3.3v            | 4  | VDD / VCC / PWR
GND           
| 5  | VSS1 / GND
-----------------------------------------
GND           
| 2  | GND

 

Uploading the code for the arduino is as follows once again you can either follow along here or on the website to create this.

#include <pcmConfig.h>
#include <pcmRF.h>
#include <SD.h>   // need to include the SD library
#define SD_ChipSelectPin 10   //using digital pin 4 on arduino nano 328
#include <TMRpcm.h>   //also need to include this library...

TMRpcm tmrpcm;   // create an object for use in this sketch

void setup(){

  tmrpcm
.speakerPin = 9;   //11 on Mega, 9 on Uno, Nano, etc

 
Serial.begin(9600);
 
if (!SD.begin(SD_ChipSelectPin)) { // see if the card is present and can be initialized:
  
Serial.println("SD fail"); 
  
return;   // don't do anything more if not
 
}else{
  
Serial.println("SD read");
  tmrpcm
.play("someaudio.wav");
 
}
}

void loop(){ 

}

 

 

imageimageimage

 

I used pin 9 on the board to output the audio file to the lm386 audio board, not sure if other pins would be more ideal but haven't tested this further.  I mounted it to the right hand side of the arduino so I would be able to solder and test and diagnose any issues I may have with out covering up the sd card area.  So now with my LM386 audio board on I had to wire it up I think I will make connector posts on the SD Card board after might be a better route as well a add a more suitable speaker setup for portability.  I used a 3.5mm headphone jack to output to my speaker. (I will be adding an on board output for the speaker at some point as well.)

 

Now that its setup and working I am excited to continue to design and create more lm386 audio amplifiers in the future.  I think they did a great job on making the files and program for arduino and it was by far the best I had seen for a tutorial to get going.

 

For creating my wave files I used

https://www.online-convert.com/result/104d5cd3-3416-45b8-a470-3265bbe7eedb

 

Which was a great help getting my test files made.

 

audio files need to be: Sample Rate: 16000 kHz, Bit Rate 8 bits per sample, Mono

 

I also used the https://lingojam.com/StephenHawkingVoiceGenerator    For creating my initial wave file after converting it to the right format with the online convert  which then transferred over on to my FAT 2gb MicroSD card I was good to go to test out my board.

 

Now I just want to state I made this for making lm386 audio boards so I could have bought another shield for the arduino that had that but wasn't the route I wanted to go I wanted to keep it so everything was as cheap as possible and made by me.  If Something goes wrong it wont be hard to figure out what the issue is.  Plus making it vs buying it is always fun.

 

I know for this project I used other peoples work but really when it came down to it this was the first time I had done this and would certainly like to learn more of the software end of it after as well as possible redesigns of the sd card board to house more things that might have more use to me for testing and procedure.

 

Thanks for checking it out its nothing amazing but was fun to build.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

  • Sign in to reply

Top Comments

  • shabaz
    shabaz over 7 years ago +3
    This is really great. I had not realized the Uno could be sufficient to read the SD card and generate the audio stream. Very impressive : )
  • mcb1
    mcb1 over 7 years ago +2
    I was asked to add sounds to the retirement project Retirement Present and it was too hard inside the Arduino. Your links and SD card trick would solve that if I needed to repeat the exercise, so thanks…
  • balearicdynamics
    balearicdynamics over 7 years ago +2
    My compliments! You have opened my eyes to a great possibility I think I will use very soon Enrico
Parents
  • shabaz
    shabaz over 7 years ago

    This is really great. I had not realized the Uno could be sufficient to read the SD card and generate the audio stream.

    Very impressive : )

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • shabaz
    shabaz over 7 years ago

    This is really great. I had not realized the Uno could be sufficient to read the SD card and generate the audio stream.

    Very impressive : )

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube