How to Use PIR Sensor and a Buzzer Module - Visuino Tutorial

by RonFrtek in Circuits > Arduino

1494 Views, 0 Favorites, 0 Comments

How to Use PIR Sensor and a Buzzer Module - Visuino Tutorial

How to Use PIR Sensor and a Buzzer Module - Visuino Tutorial

In this tutorial we will learn how to use a PIR sensor and a buzzer module to make a sound every time a PIR sensor detects a movement.

Watch a demonstration video.

hc-sr501-pyroelectric-infrared-pir-motion-sensor-detector-module-for-arduino-avr-hc-sr501-ir-500x500.jpeg
SKU125754a.jpg
VisuinoAdvrtisementM5Stack6.jpg
FZEK4WBK3XGYAP0.LARGE.jpg
jumper-wires.jpg

  • Arduino UNO (or any other Arduino)
  • PIR Sensor
  • Buzzer module
  • Jumper wires
  • Visuino program: Download Visuino

The Circuit

2020-01-12_11-06-32.jpg

  • Connect PIR sensor pin [GND] to Arduino pin [GND]
  • Connect PIR sensor pin [VCC] to Arduino pin [5V]
  • Connect PIR sensor pin [Signal] to Arduino digital pin [8]
  • Connect Buzzer pin [+] to Arduino pin [5V]
  • Connect Buzzer pin [-] to Arduino pin [GND]
  • Connect Buzzer pin [S] to Arduino digital pin [7]

Start Visuino, and Select the Arduino UNO Board Type

FBL8FPKK5H5EPPI.LARGE.jpg
FL8QFGAK5H5EPPK.LARGE.jpg

To start programming the Arduino, you will need to have the Arduino IDE installed from here: https://www.arduino.cc/.

Please be aware that there are some critical bugs in Arduino IDE 1.6.6. Make sure that you install 1.6.7 or higher, otherwise this Instructable will not work! If you have not done follow the steps in this Instructable to setup the Arduino IDE to program Arduino UNO! The Visuino: https://www.visuino.eu also needs to be installed. Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

In Visuino Add and Connect Components

2020-01-23_17-41-45.jpg
2020-01-23_17-41-32.jpg
2020-01-23_17-45-53.jpg
2020-01-23_17-46-23.jpg
  • Add "Digital (Boolean) Change Only" component
  • Add "Play Frequency Tone" component and in the properties window set "Initial Frequency (Hz)" to 20
    -select "Enabled" field and click on the pin icon and select "Boolean SinkPin"
  • Connect Arduino digital pin [8] to "ChangeOnly1" pin[In]
  • Connect "ChangeOnly1" pin[Out] to "PlayFrequency1" pin [Enabled]
  • Connect "PlayFrequency1" pin [Out] to Arduino digital pin [7]

Generate, Compile, and Upload the Arduino Code

2020-10-30_13-20-50.jpg

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Play

If you power the Arduino UNO module, and make a move the PIR sensor should detect it and a buzzer module will make a sound.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable, you can download it here and open it in Visuino: https://www.visuino.eu