How To Use Pir Sensor And A Buzzer Module - Visuino Tutorial

About the project

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.

Project info

Difficulty: Easy

Platforms: ArduinoVisuino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Jumper wires (generic) Jumper wires (generic) x 1
Arduino UNO Arduino UNO x 1
Buzzer Buzzer x 1
PIR Motion Sensor (generic) PIR Motion Sensor (generic) x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE

Story

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.

Step 1:

1 / 4

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

Step 2: The Circuit

  • 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]

Step 3: Start Visuino, and Select the Arduino UNO Board Type

1 / 2

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 tutorial will not work! If you have not done follow the steps in this tutorial 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

Step 4: In Visuino Add and Connect Components

1 / 4

  • 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]

Step 5: Generate, Compile, and Upload the Arduino Code

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.

Step 6: 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 tutorial, you can download it here and open it in Visuino: https://www.visuino.eu

Schematics, diagrams and documents

Visuino File

Code

Visuino File

Credits

Photo of Ron

Ron

Arduino Developer

   

Leave your feedback...