Transforming WiFi Door Sensors into Smart IoT Air Barriers for Enhanced Security
Introduction
The project's problem statement
The issue came from an entry road at a business facility that couldn't be blocked by a gate due to internal constraints. How could we monitor nighttime movement of trucks and people, given the owner's concerns about potential internal theft? While CCTV was installed on the road, practical monitoring every night wasn't feasible. So, how could we track movement without using an entry-exit control system?
Introduction to the concept of an Air Barrier Sensor
The concept of an Air Barrier does not involve air; instead, it utilizes infrared light transmitters and receivers. These sensors are primarily employed for perimeter security and are integrated with alarm systems.
The image above illustrates the IR barrier utilized in this deployment. These commercially available sensors offer a convenient alternative to developing a new solution from the ground up.
Purpose and scope of the article
In this article, I will provide a detailed explanation of how to modify a WIFI door sensor so that it can work seamlessly with an IR Barrier designed for alarm systems. The main goal of this modification is to leverage the existing capabilities of the door sensor, thereby avoiding the need to develop a custom backend for sending and receiving alerts, as well as keeping logs of the open and close operations.
Commercially available door sensors are highly efficient at logging events and creating reliable alert systems. By integrating these sensors with an IR Barrier, we can take advantage of their robust logging features and alert mechanisms. This integration allows us to monitor movement effectively without the need for barriers or complex custom solutions.
Throughout this article, I will walk you through the step-by-step process of making the necessary modifications to the WIFI door sensor. This includes detailed instructions on configuring the sensor, connecting it to the IR Barrier, and setting up the alert system. By the end of this article, you will have a comprehensive understanding of how to implement this solution to enhance security and monitoring at your facility.
Understanding the Basics
Overview of Air Barrier Device
The Air Barrier device consists of two components: the transmitter and the receiver. Infrared beams are focused using lenses. Both components require an input voltage of 12-24V DC. They are equipped with a tamper-proof connection that triggers an alert when the faceplate is removed. Signaling is managed through a relay with Normally Open (NO) and Normally Closed (NC) terminals. When the beams are aligned correctly, the Good LED and the Level LED illuminate, indicating strong signal strength and proper alignment. If the beam is obstructed, the Alarm LED lights up and activates the relay.
Overview of Traditional WiFi Door Sensors
The WiFi door sensor utilized in this setup is manufactured by Sonoff. Selecting a dependable door sensor is essential, as reliability is paramount for this application. Given that this is not a hobby project but will be deployed on-site, the sensor's performance is critical. It uses the eWeLink service to transmit data, offering a swift response time of 100-250ms. Additionally, it maintains a daily log of all operations.
Internal Circuit of the Door Sensor
The door sensor operates by detecting a magnet near the hall effect sensor. The input voltage is 3.3V DC. When the magnet is not close, the voltage at pin 1 is 3.3V, but when the magnet is near (indicating the door is closed), the voltage drops to 0.0V. So, if we can pull the voltage low or simply connect pin 1 to ground, we can simulate the presence of a magnet. This will send a signal to the eWeLink backend indicating the state (open/close) and log the event.
Modifying the Door Sensor
We need to perform two modifications to the door sensor:
Provide power
Simulate the presence of a magnet
Providing Power
The sensor requires 3.3V to operate, but our primary source is higher. Therefore, we will use the ASM1117 3.3 linear voltage regulator to step it down to 3.3V and supply power to the 3.3V and GND pads on the board.
Simulate the presence of a magnet
Simulating the presence of a magnet is the primary focus of the modification. We need to bridge pin 1 and pin 2 to simulate the magnet being near (door closed). When the alarm is triggered, the pins are disconnected, simulating the magnet being away (door open).
The circuit board appears as follows after the modifications:
General working principles
The above diagram represents the block-level layout of the entire system. It is composed of four main components: a 12V DC power supply, a transmitter, a receiver, and a modified door sensor. The workflow can be broken down into the following steps:
12V DC Power Supply: This component provides the necessary power to the entire system, ensuring that all parts operate efficiently and without interruption.
Transmitter: The transmitter's role is to emit an infrared (IR) beam continuously. This beam acts as an invisible line that, when broken, triggers a series of events.
Receiver: Positioned to receive the IR beam, the receiver continuously monitors the state of the beam. If the beam is uninterrupted, it indicates that the pathway is clear. However, if the beam is obstructed or broken, the receiver's internal relay is activated.
Modified Door Sensor: The door sensor has been altered to integrate with this system. When the relay in the receiver is triggered due to a broken beam, it disconnects the contacts of the modified door sensor. This disconnection simulates the magnet moving away from the sensor, indicating that the door is open.
Once the beam is broken and the relay is triggered, the system sends a signal to the eWeLink service. This service promptly logs the event and sends alerts indicating the change in the door's state and logs the event. The state of the door being open is maintained until the IR beam is restored, at which point the system resets, ready to detect any future interruptions.
Real-time monitoring and alerts
Real-time monitoring is handled by the eWeLink service, and their sub-millisecond response time is quite adequate for the application.
The system maintains detailed logs of all events for a period of 90 days. This means that every instance of the IR beam being broken or restored, along with the corresponding changes in the door's state, is recorded and stored. These logs include timestamps and other relevant data, allowing for thorough analysis and review of the system's performance over time.
Scalability and Flexibility
The system is highly scalable with many nodes working together, but since the device uses a 2.4GHz WiFi range, there might be an issue with range. In terms of flexibility, there may be problems regarding support for MQTT, which is not natively present on this specific sensor.
The device can have more range if a Zigbee-based gateway architecture is used with Zigbee mesh capability to relay data from deep nodes.
Conclusion
The deployment of the modified WiFi door sensor integrated with an IR Barrier has proven to be a reliable and effective solution for monitoring movement at the business facility. By leveraging commercially available devices and adhering to the KISS principle, we were able to create a robust system without the need for extensive custom development. The system's real-time monitoring and alert capabilities, combined with detailed event logging, ensure enhanced security and peace of mind for the facility owner. This approach not only saved time and resources but also provided a scalable and flexible solution that can be adapted to various security needs.