Playing music in Arduino using SD Card Module

in utopian-io •  7 years ago  (edited)

micro-sdtf-sdhc-spi-memory-module.jpg
Image Source

The SD Card Module is used for transferring data to and from the memory card. It allows for mass storage that we can be used in our project especially in data logging. And this tutorial aims to play audio files with your Arduino in decent quality from SD card.

What Will I Learn?

  • How to use SD Card module
  • Playing music with the use of Arduino

Requirements

  • Arduino Uno
  • SD Card Module
  • SD Card
  • Speaker
  • Connecting Wires

Difficulty

  • Basic

Tutorial Contents

Step 1: Physical Connection from SD Card Module to Arduino Uno

Untitled Sketch_bb.jpg
Connect the following:

  • VCC to 5V of Arduino Uno
  • GND to GND of Arduino Uno
  • CS to pin 4 of Arduino Uno
  • SCK to pin 13 of Arduino Uno
  • MOSI to pin 11 of Arduino Uno
  • MISO to pin 12 of Arduino Uno
  • the 5V of speaker to pin 9 of Arduino Uno
  • GND of speaker to GND of Arduino Uno

Step 2: Software Connection

  • Connect the USB Cable to a PC/Laptop
  • Open your Arduino IDE, change your board to Arduino Uno: Go to Tools > Board: > Arduino/Genuino Uno
    1.png
  • And also, change the Port settings: Go to Tools > Port: > COM6 (Arduino/ Genuino Uno)
    2.png
  • Then, download the library TMRpcm for asynchronous playback of PCM/WAV files direct from SD card. After downloading, extract the file and copy the folder then Go to your Program Files and find the Arduino Folder > libraries then paste the folder of TMCprm.

Step 3: Converting Audio to WAV

Change the bit resolution to 8 bit, sampling rate to 16000Hz, audio channels to mono. And in advanced options choose the PCM unsigned 8-bit then, convert the file. This will allow the arduino to play the audio file.

Step 4: The Code

  • Copy the code then compile and run.
    Capture.PNG

My Circuit:

26803235_1801848566493586_1051833694_n.jpg

Tip to remember: Before saving an audio file to the SD Card make sure it is WAV formatted because Arduino can only read a PCM signal which the WAV format has.

Thanks for reading! Hope you learn something.



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for the contribution. It has been approved.

  • Please make Sure that you add the codes in the code blocks and the codes shouldn’t only be in the image. (Soft Rule)
    You can contact us on Discord.
    [utopian-moderator]

okay sir thank you 🙂

your page is very successful indeed happy to come back to me

Hey @kimp0gi I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • This is your first accepted contribution here in Utopian. Welcome!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

5 lang ako ani. Hahahha congrats

hahaha wohoo!