Introduction: Visuino - Perimeter Protection With Laser Detector Using Arduino

About: Arduino fan!

In this tutorial we will use photo resistor module, laser module, LED, Buzzer, Arduino Uno and Visuino to detect when the beam from a laser was interupted. Watch a demonstration video.

Note:
Photoresistors are among the most popular lighting level sensors for Arduino. They are easy to use, and yet, there are some unexpected surprises, especially when we try to use ready modules designed by somebody else.

WARNING!!!

DO NOT POINT THE LASER TO YOUR EYES OR SOMEONE ELSE AS IT CAN BE VERY DANGEROUS!

Step 1: What You Will Need

  • Laser module
  • photo resistor module
  • Arduino UNO
  • Buzzer
  • Jumper wires
  • YELLOW LED (or any other color)
  • Visuino program: Download Visuino

Step 2: The Circuit

Connect GND from Arduino to the breadboard pin(-)

Connect 5V from Arduino to the breadboard pin(+)

Connect Buzzer pin (+) to Arduino digital pin (11)

Connect Buzzer pin (-) to the breadboard pin(-)

Connect LED pin (-) to breadboard pin(-)

Connect LED pin (+) to Arduino digital pin(13)

Connect Laser module pin (-) to breadboard pin(-)

Connect Laser module pin (+) to breadboard pin(+) NOTE: in my case it was marked with "S" (depends on the module type)

Connect photo resistor module pin (-) to breadboard pin(-)

Connect photo resistor module pin (+) to breadboard pin(+)

Connect photo resistor module pin (S) to Arduino analog pin(A0)

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

To start programming the Arduino, you will need to have the Arduino IDE installed from here: http://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 ESP 8266!

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 Components

Add SubtractFromValue component set value to 1

Add CompareAnalogValue component set value to 0.9 ( you can change this number to find the "sweet spot")

Add Buzzer component

Step 5: In Visuino: ​Connecting Components

  • Connect Arduino Analog pin [0] to SubtractFromValue1 pin [in]
  • Connect SubtractFromValue1 pin [out] to CompareAnalogValue1 pin [in]
  • Connect SubtractFromValue1 pin [out] to CompareAnalogValue1 pin [in]
  • Connect SubtractFromValue1 pin [out] to Arduino serial pin [in]
  • CompareAnalogValue1 pin [out] to Buzzer1 pin [in]
  • CompareAnalogValue1 pin [out] to Arduino digital pin [13]
  • Buzzer1 pin [out] to Arduino digital pin [11]

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

In Visuino, Press F9 or click on the button shown on Picture 1 to generate the Arduino code, and open the Arduino IDE

In the Arduino IDE, click on the Upload button, to compile and upload the code (Picture 2)

Step 7: Play

If you power the Arduino Uno module, the buzzer will start buzzing, focus the laser beam to photo resistor and it should stop buzzing. Now its ready, whenever the beam will be interupted the buzzer will start buzzing (intruder detected).

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Instructable.

You can download and open it in Visuino: https://www.visuino.eu