Talking Arduino | Playing a MP3 With Arduino Without Any Module | Playing Mp3 File From Arduino Using PCM

Introduction: Talking Arduino | Playing a MP3 With Arduino Without Any Module | Playing Mp3 File From Arduino Using PCM

About: I am an engineering student and i just love doing electronic (mcu's) and programming (C,C++,JAVA) based projects.

In this instructables we will learn how to play a mp3 file with arduino without using any audio module, here we gonna use PCM library for Arduino which plays 16 bit PCM of 8kHZ frequency so lets do this.

Step 1: Gather Your Components

BUY PARTS:

BUY TIP120:

https://www.utsource.net/itm/p/384328.html

BUY 12V ADAPTER:

https://www.utsource.net/itm/p/8013134.html

BUY ARDUINO UNO:

https://www.utsource.net/itm/p/7199843.html


//////////////////////////////////////////////////////

so in order to do this we need a few components very firat An Arduino & then a speaker 0.5w to 10 w any speaker will do the job then you need to buy a transistor for amplification if your speaker is higher than 0.5w as mine was 3 w so i used a TIP 120 transistor dor amplifying the audio you can use any audio amplifier too.

Buying links. -

Items to Buy (affiliate link) -

Arduino Uno-

https://www.banggood.com/UNO-R3-ATmega16U2-AVR-Mod...

Speaker -

https://www.banggood.com/2-Pcs-3-Inch-4-10W-Full-R...

https://www.banggood.com/50MM-0_5W-Customized-50mm...

https://www.banggood.com/3-Pair-4-Ohm-3W-LCD-Panel...

TIP 120 transistor -

https://www.banggood.com/10pcs-TIP120-NPN-TO-220-D...

https://www.banggood.com/30pcs-TIP120-NPN-TO-220-D...

https://www.banggood.com/50pcs-TIP120-NPN-TO-220-D...

Step 2: Connections

The connections are really simple if you are using 0.5watt speaker then directly connect the +ve pin of speaker to digital pin 11 on Arduino & -ve pin of speaker to gnd & if using 3 watt speaker then use a tip120 transistor & connect the 11 of Arduino to the base of transistor and -ve pin of speaker to the collector of the transistor & emitter of the transistor to the gnd pin on Arduino.

IIf having issues with connection refer video for help.

Step 3: Download Required Files

To do this you will need few files first of all PCM.zip file to play PCM audio from arduino.

ThEN we will need Audacity software to convert a normal mp3 audio to a 16bit PCM 8hkz audio

& Lastly we need a encoder software to encode that audio into data which we can paste in the code.

DOWNLOAD Audacity -

https://www.audacityteam.org/download/

Download PCM.ZIP & Encoder software (file named as Arduino MP3.zip) -

https://drive.google.com/file/d/1LSb-nZcecs1VISQDP...

Step 4: Prepare Audio & Convert It Into Data

the important step is to prepare the audio data.so very first we will need a mp3 file either you record one or get one from anywhere then open that file into Audacity and & click on format then select 16 bit pcm then go down & select frequency of audio to 8000hz & export the audio as mp3.

Then open encode audio software & navigate to the audio file we generated froma audacity then you'll get a message audio copied to clipboard successfully.

Step 5: Coding Part

so the next part is coding part , so as you downloaded the the Arduin mp3.zip file which contains PCM.zip file so add this PCM.zip file as a library to the arduino & then open the playback example available in the that PCM library , & there in the sketch you have to edit the 2nd line of code in sample[] arrray which is of programem type you need to remove all the data in that aray & paste the data which is copied to the clipboard by the encode audio software.

Step 6: Upload the Code

so finally our code is ready so upload it to the arduino & you'll hear your recorded audio from speaker , enjoy it & if you have any issues or want to about this in deep just refer the video provided.

Thank you.

Microcontroller Contest

Participated in the
Microcontroller Contest

Be the First to Share

    Recommendations

    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge

    22 Discussions

    1
    indrajati57
    indrajati57

    4 months ago on Step 6

    Dear Sir
    How about if I need to apply this on my car as notification whether I STOP, REVERSE, TURNING to the right/left or HAZARD? I am totally blind for the technology. When I found this project of your, my heart say "this is amazing". I wish you would be kind to help me.

    0
    Sanjeev8858
    Sanjeev8858

    6 months ago

    the volume of speaker is very slow how to increase it sir ,,

    0
    Random Creations
    Random Creations

    Tip 7 months ago

    For Those: If you are facing error "Java 2 Runtime Environment couldn't found"
    Simply go to control panel and uninstall extra java runtime environment just keep one.
    My error is gone now so this is my tip.

    0
    Random Creations
    Random Creations

    Question 7 months ago

    Could not found :Java 2 runtime environment error pls help

    0
    Random Creations
    Random Creations

    Question 7 months ago

    Could not found :Java 2 runtime environment error pls help

    0
    drabinowitz1
    drabinowitz1

    Question 7 months ago

    Hello,

    How can I adjust this to work on an Arduino Leonardo? This code will only compile for an Uno.

    1
    DaniloB1
    DaniloB1

    7 months ago

    how come I didn't see this project before? ... You changed my arduino projects forever ... Thank you very much for sharing .... Regards from Costa Rica...

    1
    Sanjeev8858
    Sanjeev8858

    11 months ago on Step 6

    I cant install the encoder software on my PC ...please help me to intall it

    0
    ThorWallhall
    ThorWallhall

    1 year ago

    hello, i followed the steps way down but i can´t open the encoder.exe. I receive an Error that Java can not be open...
    so what do went wrong?

    0
    apjarunprasath
    apjarunprasath

    Question 1 year ago on Introduction

    Your encoder was crashed! System can't install your file what should i do?

    0
    Grumpy Mike
    Grumpy Mike

    1 year ago

    Why have you no resistor in the base of the transistor? As you have it you are drawing too much current from the Arduino pin and it is being damaged. Eventually this pin will fail and will not work anymore. It will not instantly stop working but over time it will.

    0
    TalariK
    TalariK

    1 year ago on Step 6

    I didn't open the encode audio.exe file.
    It shows an error javaw.exe were not found ,how I encode audio..?

    0
    ramesh.noothi
    ramesh.noothi

    Question 1 year ago on Step 5

    Hi ,
    I am fallowing all your steps and I have generated the custom encoded data and pasted in the array.
    But I am not getting the audio out put due to that new data.

    i want to play the sound like "OUMM".

    PLEASE HELP ME TO GET THE OUTPUT.

    0
    Gish0414X
    Gish0414X

    1 year ago

    can you please give instructions to connect a pot

    1
    Gish0414X
    Gish0414X

    1 year ago

    how do i control volume?

    nice work!!! what difference is if i use arduino mega 2560? because dont work

    0
    CorbinM6
    CorbinM6

    Question 1 year ago

    trying to hook up with a mega 2560 what hz does the tone need to be when i convert it and also i got it working basic with an uno. using more code like sensors and motors i couldn't get the speaker to work please help :)