Project showcase
Speaker with Arduino and Micro SD

Speaker with Arduino and Micro SD © MIT

This trick teaches you how to use Micro SD/SD card for Arduino and speaker.

  • 4,835 views
  • 0 comments
  • 11 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
arduino uno(only)
×1
10722 01
Speaker: 0.25W, 8 ohms
speaker 8 ohm
×1
826 04
Male/Female Jumper Wires
male//female
×6
MicroSD Module (Generic)
micro sd card module
×1

Necessary tools and machines

Hy gluegun
Hot glue gun (generic)

Apps and online services

Ide web
Arduino IDE
ide arduino

About this project

Code

socure codeArduino
#include <SD.h>                           //include SD module library
#include <TMRpcm.h>                       //include speaker control library

#define SD_ChipSelectPin 4                //define CS pin

TMRpcm tmrpcm;                            //crete an object for speaker library

void setup(){
  
  tmrpcm.speakerPin = 9;                  //define speaker pin. 
                                          //you must use pin 9 of the Arduino Uno and Nano
                                          //the library is using this pin
  
  if (!SD.begin(SD_ChipSelectPin)) {      //see if the card is present and can be initialized
    
    return;                               //don't do anything more if not
  }
  
  tmrpcm.setVolume(6);                    //0 to 7. Set volume level
  tmrpcm.play("1.wav");         //the sound file "1" will play each time the arduino powers up, or is reset
}

void loop(){}

Schematics

scematic
speaker_micro_sd_yrLF3WSb5a.fzz

Comments

Similar projects you might like

DIY Shock Sensor with a Speaker

Project tutorial by millerman4487

  • 868 views
  • 0 comments
  • 10 respects

SD Card Temperature Data Logger

Project tutorial by 3 developers

  • 8,228 views
  • 0 comments
  • 8 respects

SD Card Doorbell

Project tutorial by Projecter

  • 1,971 views
  • 0 comments
  • 7 respects

Micro Soldering Station

Project tutorial by Paulo Bruckmann

  • 15,262 views
  • 13 comments
  • 47 respects

Programming Nextion LCD Without SD Card

by Tamer Savaşcı

  • 12,036 views
  • 5 comments
  • 5 respects
Add projectSign up / Login