Uncategorized

buzzer no sound

Asked 
Active today
Viewed 12 times
0

I’m trying to light up an LED and play a buzzer noise at the same time. Here is my code so far:

Import RPi.GPIO as GPIO
Import time

GPIO.setmode(GPIO.BCM)

GPIO.setup(7, GPIO.OUT)

while True:
    GPIO.output(7, 1)
    time.sleep(2)
    GPIO.output(7,0)
    time.sleep(2)

GPIO.cleanup()

and here is how my RBp is connected:

https://imgur.com/a/zjusD5X

The LED lights up as expected but all I’m getting from the piezo is a very short static noise as if it’s getting electricity. But no sustaining noise.

I don’t think theres anything wrong with the code as I’ve seen multiple examples online that are basically identical and work with no issues. The buzzer I’m using is from the arduino starter kit if thats any help.

If anyone can help me figure out why it’s not working that would be very appreciated!

 New contributor

0

Question


/ to continue, …

Answer

Well, it is the same old story of:

“How come the relay/buzzer/xyx, … works in her good old Arduino but not in my poor new Rpi?

Now the bad Arduino guys are LOL at me. Other similarly miserable Rpi newbies are also weeping in the dark.

And it is the same old reason:

The reason is that those Arduino devices are designed to start/work/active/trigger at Low level signal, and stop/rest/nonactive/disable/untrigger at Arduino Hig Level Signal of > 4V.

Rpi is a weak guy and its High level signal is only around 3.2V. So the reason is “Poor Rpi’s Low level signal is OK, but High level signal is not as high as the strong Arduino and therefore device refuses to respond.

See my long answer to a similar question for more details:

Active Buzzer makes sound on both LOW and HIGH – @hbo rpi.stackexchange, 2019apr27


/ to continue, …

References


/ to continue, …

Appendices

Appendix A – Buzzer Spec

buzzer spec


Appendix B – Buzzer Schematic

buzzer schematic


/ to continue, …


End of Answer

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: