Hi!
I'm currently working on an arduino project that reads music from an SD card and outputs that music to an aux cord that leads into a speaker with an aux input.
Thats the general idea, but after researching on the web I haven't found a proper tutorial or explanation on how an arduino can output sound via an aux cord.
Can someone help me with that? Thanks in advance.
Goldixan:
after researching on the web I haven't found a proper tutorial or explanation on how an arduino can output sound via an aux cord.
There's a good reason for that: most Arduinos use an 8-bit microcontroller, they were never designed to play music, they lack the necessary hardware.
Either get a dedicated chip/module to play sounds (e.g. DFPlayer), or get a more powerful microcontroller that has more RAM, DMA and an I²S interface or built-in DAC. Most Teensy boards have this, and they can play audio clips from an SD card.
Pieter
I assume you're using the TMRpcm library? And, I'm assuming an Aux input means you have a powered speaker? Add a series capacitor (to block the DC component) and a volume-control pot, and it should "work". (The amplifier may already have both, but if you don't have a schematic you can't be sure about the capacitor.)
But, the Arduino doesn't really put-out PCM (or analog). It puts-out PWM which is a 5V high-frequency signal. That can be "hard" on an amplifier. There is chance of burning-up the amplifier or it may make nasty noises, or just "sound bad", etc. Or, if the amplifier is powerful enough you might fry a tweeter. I would NOT connect it to my stereo system or anything that I really care about... You can filter the PWM to get analog (at least in theory) but I don't think a simple RC filter will help that much.