2

I am looking to buy a Raspberry Pi Zero for my retro gaming project. I am asking wherher the Raspberry Pi Zero has any built-in internal audio speaker in the chip itself or not?

If there isn't, is there any way to make the chip give out a BEEP-sound without any additional components. Like for example raising the clock rate of the CPU until it gives out audible noises?

  • 1
    No, and no. You need external components. – joan Feb 24 '17 at 2:40
2

There's no particularly good way to make the board as-delivered make sound. Audio by default goes out over HDMI (which is the best option IMO).

You can pop a relatively simple lowpass filter and amp on the alternate function of two GPIO pins for PWM (cheap and not horrible audio). I did a project like that for a little gag gift I have a co-worker last year. See adafruit's site for details.

Alternatively, you could hook up an I2S codec or just use a low-end USB speaker with built-in codec.. You might even be able to jam the zero into the speaker chassis itself if the dimensions are right :-)

1

For simple beeps, I use the pigpio library. This library enables hardware-timed PWM on all GPIO. The only drawback (a minor one imo) is that it requires you to load a daemon before calling the library. Just connect a piezo beeper between the slected GPIO pin and ground.

import pigpio
from time import sleep

pig = pigpio.pi()
BEEPER = 25 # GPIO pin for the beeper (can be any GPIO 0 - 31)

def beep(freq,ms): # generate a beep at the specified frequency and length (in milliseconds)
    pig.set_PWM_dutycycle(BEEPER,50)
    pig.set_PWM_frequency(BEEPER,freq)
    sleep(ms/1000.0)
    pig.set_PWM_frequency(BEEPER,0)
    pig.set_PWM_dutycycle(BEEPER,0)

beep(1004,250) # quarter second of 1004Hz tone
0

Basically no, you either need a buzzer for simple BEEP stuff hooked to one of the GPIO or using HDMI adaptor that contain an audio jack. for more complex, a bit permanent solution you can build one of pwm based audio like what Bj Black already mention

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.