Page 1 of 1

howto: Control passive buzzer

Posted: Wed Jan 16, 2019 10:28 pm
by roost
Hello,

I am quite new to Micropython and i can't figure out how to control a passive buzzer (https://www.aliexpress.com/item/GREATZT ... f4ece250eb) from Micropython.

I found out the PWM class, but this only supports up to 1khz.
On arduino i can just use the tone() library.

My question is, how can i get this to work in Micropython?

Thanks!

Re: howto: Control passive buzzer

Posted: Thu Jan 17, 2019 4:32 pm
by philwilkinson40
PWM. This tutorial should give you a helping hand if you have an esp board. Esp boards do have a lower frequency limit, if you need higher try the pyboard.
https://micropython-on-wemos-d1-mini.re ... ml#beepers

Re: howto: Control passive buzzer

Posted: Thu Jan 17, 2019 5:36 pm
by dhylands
This post has a link to some code I put together that works on the pyboard: viewtopic.php?f=14&t=2172&p=12291

Re: howto: Control passive buzzer

Posted: Mon Jan 21, 2019 11:25 am
by roost
Thanks for the answers!

It is working now. I am using a esp8266 btw, so not a pyboard.

The example on https://micropython-on-wemos-d1-mini.re ... ml#beepers is working. But there is one problem. If i set the beeper.freq to 0, there is a clicking sound. How can i fix this?