Hi All,
I have been experimenting with outputting sound directly from my arduino using PWM. I am able to play an 8000 hz sound to an earbud headphone by connecting the 2.5mm socket directly to the ground and the output pin.
What I would like to do is output +- 2.5v rather than 0 - 5v as I understand this will drive the headphones (or a speaker) as they are intended to be driven. My understanding is that the speaker will only oscillate through half of it's travel if I use only positive voltages. (Am I being pedantic about this?)
I tried a simple voltage divider for the earth to turn the 5v supply into a 2.5v supply but it reduced the volume of the headphones significantly. I can only assume it is because my resistors were too large. I am concerned that if I put small resistors in the voltage divider I will waste power. (Not sure if this is a valid concern). Sadly I also managed to blow up my arduino during these experiments. I am currently waiting on an ISP to load a bootloader on a new chip. How can I protect my arduino from this while experimenting. Would a series of diodes on the output pins stop negative voltage? Is there a way to limit voltage/ current getting back to the arduino without significant tradeoffs?
I was considering the use of an operational amplifier to both boost the signal and bias it around 0v but it seems that the gain of Op amps is typically very high which would be excessive for my needs.
I guess I am trying to work out what the ideal circuit to drive headphones or a speaker would be. At the very least, what components should it contain?
Kind Regards,
Ben