In this lesson, we will show how to use Arduino to control an active buzzer module and make beep alarm.
In this lesson, we use a motion sensor to detect your hand motion. Once motion is detected, active buzzer will beep.
Please plug OSOYOO magic I/O board onto UNO board First. Then connect PIR module to Port 2 , buzzer module to Port 8 in Osoyoo Magic I/O board with a 3-pin PNP cable. Circuit connection picture as below:
Please download the sketch code from following link:
Unzip lesson25.zip, open the lesson25.ino sketch code and upload the code to Arduino IDE. Then put your hand close the PIR sensor, then the buzzer will beep. After the hand left PIR sensor, the buzzer will top beep.
A few seconds after the upload finishes, you should hear the buzzer beep.
The active buzzer has built-in oscillating source, so it will beep as long as it is electrified, but it can only beep with a fixed frequency.
DownLoad Url osoyoo.com