This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to increase Piezo buzzer sound

We are trying to modify SDK example pwm_library, we are able to generate minute sound ,how to increase the sound

  • Hi,

    You can vary the volume of the sound by modifying the duty cycle. 0% duty cycle will produce no sound, 50% will be the max volume:

    while (app_pwm_channel_duty_set(&PWM1, 0, 50) == NRF_ERROR_BUSY);
    

    Different frequencies will give you different tones. Note that the resonance frequency is the frequency at which buzzers will be the loudest. If you take a look in the buzzer datasheet, the resonance frequency should be listed there. Use the resonance frequency to calculate the corresponding period, and use this period when configuring the PWM. The period = 1/frequency, so for e.g. 500 hz resonant frequency, period = 1/500 = 0.002 s = 2000 us

    APP_PWM_DEFAULT_CONFIG_1CH(2000L,pin_number)
    

    If you still need louder sound, you should consider using a transistor in order to use a higher supply voltage for the buzzer. You can e.g. use a PN2222 transistor. Take a look at this page.

Related