wokwi / wokwi-elements

Web Components for Electronics and IoT Parts
https://elements.wokwi.com/
MIT License
185 stars 50 forks source link

Add piezo electric buzzer #24

Closed gfeun closed 4 years ago

gfeun commented 4 years ago

urish commented 4 years ago

Thanks @gfeun! How does this buzzer works? It seems like it has a small MOSFET, and I guess that the resistor is connected to the gate of the mosfet?

gfeun commented 4 years ago

I don't know the implementation details. The physical principal is really simple and you may already know it. It uses the piezo electric property of a material which vibrates when current is applied to it. So when you apply an electric signal with a given frequency to it, it results in a sound of corresponding frequency.

We have a practical course where we teach students how to generate a signal of a given frequency using timers and apply it to a buzzer. We then ask the students to create a small piano using our 8 push buttons generating signals of different frequencies (resulting in different sounds).

I'd like to make this possible to implement using avr8js. Luckily you have already done most of the work as I've seen here :smile:

urish commented 4 years ago

And now it's even being used! 🔊

https://wokwi.com/playground/spaceship-game