Help using a 3.5 mm audio jack

Hello

I want to build a music player like the one in this instructable ( https://www.instructables.com/Music-Player-Using-Arduino/ )

Can anyone guide me on how to add a 3.5 mm audio jack to this so that the music could be played through wired headphones? A picture/diagram would be nice if possible.

Using an audio jack like this btw

Thanks!

you connect it where it says "speaker" and "ground"

1 Like

I don't want to upset you, but TMRpcm.h nano library can only play very simple computer sound files, consisting of beeps of different duration and frequency. You don't need headphones to listen them.

The Arduino Nano does not have enough resources to play real music files. To play music you need an esp32 based player like described in this tutorial ESP32 I2S Part 3 - Playing Wavs from SD Cards - XTronical

2 Likes

Thanks for your reply. What about using an arduino mega rather than nano?

Still no DAC (digital to analog converter) so no true-analog and the same low-quality sound. There are audio boards with an audio chip that includes a DAC and SD card slot, etc., and the Arduino simply acts as a controller. (There are limitations to these things too.... The Arduino can't read the files on the SD card, so it can' read the file names or metadata.)

You'll probably need a multimeter and a mating plug to figure-out the pinout. ...If you buy from a reputable supplier you'd get a link to the datasheet showing the pinout. :wink:

Here are the connections for the mating plug. (With the jack you have, you can't see the connections.)

Or, you can plug-in headphones and randomly connect a battery to figure what connections make a "click".

Since the player is mono you can connect left & right together.

You'll need a resistor in series. The "absolute maximum" current from an Arduino is 40mA. At 5V that works-out 125 Ohms (Ohms Law). That's the minimum load resistance. Headphone impedance varies but 30-60 Ohms is typical so a 120-Ohm (or more) resistor in series will keep it "safe". Two equal resistances/impedances in parallel are cut in half, so with 30-Ohm headphones and left & right connected together that's 15-Ohms.)

1 Like

I have seen that mp3 player shield, however I am not interested in paying $30 plus shipping xd. Can I get similar functionality to the mp3 player shield using the circuit in this picture that I have just found and adding a sd card reader? (like this one: https://www.amazon.com/HiLetgo-Adater-Interface-Conversion-Arduino/dp/B07BJ2P6X6/ref=sr_1_3?crid=YS2IJMV8LF8E&keywords=arduino+sd+card+reader&qid=1690949575&sprefix=arduino+sd+card+%2Caps%2C158&sr=8-3 )

9_mbedtutorial-00
source: mbed Starter Kit Experiment Guide - SparkFun Learn

sorry I get confused pretty easily when talking about this stuff I know very little about arduino and electronics in general

I think I have decided that I will take a different approach to my project, so I will not need to use an audio jack, but if anybody has an answer I'd still like to hear it :grinning:

Another way is to use an arduino compatible board with a i2s digital audio output, such as an ESP32 or a w806. In this case, the arduino turns into a audio player - you can read sound files from the SD card and send them to an external audio amplifier via an i2s channel - I gave an example of such a project in the post #4

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.