IoT Weather and UV lIight with LoRaWAN and The Things NetworkObjectives:
Read more- Monitor in real-time key environmental parameters such as temperature, humidity, atmospheric pressure, VOC gases, airborne particulates (PM2.5, PM10), UV light intensity, and rain detection.
- Transmit data wirelessly over long distances using LoRaWAN technology, managed via The Things Network (TTN).
- Visualize data locally on an OLED screen for quick readings.
- Send data to a cloud platform (integrated with TTN) for storage, historical analysis, and remote visualization.
- Learn about the integration of multiple sensors and end-to-end LoRaWAN communication with TTN.
Target Level: Intermediate (requires basic knowledge of programming, electronics, and IoT/LoRaWAN concepts).
Prerequisites:- Fundamentals of programming in Arduino (C/C++).
- Basic concepts of digital and analog electronics.
- Familiarity with the Arduino IDE or PlatformIO development environment.
- Understanding of the principles of low-power, long-range wireless communication (LoRaWAN).
- Basic knowledge of The Things Network (TTN) and cloud IoT platforms (e.g., Ubidots, Grafana Cloud).
- Hardwre:
📷WISBLOCK Base:RAK1907 Base Board Rind Gen
- WISBLOCK Core: RAK4631 Nordic NRF52840 (with integrated LoRaWAN📷
- 📷WISBLOCK Sensors:
- RAK12030 rain sensor
- RAK12019 LTR-390UV-01 UV Light Sensor📷.
- WISBLOCK Miscellaneous:
- RAK1921 OLED Display
- Other Components / Accessories:
- RAK7268V2 WisGate Edge Lite 2 (LoRaWAN Gateway)
- Battery Connector Cable
- Solar Panel Connector
- Solar Panel
- Screwdriver
- Waterproof enclosure (optional, but highly recommended for outdoor deployment)
- Software:
- Arduino IDE or PlatformIO
- Arduino libraries for RAK modules (e.g., RAKwireless_RAK4631_BSP) and specific sensor libraries (e.g., Adafruit_BME680, SparkFun_PMSA003I_Arduino_Library, Adafruit_SSD1306, Adafruit_GFX).
- Firmware and configuration software for the RAK7268V2 gateway (web interface).
- Account on The Things Network (TTN).
- Account on a cloud IoT platform (e.g., Ubidots, Grafana Cloud) for integration with TTN.
Estimated Duration: 8-12 hours (including assembly, programming, LoRaWAN network setup, and cloud platform configuration).
Learning Outcomes:- Ability to assemble and configure modular WISBLOCK components.
- Skill in programming microcontrollers for reading and processing data from multiple sensors.
- In-depth understanding of LoRaWAN communication, including device activation (OTAA/ABP) and payload formatting for The Things Network.
- Experience in configuring and managing a LoRaWAN gateway in TTN.
- Knowledge of integrating IoT data from TTN with cloud platforms for visualization, analysis, and alert setup.
- Development of a functional and autonomous environmental monitoring system.
- Hardware Assembly: Connect the RAK4631 (Core) module to the RAK1907 (Base). Connect the sensors (BME680, UV, Rain, Particulate) and the OLED Display to the corresponding I2C/analog/digital ports of the RAK1907. Connect the battery cable and solar panel for power.
- Development Environment Setup: Install the Arduino IDE or PlatformIO and add support for the RAK4631 board. Install the necessary libraries for each sensor and the OLED.
- Gateway Configuration (RAK7268V2) in TTN: Connect the gateway to the network (Ethernet or Wi-Fi). Access its web interface and configure it to connect to The Things Network using the Semtech Packet Forwarder or Basic Station protocol. Register the gateway in your TTN account.
- Device (RAK4631 Node) Configuration in TTN: In your The Things Network account, create an application and register a new device. Select OTAA (Over-the-Air Activation) as the activation type. Note down the DevEUI, AppEUI (or JoinEUI), and AppKey provided by TTN. These will be needed in the node's Arduino code.
- Node Programming (RAK4631):
- Write the code to initialize each sensor and read its data.
- Implement the logic to display key data on the OLED Display.
- Configure the RAK4631 as a LoRaWAN node using the TTN credentials.
- Package sensor data into an efficient format for LoRaWAN (Cayenne LPP is recommended for its ease of use and automatic decoding in TTN, or a custom binary format for more control).
- Implement a periodic data transmission cycle and low-power modes (deep sleep) to optimize battery life.
- Payload Decoder Configuration in TTN: If you use Cayenne LPP, TTN will decode it automatically. If you use a custom binary format, you will need to write a payload formatter (decoder) in JavaScript in the TTN console to convert the received bytes into readable values.
- TTN Integration with Cloud IoT Platform: In the TTN console, configure an integration (e.g., webhook or MQTT) to send the decoded data to your cloud IoT platform (e.g., Ubidots, Grafana Cloud).
- Cloud IoT Platform Configuration (Ubidots/Grafana): Create a dashboard to visualize sensor data in real-time using charts, gauges, and tables. Set up alert rules based on thresholds (e.g., high particulate levels, heavy rain, extreme temperature).
- Testing and Calibration: Perform field tests to verify data transmission, LoRaWAN range, and sensor reading accuracy. Adjust alert thresholds as needed.
- LoRaWAN Connectivity Issues: Ensure the gateway is within range of the node and that the LoRaWAN credentials (DevEUI, AppEUI, AppKey) are correct and match on both the node and The Things Network console. Verify the frequency and channel plan (e.g., EU868). Make sure the gateway is connected and active in TTN.
- Power Consumption: Frequent sensor readings and OLED usage can increase power consumption. Optimize the code for low power consumption (microcontroller sleep mode between readings/transmissions) to maximize battery life, especially with the solar panel. Consider disabling the OLED when not needed.
- Payload Decoding in TTN: Ensure the payload formatter in The Things Network correctly decodes the binary data sent by the node. Use the "Live data" tool in the TTN console to view the raw payload and compare it with the expected format.
- Sensor Accuracy: Some sensors may require calibration or compensation for environmental factors (e.g., the BME680 for VOCs). Consider the sensor's location to avoid biased readings (e.g., rain sensor under an overhang).
- Interference: Locate the gateway and node away from sources of electromagnetic interference that could affect LoRaWAN communication.
- The node successfully transmits data from all sensors reliably via LoRaWAN to TheThings Network.
- The gateway receives and forwards data correctly to The Things Network.
- Data is correctly decoded and visualized in real-time on the cloud platform clearly and accurately.
- The system is capable of operating autonomously with solar power and battery for an extended period (e.g., weeks or months).
- The code is well-documented, modular, and resource-efficient.
11 projects • 9 followers
Teacher at Maude Studio & Erasmus+ project member: "Developing Solutions to Sustainability Using IoT" (2022-1-PT01-KA220-VET-000090202)
Thanks to Jose Migue fuentes.
Comments