We all like peace of mind knowing that our home is safe when we are away, at work, or for whatever other reasons. The system here is a simple home alarm system with a motion sensor. The Labview virtual instrument (VI) described here can be easily expanded to a full-fledged alarm system with several sensors, and strategies of detection.
Design a simple alarm system using a PIR (Passive InfraRed) motion sensor that will detect movement on digital input of a DAQ device, and then output an alarm sound using the computer speakers, sending at the same time a message of intrusion.
A Passive InfraRed sensor (PIR sensor) is an electronic device that measures infrared (IR) light radiating from objects in its field of view. PIR sensors are often used in the construction of PIR-based motion detectors (see below). Apparent motion is detected when an infrared source with one temperature, such as a human, passes in front of an infrared source with another temperature, such as a wall.(source)
Labview and DAQmx softwares installed in your PC, and the DAQ device duly working, and recognised by Labview.
It is required to have basic knowledge in setting up a simple VI, such as the VI in the project Internet Control of a Labview VI.
The PIR Connections:
The Labview VI:
Build a Labview VI such as shown below. It uses an email SubVI that sends an email notification using SMTP service:
Before Running the VI:
You need to have your DAQ Assistant function correctly set for your DAQ device. Check the above mentioned project Internet Control of a Labview VI.
Next, you need to open the Email_alert_subVI.vi contained in the zipped file just downloaded. You need to set up the SMTP details correctly.
Test the subVI running it, and checking whether you receive the email sent by the subVI. Please note that you have to be online to test the subVI.
In order to make default the set up constants of SMTP, make current value default in the Block Diagram (e.g. for Sender’s Name constant, right click onto it with mouse, choose Data Operations, and next choose Make Current Value Default, and so on for each constant).
After setting up all constants, save the subVI, and open it, and check if the values you have chosen are shown on your subVIs’s Front Panel. Double check, testing again the subVI ensuring email is sent to you by the subVI.
How it works:
When running continuously the VI, the DAQ device detects motion with PIR sensor. The detected signal generates a 400Hz sinal that is sounded in your PC speakers, and the Intrusion LED on Front Panel of Labview VI is switched on.
The detected signal sends an email alert, using the subVI already set up by you with your SMTC account detals.
The alarm latches, and can be only stopped if you reset it by pressing the RESET button on the Front Panel. After resetting the VI will be ready to detect any new motion.
Tips and Tricks:
- You can modify the VI in order log each intrusion time to file using a ‘Write To Spreadsheet File.vi’ express VI. There are plenty of examples on Internet on how to do it.
- Expand your application by integrating more logic into the VI. Possible scenarios might include a wait of a few seconds after clicking run to give you time to exit your home before the alarm starts to detect motion.
- You can sent text messages to your cell phone using email to text servies (SMS) such as Clickatell, and many other such services. Normally these services are not free, but they are reliable. They all allow free credit to test your system.
- You can add an arming feature with keyboard input such as the Home Alarm at Student Projects page found here.
- You can also add webcam as a motion detector and record any intrusion. You can find a tutorial with Yawcam. The system will send you also a text message (SMS) making use of a cheap webcam. Press here to see the tutorial.
A special thanks is due to NI Developper Zone for inspiration. The actual project is based on article Dorm Room Alarm System Using a PIR Motion Detector, and following resources: