In this project, we developed a LoRaWAN-based mesh network designed for long-range, low-power communication between multiple sensor nodes and a central gateway. The system was created to transmit temperature and humidity data from sensor nodes to a cloud-based database using LoRaWAN technology and Firebase Realtime Database for data storage and visualization. This setup enables real-time remote monitoring and has wide-ranging applications, including smart agriculture, environmental monitoring, and building automation.
Background and Motivation
LoRa (Long Range) is a low-power, wide-area network (LPWAN) technology that enables communication over long distances with minimal energy consumption. It is ideally suited for scenarios where devices need to communicate intermittently over extended ranges, such as in rural areas, without requiring a constant power supply. LoRaWAN, the networking protocol built on top of LoRa, enhances this communication by providing a framework for the devices to organize themselves into a network and relay messages across nodes, forming a mesh topology.
A key motivation for this project was to explore the potential of LoRaWAN for real-time monitoring applications, where low-power sensors are deployed in remote or inaccessible locations. By leveraging mesh network topologies, we aimed to improve the network’s reliability and scalability. Mesh networks allow data to travel through intermediate nodes before reaching the central gateway, increasing the communication range and adding redundancy in case of node failures.
Project Goals and Objectives
The project’s primary goal was to create a wireless sensor network using LoRaWAN that could collect environmental data—specifically temperature and humidity—from multiple sensor nodes and transmit this data to a central gateway. The gateway would then send the data to Firebase for cloud storage and visualization. The project’s main objectives were as follows:
- LoRaWAN Mesh Network Design: Develop a LoRaWAN-based mesh network capable of supporting multiple sensor nodes. The mesh topology should allow for long-range communication with the ability to relay messages across nodes for increased range and reliability.
- Sensor Node Implementation: Equip the sensor nodes with accurate temperature and humidity sensors and ensure they can reliably transmit the collected data to the central gateway.
- Central Gateway: Implement a gateway capable of receiving data from the sensor nodes and sending it to a Firebase Realtime Database via Wi-Fi for storage, analysis, and real-time monitoring.
- Real-time Monitoring and Visualization: Set up a web-based interface using Firebase to visualize the collected data in real-time, allowing for remote monitoring.
- Scalability: Ensure the system is scalable, meaning new sensor nodes can be easily added without major changes to the architecture.
- System Performance Evaluation: Evaluate the system’s performance in terms of communication range, data accuracy, reliability, and power efficiency.
System Requirements and Design Specifications
The design of the wireless sensor system was guided by several core requirements:
1. LoRaWAN Mesh Network
The network needed to support long-range, low-power communication using LoRa technology. A mesh topology was implemented to allow sensor nodes to relay messages across multiple hops before reaching the gateway. This extended the communication range and improved reliability by providing multiple pathways for data transmission. Adaptive data routing was employed to optimize network efficiency.
2. Sensor Nodes
Each sensor node was equipped with an AHT20 temperature and humidity sensor. These sensors provided accurate environmental data, which was sent to the RFM95W LoRa transceiver module for wireless communication with the gateway. The nodes operated on minimal power, making them suitable for long-term deployments in remote areas. The microcontroller used to manage the sensors and communication was an ESP32 WROOM, chosen for its versatility and low power consumption.
3. Central Gateway Device
The gateway was built using an ESP32 microcontroller, which handled communication with the sensor nodes and relayed data to the Firebase cloud database. The RFM95W LoRa transceiver was responsible for receiving sensor data, while the onboard Wi-Fi module enabled internet connectivity for transmitting data to Firebase. The gateway was designed to handle simultaneous communication with multiple sensor nodes, ensuring that the system could scale up as needed.
4. Cloud Storage and Web-Based Platform
Firebase Realtime Database was used to store and manage the sensor data. The database provided a reliable and scalable platform for real-time data collection. A web-based platform was developed to allow users to monitor temperature and humidity levels across the sensor network in real-time. The data was visualized in a user-friendly interface, with the ability to access historical data and analyze trends over time.
System Architecture and Design
Components:
- AHT20 Sensor Module: Each node was equipped with an AHT20 sensor to measure temperature and humidity. These sensors provided highly accurate readings and were interfaced with the ESP32 microcontroller using I2C communication.
- RFM95W LoRa Transceiver: Responsible for long-range communication, the RFM95W transceiver allowed each node to send its data to the central gateway. It also supported message relay in the mesh network, allowing data to hop through intermediate nodes to reach the gateway.
- ESP32 Microcontroller: The ESP32 WROOM microcontroller was the heart of both the sensor nodes and the gateway. It managed data collection from the sensors, communication via LoRa, and data transmission to Firebase through Wi-Fi. The ESP32’s low-power mode allowed the nodes to operate for extended periods without frequent recharging.
- Firebase Realtime Database: Firebase acted as the cloud server for data storage and management. Data from the sensor nodes was transmitted to Firebase in JSON format, making it easy to store and retrieve. The Firebase platform also enabled real-time updates, allowing users to view the latest data as soon as it was uploaded.
- Web Interface: The web interface was built on top of Firebase and provided real-time visualization of the sensor data. Users could access the interface through any internet-connected device, making it convenient for remote monitoring. The platform supported data visualization, trend analysis, and historical data review.
Communication Protocols and Data Flow
The sensor nodes used LoRa communication to transmit data to the gateway. LoRa was selected due to its long-range and low-power characteristics, which are essential for IoT applications in remote areas. Each node periodically collected temperature and humidity data from the AHT20 sensor and transmitted this data to the gateway. The gateway received the data, processed it, and sent it to Firebase over a Wi-Fi connection.
In the mesh network topology, if a node was too far from the gateway to communicate directly, it could relay its data through other nodes, ensuring reliable communication across large distances. This allowed the network to scale easily and made it resilient to node failures, as data could be rerouted through alternative paths.
Results and Testing
The system was rigorously tested for stability, range, and scalability. A stress test was performed to evaluate the system’s stability, and it was found to be robust enough to run continuously overnight without any failures. In terms of range, the system was able to reliably transmit data across a considerable distance, though further testing could extend this range. Additionally, the system was tested with different numbers of nodes to confirm its scalability. The network successfully handled communication with up to three nodes, with potential for more nodes in larger deployments.
Performance and Analysis
The system performed exceptionally well in meeting its design objectives. The LoRaWAN mesh network provided long-range communication with low power consumption, making it ideal for IoT applications in remote areas. The AHT20 sensor module delivered accurate temperature and humidity measurements, while the ESP32 microcontroller efficiently managed data processing and communication tasks. The integration with Firebase allowed for real-time visualization of data and easy remote access through the web platform.
However, future improvements could focus on enhancing the system’s resilience by implementing advanced routing algorithms for better traffic management in the mesh network. This would further optimize the network’s performance, especially in scenarios with large numbers of nodes or challenging environmental conditions.
Conclusion
This project demonstrates the effectiveness of combining LoRaWAN technology with cloud-based storage for real-time environmental monitoring. The system’s scalability, low power consumption, and long-range communication make it an ideal solution for IoT applications in various fields. Future developments could involve adding more sensor types, enhancing the web platform, and improving the mesh network’s adaptability to large-scale deployments. With these enhancements, the system could serve as the backbone for more advanced IoT applications, from smart agriculture to urban environmental monitoring.