If one is ever interested in activating an alarm or any other equipment when a remote motion sensor detects motion, this blog may help him. Suppse that you have a motion sensor at a remote location. You want an alarm or any other equipment sitting at another remote location activated whenever this motion sensor detects a motion. In this blog, you will learn how that can be done using our IOT system and smart devices. Lets get started ...
Things we need
- Two units of WifiSecureAccess automation controller
- One unit of motion sensor
- One unit of alarm (siren)
There are several makes and brands of motion sensors available in the market. You can use any so long as its voltage ratings are 3.3VDC. In other words, its output must be 3.3Volts when a motion is detected. HC-SR501 Infrared PIR motion sensor is a low cost but good motion sensor. Fig 2 shows an inexpensive motion sensor.
HC-SR501 Infrared PIR sensor can be purchased from anywhere. Given below is a link from Amazon. If this link is not available, search for HC-SR501 Infrared sensor in amazon or google. If this link is broken, search in Amazon or eBay for HC-SR501 motioin sensor. Buy the model that works with 3.3V power source.
There are several types of alarms (siren) available in the market. You can buy anything of your preference. Or, instead of an alarm siren, it can be any equipment. In our example, let us connect a siren. If you are buying a siren, and if you want to cable that directly to the smart device, make sure that its voltage and current ratings match with the smart device. Smart device has a maximum current rating of 400ma at 12Volts. If you are connecting a 240V/110V equipment (could be an electric light or anything like that), the relay on the smart device has a current rating of 10A. If your equipment draws more current than this, you need to buy an external relay of appropriate rating. Given below is a link to a simple siren. This is to just for a demonstration in this example. What you need may be something else, but connections and configurations are similar to what is explained in this blog.
Note: If this link is broken, search for '12V Wired Strobe Siren' in Amazon.com
Connect motion sensor to one of the smart devices as shown in Fig 4.
This motion sensor has three pins (GND, OUT, VCC). Connect VCC, OUT and GND of this sensor to 3V3, D7 and GND respectively on connector PJ3 of the device. You can also use D6 or D7 from connector J1. Motion sensor's OUT can be connected either to D6 or D7 of the smart device. This motion sensor can be mounted anywhere by running the three cables between motion sensor and the controller.
Cable the alarm siren (or any other equipment to the second smart device. If it is a 12V operated two-terminal alarm, it can be connected to the relay terminals of the controller as shown in Fig 6.
If it is a 240V/110V equipment, cabling such equipments is described in section 3.1 of the documentaion. You may refer to those steps.
Aftaer cabling the alarm, install it at any desired location. Make sure that power is applied to the devices and WiFi is available at both the locations. The device can take either 12V power or 240V/110V AC power. Make sure that the jumper PJ1 on the smart device is placed appropriately depending on what power is applied.
Put on the power to both the smart devices. If these devices are brand new and you have not yet assigned their ownership to yourself and not yet set their WiFi, go through the steps given in 'Installation' section 2 of the Automation Control documentation. If you had done those steps earlier for these two devices, you will hear a beep sound when the power is put on and the LED will turn red. When doing the initial configuration of these devices in that section of installation, set the name of these two devices something meaningful. Also, the 'Use Type' of both these sensors must be set to 'CONTROL/SENSOR'.
Before configuring automatic controls, check if you can actvate the alarm from your smartphone. Open the app and click on 'Activate a device' in the scanning page of the app, and then click on the device connected to the alram siren. Then, click on the red cross mark on the port to which the alarm is cabled to (either P0 or RELAY). If all cabling is correct and if you have completed the steps in the 'Installation' section of the documentation correctly, you should see the alarm is put ON. Click on it again to put it off manually.
Next, configure the device connected to the motion sensor. Click on 'Configure Device' under 'Device Admin' in the Dashboard. This can be done either from a smartphone or a computer. If using smartphone, open the app and press 'Admin Dashboard'. Then, expand the menu at the top right and click on click on 'Configure Device' under 'Device admin'. If you are using a computer, do the same on a dashboard. You will see a page similar to Fig 7 when you click 'Configure Device'. Select Use Type as 'CONTROL/SENSOR' and select 'TWO STATE INPUT ON/OFF' for D7. Then press Submit button.
Next, check if the motion sensor is sensing motion correctly. Click on 'Show Device Details' under Device admin in Dashboard. When the page opens, click on 'Sensor Values'. You will see the current state of D7 (or D6, if you have connected motion sensor to D6). It will be either ON, or OFF. If motion is detected, it should show ON. Move in front of the motion sensor and test if the state changes from OFF to ON (when you move in front of it) and ON to OFF (when nothing is moving in front). If this is working well, we are ready to proceed to step 4 for configuring automatic control.
Once we have completed all the previous steps successfully, we are ready to configure automatic control. Click on 'Configure Auto Controls' under 'Device Admin' in Dashboard. Then select the device to which motion sensor is cabled. You will see a page similar to Fig 9.
On this page, click on 'ADD INPUT BASED PORT CONTROL'. That will take you to a page similar to Fig 10.
On this page, select the Out Port as P0 (if the alarm is connected to P0 of the other device) or RELAY (if the alarm or equipment is connected to relay). Then select the 'Out Device' as the name of the other device to which the alarm is cabled to.
Select D7 for Input port, if motion sensor is cabled to port D7 of this device. If it is cabled to D6, select D6.
Then, for 'Mode', select 'PUT ON THE PORT AND/OR SEND EMAIL WHEN'. Select 'GREATER THAN OR EQUAL TO' for the logical operator field. Then for 'Value' field, enter 1.0. Note: since the motion sensor is an ON/OFF type of sensor, it either outputs 3.3V when motion is detected, or 0Volts when motion is not detected. 3,3Volts is locally represented as 1.0 and 0volts is logically represented as 0. By entering 1.0 for value, we are setting such that the Outport of Out Device is to be put ON when the value of motion sensor is logical 1 (3.3Volts).
The next three fields are optional. If you want the alarm to stay ON only for a short period of, say, 5 seconds, enter 5 for the 'Duration' field.
If you want the alarm to come ON and OFF periodically during the period when motion stays detected, then enter repeat time in seconds in the 'Repeat Time period' field.
If you want the alarm to come ON only a few seconds after the motion is detacted, enter that delay time in the 'Start Delay' field/
Then press Submit button. If all fields are correct and if it finds no conflict of this port control with any other settings of these devices, it will successfully configure this prtcontrol.
You can make further modifications on this page any time in the future, if you want. If you make any further modifications on this page, do not forget to press Submit.
The system is all set to go. Check and monitor if everything is working as configured. You should be seeing the alarm goes ON when the motion sensor detects a motion, and it goes OFF when it does not detect a motion.
The motion sensor and the alarm can be at remote locations so long as both have WiFi connected to internet.
You can make any further modifications of the port controls any time by clicking 'Configure Auto Controls' under 'Device Admin' in Dashboard.