Inspiration
Wi-Fi based IoT systems are an increasingly popular method for securing the home. Brands such as Ring and Google Nest provide products such as smart doorbells and security cameras which can be managed and monitored over a Wi-Fi connection. Although Wi-Fi is a convenient connection method for everyday home use, it can become impractical for large properties with wide areas needing coverage.
For instance, farm owners may wish to secure various utility sheds and gates spread across several acres of land. Extending a Wi-Fi network across an area of that size would be costly and a waste of resources. Our project aims to provide a more resource-efficient way of introducing IoT-based perimeter security to properties too large for conventional Wi-Fi coverage.
What it does
Our security system is designed to communicate over large areas of land using a mesh network of microcontrollers communicating via long-range radio.
Our idea turned to be very ambitious, and in the end we weren't able to implement the full scope of our project. However, our intended architecture is as follows:
What it's supposed to do
-The network is composed of many small, low-power devices such as motion sensors and door-ajar sensors. These devices communicate with each other over long-range radio, forming a mesh network.
-At least one mesh node is within range of a Wi-Fi access point with an Internet connection. Nodes that are out of range of the Wi-Fi network can be accessed via intermediate connections with other mesh nodes.
-Whenever a security event occurs (motion sensor tripped, door opened, etc.), an event message is sent across the network. The node with the Internet connection then receives the message and uploads it to a web server, which logs the event in a database and sends a warning email to the property owner.
-A front-end application can communicate with the server to display relevant information.
What it actually does
-We successfully managed to establish a mesh network connection between several microcontrollers. We were able transmit dummy data between two nodes out of range of each other through a third node in the middle.
-We have skeleton code for establishing a socket connection between the ESP32 and the web server, although we didn't get to test it.
-We managed to read data from sensors, including an ultrasonic sensor and accelerometer. We are theoretically capable of transmitting that over the network, but didn't have much time to implement it.
-We have server code that can send an alert email.
How we built it
We wrote our embedded code in C++ using the Arduino IDE. For the mesh network, we used an open-source protocol called "painlessMesh" (https://gitlab.com/painlessMesh/painlessMesh).
Our web server is configured to act as an MQTT client. We used the Paho MQTT client for Python (https://pypi.org/project/paho-mqtt/).
The front end is made with Flutter (https://flutter.dev/), a framework for building cross-platform applications.
Challenges we ran into
The biggest challenge we ran into was getting the mesh network to communicate with a regular WiFi network. Our intention was to place one of the nodes of the mesh network in range of a WiFi access point to dump event data onto a web server for logging. Although the ESP documentation hints at the ability to run WiFi and long-range radio communications at the same time, we found that this is very difficult in practice since they both use the same resources. We attempted to set up an MQTT broker on a Synology NAS and connect to it using the microcontroller, but we were unable to get the microcontroller to talk to the broker and the mesh network at the same time. We also tried to physically wire a mesh node to another microcontroller that would connect to the Internet. We were unable to establish a reliable serial connection; the data came through garbled and corrupted. As a result, we were unable to have the mesh network connect to the web server.
Accomplishments that we're proud of
We are proud of successfully establishing a mesh network and verifying its multi-hop capabilities, even if we only sent dummy data over it.
What we learned
Although we didn't complete a fully working hack, our journey introduced us to several new IoT protocols. None of us have ever used long-range radio communications on a microcontroller before, nor had we worked with mesh networks or MQTT. The exploration and experimentation we did this weekend will aid us in future IoT projects.
What's next for Mesh Network Security System
We have all of the parts of the system working individually: We can read sensor data, establish a mesh network, and run a server that can respond to events. The last remaining step for a functioning project would be to connect them all together and get the data flowing as intended. With a little extra work, the system could achieve all of the goals we set out for it.
Log in or sign up for Devpost to join the conversation.