TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136804 times)
  2. FAT32 Library (69983 times)
  3. Network Ethernet Library (55951 times)
  4. USB Device Library (46274 times)
  5. Network WiFi Library (41892 times)
  6. FT800 Library (41188 times)
  7. GSM click (28990 times)
  8. PID Library (26420 times)
  9. mikroSDK (26375 times)
  10. microSD click (25382 times)
Libstock prefers package manager

Package Manager

We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]

< Back
mikroSDK Library

Buzz 3 click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.7

mikroSDK Library: 2.0.0.0

Category: Speakers

Downloaded: 74 times

Not followed.

License: MIT license  

Buzz 3 Click is a compact add-on board that contains a sounder driver that produces higher volume with a lower current. This board features the PAM8904, a piezo-sounder driver with an integrated Multi-Mode charge pump boost converter from Diodes Incorporated.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Buzz 3 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Buzz 3 click" changes.

Do you want to report abuse regarding "Buzz 3 click".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


Buzz 3 click

Buzz 3 Click is a compact add-on board that contains a sounder driver that produces higher volume with a lower current. This board features the PAM8904, a piezo-sounder driver with an integrated Multi-Mode charge pump boost converter from Diodes Incorporated.

buzz3_click.png

click Product page


Click library

  • Author : Jelena Milosavljevic
  • Date : Jul 2021.
  • Type : PWM type

Software Support

We provide a library for the Buzz3 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for Buzz3 Click driver.

Standard key functions :

  • buzz3_cfg_setup Config Object Initialization function.

    void buzz3_cfg_setup ( buzz3_cfg_t *cfg );
  • buzz3_init Initialization function.

    err_t buzz3_init ( buzz3_t *ctx, buzz3_cfg_t *cfg );
  • buzz3_default_cfg Click Default Configuration function.

    err_t buzz3_default_cfg ( buzz3_t *ctx );

Example key functions :

  • buzz3_pwm_start This function starts the PWM module output.

    err_t buzz3_pwm_start ( buzz3_t *ctx );
  • buzz3_set_gain_operating_mode The function set gain operating mode of the PAM8904 piezo sounder driver with integrated charge pump boost converter on Buzz 3 click board.

    err_t buzz3_set_gain_operating_mode ( buzz3_t *ctx, uint8_t op_mode );
  • buzz3_play_sound This function plays sound on buzzer.

    void buzz3_play_sound ( buzz3_t *ctx, uint16_t freq, uint16_t duration );

Example Description

This example demonstrates the use of Buzz 3 click boards with PAM8904 for play the Imperial March. PAM8904 is piezo-sounder driver with an integrated Multi-Mode charge pump boost converter from Diodes Incorporated.

The demo application is composed of two sections :

Application Init

Initializes GPIO, set AN and RST pin as outputs, begins to write a log. Initialization driver enables - GPIO and configures the appropriate MCU pin for sound generation, also write log.


void application_init ( void ) 
{
    log_cfg_t log_cfg;          /**< Logger config object. */
    buzz3_cfg_t buzz3_cfg;      /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.

    buzz3_cfg_setup( &buzz3_cfg );
    BUZZ3_MAP_MIKROBUS( buzz3_cfg, MIKROBUS_1 );
    err_t init_flag  = buzz3_init( &buzz3, &buzz3_cfg );
    if ( PWM_ERROR == init_flag ) 
    {
        log_error( &logger, " Application Init Error. " );
        log_info( &logger, " Please, run program again... " );

        for ( ; ; );
    }

    buzz3_default_cfg ( &buzz3 );
    buzz3_set_duty_cycle ( &buzz3, 0.0 );
    log_printf( &logger, "---------------------\r\n" );
    log_printf( &logger, " Set the gain to x1  \r\n" );
    log_printf( &logger, "---------------------\r\n" );
    Delay_ms ( 100 );
    buzz3_pwm_start( &buzz3 );
    buzz3_set_gain_operating_mode( &buzz3, BUZZ3_OP_MODE_GAIN_x1 );

    log_info( &logger, " Application Task " );
}

Application Task

Plays the Imperial March melody. Also logs an appropriate message on the USB UART.


void application_task ( void ) 
{
    log_printf( &logger, "   Play the music    \r\n" );
    buzz3_melody( );
    log_printf( &logger, "---------------------\r\n" );
    Delay_ms ( 1000 );
}

Note

The minimal PWM Clock frequency required for this example is the frequency of tone C6 - 1047 Hz. So, in order to run this example and play all tones correctly, the user will need to decrease the MCU's main clock frequency in MCU Settings for the certain architectures in order to get the required PWM clock frequency.

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Buzz3

Additional notes and informations

Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MikroElektronika compilers.


ALSO FROM THIS AUTHOR

3D Hall 9 click

0

3D Hall 9 Click is a compact add-on board used to detect the strength of a magnetic field in all three dimensions. This board features the ALS31300, a 3D linear Hall-effect sensor with digital output and advanced low power management from Allegro Microsystems. The ALS31300 features an I2C interface, enabling it to be easily configured by MCU with the measurement data provided in digital format of 12-bits corresponding to the magnetic field measured in each X, Y, and Z axes.

[Learn More]

tRF click

5

This example demonstrates usage of the tRF click board in mikroBUS form factor. Board features Telit's LE70-868 RF module. The example will send the text string via the LE70-868 RF module display the received string on the Lcd.

[Learn More]

Proximity 16 click

0

Proximity 16 Click is a compact add-on board that contains a close-range proximity sensing solution. This board features the VL53L5CX, a Time-of-Flight (ToF) multizone ranging sensor from STMicroelectronics. The VL53L5CX integrates a SPAD array, physical infrared filters, and diffractive optical elements (DOE) to achieve the best-ranging performance in various ambient lighting conditions with different cover glass materials. It allows absolute distance measurement, whatever the target color and reflectance, provides accurate ranging up to 400cm, and can work at fast speeds (60Hz). Also, multizone distance measurements are possible with either 4x4 or 8x8 separate zones with broad 63° diagonal software-configurable Field-of-View (FoV).

[Learn More]