1

Pre-empting the fact that the Raspberry Pi Zero has no analogue headphone jack - has anybody managed to setup the audio such that a Piezo Speaker directly attached to a GPIO PWM pin would make a sound?

  • Actually the two answers are good: and I have in fact already directly connected the piezo speak to one a PWM pin - and wobbled it to make a simple square wave: my question is more - "Can we pipe the standard audio through this mechanism?" - whatever audio we play on the Pi - could this come out of the Piezo (I'm not after super audio here - just maybe getting a little voice to come out of the Piezo with espeak?) – monojohnny Dec 9 '15 at 22:02
2

Adding to @joan's answer, if you're looking for a proven circuit, why not just look at the Pi B, Rev 2.1 for something the designers at the Raspberrypi Foundation figured to work? Refer to page two, right left corner for the circuit in question, and take the values of resistors and capacitances for the low-pass filter.

1

Why not try and see?

I've just connected GPIO 18 and ground to a headphone jack and I can hear a tone when I send PWM pulses.

I have no idea if what I've done can damage the Pi. Why not check for circuits on line?

  • So actually: I mean sort-of the other way round: on a Pi B+ (say), so instead of setting (say) a simple square-wave on the PWM pin, which also results in the sound coming out of the analogue out; can the audio system playing an MP3, voice-synthesizer etc come 'out' of the GPIO pin in PWM-encoded form ? – monojohnny Dec 9 '15 at 22:05
  • Yes, the PWM channels 0 and 1 create the left and right audio channels. They are piped to the audio jack and to any GPIO set to PWM mode (only GPIO 12/13/18/19 can be set to PWM mode). – joan Dec 9 '15 at 22:18
  • I'll give this another go when I get chance - thanks ! – monojohnny Dec 9 '15 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.