A Simple Home Alarm System with DAQ and Labview

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.

Objectives:

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.

Background:

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)

Pre-Requirements:

Labview and DAQmx softwares  installed in your PC, and the DAQ device duly working, and recognised by Labview.

Required Equipment:

NI Labview 2010 Student
NI DAQmx 9.0.2
NI USB-6009 DAQ device
PIR movement sensor C-7288 or similar
Wiring leads


Basic Knowledge:

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:

The Labview VI and all the components are available here, kept at Bitbucket, an unlimited free private repositories’ site.

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.

Acknowledgments:

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:


Advertisements

About Tayeb

Electronics engineer, part-time webmaster and owner of "Aliatron", a tech-oriented company registered in Portugal and Mozambique.
This entry was posted in Electronic Projects and tagged , , , , , . Bookmark the permalink.

16 Responses to A Simple Home Alarm System with DAQ and Labview

  1. fakhry says:

    nice info…i think the thief soon or later will find the way in to our house

    • Tayeb says:

      Welcome to my blog.

      In fact the exercise is just to demonstrate a potentially of Labview with a DAQ board. Also I call the system a simple alarm, not a sophisiticated alarm!

      Instead of an alarm to catch thieves, it the system could be used to monitor if any is approaching a given protected zonen say in a factory (a robotic arm can kill a worker).

      I saw something similar on the web as a dormitory alarm.

  2. Shadow Caster says:

    Salam. How come there haven’t been any posts on this blog for ages? I’m looking forward to reading more of what your company is doing inshallah.

    • Tayeb says:

      Wa-alaikum-as-salaam,

      Well this is not my company’s blog. It is just a simple attempt of sharing knowledge. Lately I have been too busy. I hope to write more of techie matters here.

  3. pokrig says:

    Hi Tayeb,
    great work.
    1-Are you using pir module or sensor like re200b?
    can you help how to read the data from labview?

    2-I know you are busy but Can you explain the block diagram pls so that we could learn how to design using labview?
    thanks and regards

    • Tayeb says:

      Hi pokrigadou, welcome to my blog.

      Thank you for consdering “great” the published work.

      I am using a cheap PIR sensor. On reading data I suggest you check out lots of tutorials out there.

      The block diagram is quite simple. You really need to learn the basics of NI block diagram, perhaps by watching some of the excellent Youtube tutorials, made by NI team.

      If you end up in not understanding something special of what I did, you are welcome to ask.

      The best way of learning how my block diagram works, is to use it, and then modify it to see the behaviour, and do some reverse engineering. If you ever publish your work don’t forget to mention my blog and the inspiration you may have got from it.

  4. Tatiana says:

    Thank you for sharing this awesome information, Tayeb.
    I have a question. Would it be possible to use this principle for tracking animals? For example, let’s say we have four bowls with different dog food in each and motion detectors close to each bowl. We want to know which food a dog prefers to eat, when, and for how long. For that, the V.I. would have to constantly scan the DAQ channels and register every single event (automatic resetting – no latching). Would that work? Also, if the dog is not quite moving around, just staying still and eating, would the motion detector still send a signal to the DAQ so that each millisecond scan would still detect the dog (to know how long the dog stayed there)? Thank you for your time!

  5. Elsa Wong says:

    Nice.

    I had thought of making an alarm system for my project but I was wondering if you could give me any other ideas for projects using a daq and labVIEW?

    any help will be appreciated. Thanks in advance!

    • Tayeb says:

      Welcome to my blog. I suggest you check out in NI website where you will find lots of examples. In fact you can do lots of things. It depends on your imagination.

  6. very interesting alarm system. Thanks for the information i will have to look into these systems.

  7. I’m extremely pleased to find this great site. I need to to thank you for ones time for this particularly wonderful read!! I definitely appreciated every little bit of it and i also have you saved as a favorite to check out new stuff on your blog.

    • Tayeb says:

      Welcome to my blog. I just want to share knowledge – a little I know or I discover – as I believe knowledge belongs to all. I appreciate very much your kind words, and I hope that this blog may also trigger your interest in sharing. Let us make a world of knowledge and generosity in sharing it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s