- Monitor in real-time key environmental conditions (temperature, humidity, air quality, and gases) within an electronics laboratory.
- Detect critical events such as elevated gas levels or sudden temperature changes.
- Visualize collected data remotely for informed decision-making.
- Generate automatic alerts when predefined thresholds are not met.
- Gain practical experience in implementing IoT solutions with RAK Wireless hardware and cloud platforms.
Intermediate. Requires basic knowledge of electronics, programming (C++ for microcontrollers), and networking/IoT concepts.
Prerequisites- Fundamentals of digital and analog electronics.
- Basic C++ programming (for Arduino/ESP32).
- Basicnetworking concepts (LoRaWAN).
- Superficial knowledge of cloud IoT platforms (e.g., The Things Stack, Ubidots, Grafana Cloud).
- Familiarity with development tools (VS Code, PlatformIO, or Arduino IDE).
- Base:
- 📷1 x RAK19007 WisBlock Base Board 2nd Gen
- Core:
- 1 x RAK4631 Nordic nRF52840 (for LoRa and Bluetooth connectivity)
- Sensors(essential for environmental control):
- 1 x RAK1906 BOSCH BME680 Environment Sensor (temperature, humidity, pressure, VOC air quality)
- 1 x RAK12004 MQ2 Gas Sensor (combustible gases and smoke)
- Interfaces:
- 1 x RAK13009 QWIIC Module (for easy connection of other I2C sensors if needed)
- Miscellaneous:
- 1 x RAK1921 SSD1306 OLED Display (for local data visualization)
- 1 x RAK7268V2 WisGate Edge Lite 2 (LoRaWAN Gateway for sending data to the cloud)
- Battery Connector Cable (if battery power is required, although constant power is preferred for a laboratory)
- Screwdriver(for assembly)
- USB connection cables (for programming)
- 5V power supply for the Gateway and WisBlock module.
- Enclosure or case to protect the device (optional, but recommended for a laboratory).
- Integrated Development Environment (IDE):
- PlatformIO (recommended for its cross-platform support) or Arduino IDE.
- Libraries/SDKs:
- RAK WisBlock SDK (available on GitHub).
- Libraries for specific sensors (BME680, MQ2).
- LoRaWAN library (integrated into the RAK SDK for RAK4631).
- Cloud IoT Platform:
- The Things Stack (for the LoRaWAN network).
- Ubidots, Grafana Cloud, or ThingsBoard (for data visualization, dashboards, and alerts).
- Gateway Software:
- RAK7268V2 Firmware (accessed via web browser for configuration).
- Monitoring Tools (optional):
- MQTT Explorer (for debugging MQTT messages).
- WisBlock node configuration and programming: 6-10 hours
- LoRaWAN Gateway configuration: 2-3 hours
- Cloud platform configuration (visualization/alerts): 4-6 hours
- Testing and debugging: 3-5 hours
- Total Estimated: 15-24 hours (can vary greatly depending on prior experience).
Upon completing this activity, you will be able to:
- Design and implement a basic IoT-based environmental monitoring solution.
- Program microcontrollers to read data from key environmental sensors.
- Configure and use a LoRaWAN Gateway for long-range connectivity.
- Integrate IoT devices with cloud platforms for data visualization and analysis.
- Set up rules and alerts based on data thresholds.
- Understand the data flow from sensor to cloud visualization.
- Debug common problems in IoT systems.
1. Preparation of the Development Environment
- Install PlatformIO: Follow the instructions to install PlatformIO IDE in VS Code.
- Install the RAK WisBlock SDK: Clone the RAK WisBlock SDK repository from GitHub.
- Install sensor libraries: Add the necessary libraries for the BME680 and MQ2 to your PlatformIO project.
2. Hardware Assembly
- Connect the Core: Connect the RAK4631 to the "CORE" slot of the RAK19007 Base Board.
- Connect Sensors:
- Connect the RAK1906 (BME680) to a sensor slot (e.g., A).
- Connect the RAK12004 (MQ2) to an analog or digital sensor slot depending on its interface.
Connect OLED Display: Connect the RAK1921 (OLED Display) to an interface slot (I2C).
3. Programming the WisBlock Node (RAK4631)
- Initialization:Configure the necessary I2C and UART pins for the sensors.
- SensorReading: Write code to read data from each sensor at regular intervals (e.g., every 5 minutes).
- BME680:Temperature, humidity, pressure, air quality index (IAQ).
- MQ2:Gas level (may require calibration).
- Local Visualization (OLED): Display the most relevant values on the OLED screen.
- LoRaWAN Payload: Package sensor data into an efficient LoRaWAN payload format (e.g., using Cayenne LPP or a custom binary format to save bytes).
- LoRaWAN Configuration:
- Obtain DevEUI, AppEUI (or JoinEUI), and AppKey credentials from The Things Stack (TTS).
- Configure the RAK4631 in OTAA (Over-The-Air Activation) mode.
- Send LoRaWAN data to the Gateway.
4. LoRaWAN Gateway Configuration (RAK7268V2)
Network Connection: Connect the Gateway to your local network (Ethernet or Wi-Fi).
- Access Web Interface: Access the Gateway's administration interface via your web browser (the default IP or the one assigned by your router).
- LoRaWAN Configuration:
- Configure the Gateway to point to your The Things Stack server (or another Network Server of your choice). 90
- Ensure that the LoRaWAN frequencies are correct for your region (e.g., EU868, US915).
5. Cloud IoT Platform Configuration (The Things Stack + Ubidots/Grafana)
- The Things Stack (TTS):
- Create an application and register your device (WisBlock node) using the DevEUI, AppEUI, and AppKey credentials from step 3.
- Configure a "Payload Formatter" (or Decoder) so that TTS can interpret the binary data you send from the node.
- Configure an integration (e.g., MQTT, HTTP Webhook) to send the decoded data to Ubidots, Grafana Cloud, or ThingsBoard.
- Ubidots / Grafana Cloud / ThingsBoard:
- Create devices/data sources: Configure "devices" or "data sources" on the platform that reflect your node's sensors.
- Create Dashboards: Design dashboards with widgets (graphs, gauges, tables) to visualize real-time and historical data for temperature, humidity, gases, etc.
- Configure Alerts: Set up alert rules (e.g., if temperature > 30°C, if gas > critical threshold) to send notifications via email, SMS, or Telegram.
6. Testing and Debugging
- LoRaWAN Connectivity Verification: Check the TTS console to confirm that "uplinks" (messages from the node to the Gateway) are being received correctly.
- Data Validation: Ensure that the decoded data in TTS and on your visualization platform is correct and makes sense.
- Sensor Testing: Vary environmental conditions (e.g., breathe near the gas sensor) to verify that the sensors respond and data updates.
- Alert Testing: Force conditions to trigger alerts and verify that notifications are sent.
Challenges and Troubleshooting Tips
- LoRaWAN Connectivity Problems:
- Tip: Ensure that credentials (DevEUI, AppEUI, AppKey) match exactly on the node and in TTS.
- Verify that frequencies are correct for your region. Make sure the Gateway is online and connected to TTS.
- Incorrect/Null Sensor Data:
- Tip: Check sensor connections to the WisBlock. Review the sensor reading code;
- these are often initialization or incorrect I2C/UART readings issues.
- Ensure that libraries are compatible with your Core.
- Malformed LoRaWAN Payload:
- Tip:Use a tool like MQTT Explorer to see the raw payload arriving at TTS.
- Compare with Cayenne LPP documentation or your custom binary format. Debug the "Payload Formatter" in TTS.
- Alerts Not Triggering:
- Tip:Verify the configured thresholds. Make sure data is reaching the alert platform correctly and that attribute/variable names match.
- Check notification settings (email, SMS).
- Power Consumption (if using battery):
Tip: For a laboratory, use constant power. If considering battery, optimize the code for low-power mode (sleep modes) and adjust data transmission frequency.
- Gas Readings:
- Tip: MQ sensors need a "warm-up" time to stabilize.
- They are not laboratory precision, only for threshold detection. They can react to alcohol or soldering fumes.
Evaluation Criteria
The success of this project will be evaluated based on:
- HardwareFunctionality: The WisBlock node is correctly assembled, and all sensors are properly connected and powered.
- Data Reading: The microcontroller code correctly reads data from all specified sensors.
- LoRaWAN Connectivity: Data from the node is successfully transmitted to the Gateway and received by The Things Stack.
- Cloud Data Processing: Data is correctly decoded and sent to the visualization platform (Ubidots/Grafana).
- Visualization and Dashboard: A clear and functional dashboard is created, displaying real-time and historical data from all sensors.
- Alert System: Alerts for at least two critical environmental parameters (e.g., high temperature, elevated gas) are successfully configured and tested.
- Code Documentation: The microcontroller code is commented and readable.
- Project Presentation: Clear explanation of the architecture, components, operation, and results.
Comments