Difference: BuzzerShield (1 vs. 2)

Revision 22019-04-05 - UliRaich

Line: 1 to 1
 
META TOPICPARENT name="WeMosD1Mini"

The Buzzer shield

Added:
>
>

The Hardware

 
Changed:
<
<
The buzzer shield implements a passive buzzer with frequencies of 1 kHz - 3 kHz. By default it uses data line D5 corresponding to GPIO 14 but can be configured to a different GPIO line.
>
>
The buzzer shield implements a passive buzzer with frequencies up to 1 kHz - 3 kHz. By default it uses data line D5 corresponding to GPIO 14 but can be configured to a different GPIO line.
  wemosBuzzer.png
Added:
>
>
In order to make the device work a solder bridge for the data line must be installed ( see the 4 double solder blobs on the left hand side of the module. One of these pairs of blobs must be connected).

The software

The buzzer needs a frequency passed to it through a GPIO line (by default the upper solder pair blobs connected corresponding to D5 or GPIO 14. To test the device I wrote a very simple micro Python script sending a 500 Hz square wave to it. This can easily be done through the micro Python PWM class.

Here is the code:

https://afnog.iotworkshop.africa/pub/AFNOG/BuzzerShield/firstTest.py.txt

Dave Hylands has written some micro Python buzzer scripts to play ringtone melodies defined in the RTTTL (Ring Tone Text Transfer Language). These scripts are written for the PyBoard and must be modified to run on the WeMos D1 mini which use the ESP8266 CPU. I found another problem in the ESp8266 PWM driver code for micro Python, limiting the maximum frequency to 1 Khz, too low to play the tunes correctly. It turns out however that the driver can run at frequencies up to ~ 2 kHz and simply modifying the limit to 2 kHz solved the problem. Of course micro Python must be recompiled and re-flashed to enable these higher frequencies.

And here are the scripts playing the ringtones: esp8266Buzzer is the main program relying on the RTTTL class defined in rtttl.py and the songs on RTTTL format defined in songs.py:

https://afnog.iotworkshop.africa/pub/AFNOG/BuzzerShield/esp8266Buzzer.py.txt

https://afnog.iotworkshop.africa/pub/AFNOG/BuzzerShield/rtttl.py.txt

https://afnog.iotworkshop.africa/pub/AFNOG/BuzzerShield/songs.py.txt

 -- Uli Raich - 2019-03-22

Comments

Line: 13 to 33
 
<--/commentPlugin-->

META FILEATTACHMENT attachment="wemosBuzzer.png" attr="" comment="" date="1553264141" name="wemosBuzzer.png" path="wemosBuzzer.png" size="103518" user="UliRaich" version="1"
Added:
>
>
META FILEATTACHMENT attachment="esp8266Buzzer.py.txt" attr="" comment="" date="1554476707" name="esp8266Buzzer.py.txt" path="esp8266Buzzer.py.txt" size="701" user="UliRaich" version="1"
META FILEATTACHMENT attachment="rtttl.py.txt" attr="" comment="" date="1554476707" name="rtttl.py.txt" path="rtttl.py.txt" size="3884" user="UliRaich" version="1"
META FILEATTACHMENT attachment="songs.py.txt" attr="" comment="" date="1554476707" name="songs.py.txt" path="songs.py.txt" size="6348" user="UliRaich" version="1"
META FILEATTACHMENT attachment="firstTest.py.txt" attr="" comment="" date="1554476707" name="firstTest.py.txt" path="firstTest.py.txt" size="164" user="UliRaich" version="1"

Revision 12019-03-22 - UliRaich

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="WeMosD1Mini"

The Buzzer shield

The buzzer shield implements a passive buzzer with frequencies of 1 kHz - 3 kHz. By default it uses data line D5 corresponding to GPIO 14 but can be configured to a different GPIO line.

wemosBuzzer.png

-- Uli Raich - 2019-03-22

Comments

<--/commentPlugin-->

META FILEATTACHMENT attachment="wemosBuzzer.png" attr="" comment="" date="1553264141" name="wemosBuzzer.png" path="wemosBuzzer.png" size="103518" user="UliRaich" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback