Hello I am using Arduino C to program my microcontroller to output frequencies via tone(); to a piezo buzzer. Currently the frequency(s) is/are chosen with a potentiometer. I would like to ditch the piezo buzzer and instead output the frequency to a 3.5mm headphone jack, where either headphones can be plugged in or a mono auxiliary cord, with a pair of desktop speakers on the other end. What is the best and most efficient way to do this as far as coding/translating the frequency to be output over the 3.5mm jack?
update : so for my 3.5mm audio jack, i have the 10k ohm resistor inline with the ground connection and then one pin running to positive lead and the other pin running to digital pin 4 on my arduino. I have tried testing multiple frequencies on a pair of desktop speakers with a subwoofer, and comparing them to an actual tone generator app i have on my phone. my prototype seems to emit more of a noisy/fuzzy sound compared to the tone generator app which seems to be a lot more crisp/clean. Also frequencies under 100 Hz arent playing what they should sound like, however the app outputs frequencies under 100 Hz just fine. My three questions are: 1. How can I get to output to be as close as possible to the actual frequency? 2. How can i get the output to be crisp and clean, not noisy and fuzzy? 3. Is there something i'm missing/any ideas how to make the frequencies go below 100 Hz?
i know theres 5 pins on the 3.5mm audio jack but im only using 3, could this be an issue?
please feel free to ask any questions, i can also upload pictures as needed.
It's exactly the same thing- just send the square wave through the audio jack. Assuming your speakers have their own amplifier (which most desktop speakers do), you should just put a 10k resistor on the output line. Just hook up the pin and ground to the jack and you should be fine.