Activity No. 2: Emitting a sound with the buzzer (Vittascience Starter Kit)

Using the buzzer with the NUCLEO-L476 board.

Functioning of the buzzer

The Grove buzzer is a module that emits a sound when it is powered. It is composed of a small element containing a membrane which will vibrate when the current passes through it. 
zoom-buzzer-FR

Assembly of the components

To operate this buzzer using the NUCLEO-L476RG card, the following connection must be made: 
- Connect the Shield Grove to the connectors on the card. 
- Connect, using the Grove cable, the buzzer to one of the available ports. We will choose port D3.
buzzer-FR
Be careful to respect the direction of connection of the Grove cable (4 wires in 1 with polarizing slot).

Programming

Let's get to the programming now! 

We are going to use the block: "[Buzzer/Speaker] play the frequency...during...on D3", available in the Actuators of the block locker.

buzzer-en-1

It is necessary to define the frequency of the note played by the buzzer (which corresponds to the vibration of the piezoelectric membrane) as well as the duration during which it will be heard. 

Other blocks are available. They allow you to create a sequence of notes, to stop the buzzer, or to use an already created melody.

buzzer-en-2


Use the following interface to program the module: 

Once the program has been created, it must be copied onto the board. To do this, you must use the "Upload" button (see Activity 0: Getting started with the board)

Exercise: creating a reversing beep

In this part, we suggest that you create a reversing beep that is used on gear site when moving in reverse.
Here is the program to create so that it runs continuously: 
- Emit a 2510 Hz frequency sound for 600 ms
- Wait 600 milliseconds
- Stop the buzzer
- Wait 600 milliseconds

The blocks are already available on the work area. Now it's up to you: 
Download the program to the card to check the correct execution of your program or launch the simulator.

You succeeded ? Perfect, you now know how to program a buzzer using your NUCLEO-L476RG board! 
Discover the other activities of the Starter kit by clicking on the icons below.
sol-buzzer-en

Licence d'utilisation

Licence Creative Commons

Cette ressource est mise à disposition selon les termes de la Licence Creative Commons Attribution - Partage dans les Mêmes Conditions 2.0 France

Personne n'a commenté pour le moment.