MECH_314_Module_8_1_Lab

docx

School

Embry-Riddle Aeronautical University *

*We aren’t endorsed by this school

Course

314

Subject

Mechanical Engineering

Date

Dec 6, 2023

Type

docx

Pages

13

Uploaded by ConstableTank9184

Report
LAB REPORT 8.1 Lab: Construct an Alarm System Using Motion Sensor by ______________________________________________ Jason L. Wilson Submitted to Dr. Yuetong Lin MECH 314 Submitted on October 1, 2023 Embry-Riddle Aeronautical University Worldwide
1.0 Purpose The purpose of this lab is to use a low-cost PIR Motion Sensor to detect motion using the digital input on your myDAQ device and then output an alarm sound using the audio output lines on your myDAQ device when connected to computer speakers. We will follow the three steps that have been summarized in the previous module for developing the system. First, wiring hardware. Second, activating the DAQ Assistant for device configuration, and finally, adding additional VI structures to automate the process. 2.0 Theory A Passive Infra-red motion sensor, also known as a PIR sensor, is a type of electronic device that detects motion by measuring changes in infrared radiation levels in its surrounding environment. It works by detecting the heat signatures of moving objects or people within a certain range. PIR sensors are commonly used in security systems, home automation, lighting systems, and other applications where motion detection is necessary. They are energy-efficient, easy to install, and highly reliable, making them a popular choice for both commercial and residential use. PIR sensors are widely available in the market and are affordable.
3.0 Equipment and Supplies The following items will be needed to complete this Lab: Laptop Microsoft Word NI LabVIEW 2023 Q3 Ni myDAQ Tool PIR Motion Sensor Speakers with capable audio in/out jack 4.0 Observations/Measurements 4.1.0 Given The PIR Sensor requires a +12VDC power supply and GND connection to function properly. Additionally, the output of the PIR Sensor is a digital signal (True/False) that usually operates at a voltage of 5V or lower. Some sensors may have built-in voltage regulation circuits that can handle higher voltage inputs, but it is always recommended to verify the specifications of the particular sensor being used and follow the recommended voltage ranges to avoid damaging the sensor or other components in the circuit. Figure 1 has been given to show how to wire the PIR sensor and the speaker accordingly to the myDAQ tool.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Figure 1: Wiring PIR Sensor and Speaker to myDAQ The numeric control for the frequency of the alarm sound allows the user to set the frequency of the sound produced by the PIR motion sensor. This can be useful in situations where there are multiple sensors in close proximity, as the user can set different frequencies for each sensor for easy identification. The numeric control can range from low to high frequencies based on the user's preference. The Boolean indicator displays whether motion has been detected by the PIR motion sensor. This indicator can be useful for monitoring areas where motion should not be present, such as a restricted area in a corporate environment. The indicator can also be used in conjunction with other sensors to trigger specific actions, such as sending an alert to security personnel or turning on lights in the area where motion has been detected. By having a clear indicator, the user can quickly and easily assess the status of the sensor's motion detection feature. Figure 2 is given to show how the Front Panel has been created.
Figure 2: Given LabVIEW Front Panel To create a sound file in LabVIEW, you can use the Sound File VIs in the LabVIEW Sound and Vibration Toolkit. You can also use other third-party sound creation software to create a sound file and then import it into your LabVIEW project. Figure 3 has been provided to use for this lab. Once you have created your sound file, you can wire it to a case structure in LabVIEW. The Boolean indicator for motion detection can also be wired to the case structure to determine the case of the structure. To bring in the digital alarm signal from the motion sensor, you can use a digital input module or another appropriate input device. You can read the input signal using the DAQ Assistant in LabVIEW or by creating a digital input task. When the digital alarm signal reads True, the sound file should be output through the computer speakers. This can be achieved by wiring the Sound File VI or other sound output VIs to the true case of the case structure.
Overall, the LabVIEW code for this project will involve creating a sound file, reading a digital alarm signal, and outputting the sound file when motion is detected. The specific implementation details will depend on the hardware and software used in the project. Figure 3: Given LabVIEW Block Diagram 4.1.1 Operation/Configuration We will first need to configure the Analog Output DAQ Assistant based on the information that has been provided. To configure the Analog Output DAQ Assistant, you can follow these steps: 1. Ensure that your NI myDAQ is properly connected to your computer. 2. Open a new LabVIEW VI, and drag and drop the DAQ Assistant onto the block diagram. 3. When prompted to create a new task, select "Generate Signals" and "Analog Output." 4. In the Device and Channel Configuration window, select your myDAQ as the device, and choose the audioOutputLeft and audioOutputRight channels as the analog output channels.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
5. Set the signal output range as Max: +2V and Min: -2V. 6. Configure the timing settings for N Samples and select Use Waveform to use the timing settings associated with the input sound waveform. 7. Press OK to create the Analog Output DAQ Assistant. Once the Analog Output DAQ Assistant is created, you can wire it into the True case of the case structure. From there, you can wire the sound file data directly into the DAQ Assistant data input. When the digital alarm signal is detected as true, the analog signal containing the sound file data will be output to the computer speakers through the audioOutputLeft and audioOutputRight channels. Now that we have configured our DAQ Assistants, we will need to expand our application by integrating more logic into the VI. This will include a wait of 30 seconds after clicking run to give you time to exit your room before the alarm starts to detect motion. To execute this, we will use a Time Delay. The Time Delay function in LabVIEW is used to introduce a delay in the execution of a LabVIEW VI. This can be useful for a variety of applications, such as adding an intentional delay between two actions or waiting for a certain amount of time before moving on to the next step in a program. To use the Time Delay function in LabVIEW, follow these steps: 1. Open the LabVIEW block diagram where you want to insert the Time Delay function. 2. From the Functions palette, select Timing >> Wait (s). 3. Connect the input terminal of the Time Delay function to the output of the previous block or function.
4. Set the delay time by double-clicking on the Time Delay function and entering a numeric value in seconds. Here we will set our delay time to 30 seconds as required. 5. Wire the output terminal of the Time Delay function to the input of the next block or function. 6. Save and run the LabVIEW VI. You can also use the Time Delay function in conjunction with other functions and structures, such as loops and case structures. For example, you can use a loop with a Time Delay function to repeatedly execute certain actions at a set interval. It's important to note that the Time Delay function should be used with caution, as it can potentially introduce unwanted delays and affect the overall performance of your program. Careful consideration should be given to the placement and duration of the delay to ensure that it is appropriate for your specific application. Figure 4 shows the completion of the VI with the added Time Delay. Figure 4: VI with added Time Delay
I also wanted to add a simple countdown timer to the VI, this will indicate when the system is “ARMED”. In reality, it coincides with our wait time of 30 seconds and to aid in the testing of the VI, one could simply sit and watch the timer countdown to check if the VI is working properly. The VI will count down from the initial value of the Numeric indicator in steps of one second, and display the remaining time in the Numeric indicator. You can customize the countdown timer by changing the initial value of the Numeric indicator, or by modifying the Wait Until Next ms Multiple function to change the delay time. You can also add additional functionality, such as sound or visual alerts, by adding appropriate functions and structures to the VI. In Figure 5 we can see the full VI with all incorporated. Figure 6 is the Front panel after all the modifications have been made. Figure 5: Modified VI
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Figure 6: Modified Front Panel 5.0 Discussion Testing of the modified VI was successful and the tones were heard through the speaker that I had connected to the myDAQ. The timer aided in testing by enabling me to ensure that the Time Delay was working and also allowed me to stay in one spot and use motion after 30 seconds to set off the sensor. This lab allowed me to prove that the PIR sensor worked and that my additions to the VI also worked appropriately. I also think that when testing a PIR sensor VI in LabVIEW, there are several important considerations to keep in mind:
1. Data acquisition: It is essential to set up the VI to acquire data from the PIR sensor correctly. This involves setting up the correct input (analog or digital), configuring the data acquisition hardware, and defining the sampling rate. 2. Filtering and signal processing: Once data is acquired, it may be necessary to apply low-pass, high-pass, or band-pass filters to remove noise and unwanted signals. Additionally, signal processing techniques such as thresholding, peak detection, and averaging can be applied to extract useful information from the sensor data. 3. Display and analysis: The output from the PIR sensor can be visualized using a LabVIEW graph or chart. This allows the user to monitor the sensor output in real time and determine if the sensor is working correctly. Statistical analysis tools can also be used to extract more information from the sensor output, such as mean, standard deviation, and peak-to-peak values. 4. Calibration and testing: The VI should be tested under different conditions to determine the robustness and accuracy of the PIR sensor. This involves setting up controlled environments with different heat sources, altering sensor settings (e.g., sensitivity), and measuring the response of the VI. Overall, testing a PIR sensor VI in LabVIEW is a powerful way to evaluate the performance of a PIR sensor in a controlled environment. The flexibility and versatility of LabVIEW allow users to customize the VI to suit their specific testing needs and extract valuable data from the sensor output. 6.0 Conclusion In conclusion, testing a PIR sensor with LabVIEW involves setting up a LabVIEW program to interface with the PIR sensor and analyze its outputs. The program can include components such as a graph to display sensor data, a threshold level to control sensor sensitivity,
and an alarm or notification component to indicate when motion is detected. Through testing with LabVIEW, it is possible to monitor the PIR sensor's performance in real time, visualize the sensor's sensitivity, and adjust the sensor for optimal performance. The LabVIEW program can also provide valuable data about the sensor's reliability and accuracy, which can be helpful when integrating the sensor into a larger system or application. Overall, testing a PIR sensor with LabVIEW provides a powerful testing platform that allows for detailed analysis and customization of the sensor's performance.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
References: Dorm room alarm system using a PIR motion detector, speakers, myDAQ, and LabVIEW. (2019, December 3). Retrieved from https://forums.ni.com/t5/Example-Code/Dorm-Room- Alarm-System-Using-a-PIR-Motion-Detector-Speakers/ta-p/3996489