<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>BLE Nano/Nordic SDK: making a quick buzz from a piezo speaker</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/19677/ble-nano-nordic-sdk-making-a-quick-buzz-from-a-piezo-speaker</link><description>I am working on a project using a ble nano (nrf51822) using the Nordic SDK 8.1. I started building off the ble-app-hrs in the examples of the documentation so my code is pretty similar to the example. 
What I am trying to do is to have a piezo speaker</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 17 Feb 2017 11:13:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/19677/ble-nano-nordic-sdk-making-a-quick-buzz-from-a-piezo-speaker" /><item><title>RE: BLE Nano/Nordic SDK: making a quick buzz from a piezo speaker</title><link>https://devzone.nordicsemi.com/thread/76538?ContentTypeID=1</link><pubDate>Fri, 17 Feb 2017 11:13:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca8986ea-dcc3-4d31-a89c-a7884d80e67a</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;The period = 1/frequency, so for 500 hz, period = 1/500 = 0.002 s = 2000 us&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;APP_PWM_DEFAULT_CONFIG_1CH(2000L,pin number)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For 300 Hz you need to set the period to 3333L.
I think you should be able to drive the buzzer with 3.3V/5V, but you may not get the maximum volume possible. You could also consider using a transistor, see &lt;a href="https://devzone.nordicsemi.com/question/58420/how-to-increase-the-buzzer-loudness/"&gt;this&lt;/a&gt; thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Nano/Nordic SDK: making a quick buzz from a piezo speaker</title><link>https://devzone.nordicsemi.com/thread/76537?ContentTypeID=1</link><pubDate>Thu, 16 Feb 2017 17:20:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9af5b58b-e176-4070-bd13-50b5a84df042</guid><dc:creator>tyler</dc:creator><description>&lt;p&gt;@sigurd Alright I couldn&amp;#39;t find the data sheet, but on the website I found the following info: &amp;quot;This 75dB Piezo electric buzzer operates on 6VDC, carrying a maximum 45mA current with a tame buzzer tone rating of 300-500Hz.&amp;quot;.   I assume that means that the frequency is between 300 and 500 hz.  What values would I pass to APP_PWM_DEFAULT_CONFIG_1CH() to set this frequency?    Also is it a problem if I am using a 6v buzzer with a 5v micro controller?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Nano/Nordic SDK: making a quick buzz from a piezo speaker</title><link>https://devzone.nordicsemi.com/thread/76536?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 14:47:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aeaa2ae7-082d-4c15-9bdd-84bcc70a8f56</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;You can set the duty cycle with the &lt;code&gt;app_pwm_channel_duty_set()&lt;/code&gt; function, and the period/frequency with the &lt;code&gt;APP_PWM_DEFAULT_CONFIG_1CH()&lt;/code&gt;/&lt;code&gt;APP_PWM_DEFAULT_CONFIG_2CH()&lt;/code&gt; function. You can vary the volume of the sound by modifying the duty cycle. 0% will produce no sounds, 50% will be the max volume. Between 50% and 100% is the same as between 0% and 50%. Different frequencies will give you different tones.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Nano/Nordic SDK: making a quick buzz from a piezo speaker</title><link>https://devzone.nordicsemi.com/thread/76535?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 14:01:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff3287d2-300f-4fff-8b3e-b6eb8c5adb0f</guid><dc:creator>tyler</dc:creator><description>&lt;p&gt;@sigurd Yes I was looking at the example in \examples\peripheral\pwm.  It doesn&amp;#39;t do a good job of explaining what each variable does though.  Like it doesn&amp;#39;t have a variable set for the duty cycle or frequency which I need to know how to set. .....   The peripheral\pwm is actually the example I was previously using when I was having problems..... I think I may have used a pin without PWM but I&amp;#39;m not sure (how do I check if the pin has PWM ability).  All I know is that I went in and changed the &amp;#39;value&amp;#39; variable and the tone and volume of the buzzer was not impacted.  How can I go about fixing this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Nano/Nordic SDK: making a quick buzz from a piezo speaker</title><link>https://devzone.nordicsemi.com/thread/76533?ContentTypeID=1</link><pubDate>Wed, 15 Feb 2017 13:11:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0785406d-cce2-4961-b3c1-817085bc7ffb</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;The advantage of using the PWM library is that you get more precise timing on the period the signal is high/low, and therefore get a more stable frequency. The PWM library takes care of all the timing in order to produce a stable frequency. I suspected that this is the reason you get that “awful screeching sound” when not using PWM, and that you are using a frequency that is not resonating well with your buzzer. If you take a look in the buzzer datasheet, the resonance frequency should be listed. If you change the PWM frequency, the tone will change. There is a PWM example in the SDK, have you looked at that?: &lt;code&gt;SDK_folder\examples\peripheral\pwm&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Nano/Nordic SDK: making a quick buzz from a piezo speaker</title><link>https://devzone.nordicsemi.com/thread/76532?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2017 20:32:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:019221df-1788-4dfe-b623-5331026025ea</guid><dc:creator>tyler</dc:creator><description>&lt;p&gt;@sigurd What is the advantage to using PWM?  I tried using it but was unable to get it to work.  What was happening was I would change the variables for the PWM and the tone wouldn&amp;#39;t be effected at all.  Since the behavior was the same as just using a normal write to the gpio and just setting the gpio to high or low was easier I removed the pwm.  Do you have a good guide or explanation for how I can get PWM working?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: BLE Nano/Nordic SDK: making a quick buzz from a piezo speaker</title><link>https://devzone.nordicsemi.com/thread/76534?ContentTypeID=1</link><pubDate>Tue, 14 Feb 2017 14:13:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:12937b96-49ed-405f-a244-b149dc50f6fe</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;I would strongly recommend to use the PWM. I see that you have tried this earlier in &lt;a href="https://devzone.nordicsemi.com/question/113476/ble-nano-central-use-pwm/"&gt;this post&lt;/a&gt;, what is the reason you are not using PWM anymore?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>