greenhouse monitoring with rak wisblock and blues notecard

Build a Dual-Connectivity Greenhouse Monitor Using RAK WisBlock & Blues Notecard with LoRaWAN, Cellular, TTN & Ubidots.

Greenhouse Monitor with RAK WisBlock and Blues Notecard

Greenhouses require continuous monitoring to maintain stable growing conditions. Key variables such as temperature, humidity, light intensity, and soil moisture directly affect plant health, and even small fluctuations can reduce crop quality and yield. Relying on manual checks or isolated sensors often limits visibility and delays response to environmental changes.

This guide explains how to build a modular greenhouse monitoring device using the WisBlock modular IoT hardware platform developed by RAK, along with the Blues Notecard, a low-power cellular System-on-Module (SoM). Environmental, light, and soil sensors connect to the RAK4631 MCU, which collects and prepares real-time measurements for transmission.

The system supports dual connectivity: LoRaWAN via a WisGate gateway and The Things Network, or cellular communication through the Blues Notecard and Notehub. Sensor data is forwarded to Ubidots dashboards, allowing for remote monitoring, alerts, and data-driven greenhouse management.

🔑
KEY TAKEAWAYS
  • RAK4631 centralizes sensor acquisition, payload generation, and network control within a modular WisBlock core.
  • Dual connectivity enables LoRaWAN infrastructure communication or direct cellular cloud access.
  • Power design must account for cellular peak current, not just average consumption, when using the Blues Notecard.
  • Payload decoding and visualization are separated across TTN, Notehub, and Ubidots.
  • Soil moisture readings require calibration awareness; raw values indicate relative moisture trends.
  • Gateway placement and RF environment directly impact LoRaWAN reliability and battery life.
  • Firmware configuration determines network behavior, defining whether LoRaWAN and cellular act as backup links or parallel transports.



 

Temperature and Humidity Solution
Figure 1: RAK1906 environmental sensor measuring temperature and humidity on WisBlock

 

Use Case and Scope

This guide follows the Blues Wireless Accelerator reference implementation, which demonstrates how environmental and soil data can be transmitted from field devices to cloud platforms. The resulting data enables remote monitoring and alerts when conditions exceed defined thresholds.

The project reproduces the architecture described in the official repository, beginning with the hardware configuration shown in Figure 4. The guide then proceeds through firmware configuration and cloud integration.

System Architecture

The RAK4631 (WisBlock Core) serves as the main MCU in the system. It reads data from the RAK1906 environmental sensor, the RAK1903 light sensor, and the soil sensor connected through RAK12023. The MCU processes the measurements, formats the payload, and manages network communication.

The system supports two communication paths: LoRaWAN and cellular connectivity.

LoRaWAN Data Flow

Sensors → RAK4631 → RAK7268V2 → TTN → TTN Webhook → Ubidots

Cellular Data Flow (Blues Notecard)

Sensors → RAK4631 → Blues Notecard → Notehub → HTTP/HTTPS webhooks → Ubidots

For LoRaWAN, TTN applies the payload decoder and forwards the structured JSON to Ubidots via a webhook. For cellular connection, the Blues Notecard sends structured data to Notehub, which then routes it to Ubidots

Authentication occurs independently at each layer:

  • LoRaWAN devices authenticate to TTN using Over-The-Air Activation (OTAA).

  • TTN employs a Ubidots API token for webhook delivery.

  • The Notecard authenticates to Notehub using its device UID.

The firmware reads Modbus registers, builds the payload, and initiates data transmission. TTN and Notehub handle routing, while Ubidots stores, visualizes, and processes the sensor data.

Hardware and Software Requirements

Necessary Hardware
Figure 2: RAK WisBlock hardware components for greenhouse monitoring including RAK4631, RAK1906, and Blues Notecard 

Gateway

Back-End Services 

Hardware Connection

The hardware adopts a modular approach provided by WisBlock. The complete firmware is developed and available in the official RAKwireless GitHub repository, and the IoT data visualization platforms are cloud-ready. The project developed by Blues Wireless is replicated by using JSON data to access and transmit the required information.

Connecting the WisBlock elements is straightforward:

  1. Mount the core module onto the core slot, and attach RAK1906 and RAK1904 sensors to the sensor slots A and B. In this instance, you will use the RAK19001 motherboard, but here you can select another WisBlock base board.

  2. Connect the Blues Notecard through the WisBlock Blues Carrier Module and the RAK12023, then plug the assembly into the baseboard’s IO slots.

  3. Plug the soil moisture sensor into the RAK12023.

  4. For deployment, place the assembled device inside a WisBlock enclosure designed for this purpose.

Final project installation view
Figure 3: Assembled RAK WisBlock greenhouse monitor installed inside enclosure

 

Now that the devices are connected, you can begin programming. 

⚠️
IMPORTANT

The Notecard requires a peak current of 2 A to send data. The VDD pin of the WisBlock cannot provide this current, so it is recommended to use a battery or connect an additional USB cable to the Notecard during your project testing.

 

Blues Hardware Assembly

After completing the instructions outlined in the hardware configuration and uploading the code provided by Blues on GitHub to the notecard, the final assembly is shown in the image below:

 

Final Result Blues Wireless Version
Figure 4: Blues Notecard assembled with RAK WisBlock for cellular greenhouse monitoring


Firmware Development

The code can be downloaded from our official GitHub repository. It was developed using Visual Studio Code and PlatformIO, which are two widely used tools for programming firmware. 

In case the libraries are not available on PlatformIO, you can find them from the following sources:

If you need more information about how to configure and code your WisBlock setup with PlatformIO, check the following guide for setting up WisBlock on PlatformIO

Cloud Integration and Data Decoding

This section explains how sensor data is transmitted from the RAK4631 to cloud platforms using either LoRaWAN or cellular connectivity. It covers the required network configuration, payload decoding, and integration procedures for TTN, Notehub, and Ubidots.

With this setup, it ensures that environmental measurements are accurately transmitted, interpreted, and visualized for monitoring and alert generation.

LoRaWAN Communication

Communication with end devices over LoRaWAN can be established through a public network such as Helium or through a private network built with a LoRaWAN gateway. In this case, the setup uses the second option.

The following are required for this process:

The configuration process can be completed in a few minutes. For step-by-step instructions, refer to the RAK7268V2 gateway documentation.

Once the gateway has been successfully configured and connected to the TTN LNS, apply the provided payload decoder to interpret the transmitted data.


TTN Payload Decoder

async function formatPayload(args){

    var ubidots_payload = {};

    // Log received data for debugging purposes:

    // console.log(JSON.stringify(args));

    // Get RSSI and SNR variables using gateways data:

    var gateways = args['uplink_message']['rx_metadata'];

    for (const i in gateways) {  

      // Get gateway EUI and name

      var gw = gateways[i];
      var gw_eui = gw['gateway_ids']['eui'];
      var gw_id = gw['gateway_ids']['gateway_id'];

      // Build RSSI and SNR variables

      ubidots_payload['rssi-' + gw_id] = {
        "value": gw['rssi'],
        "context": {
          "channel_index": gw['channel_index'],
          "channel_rssi": gw['channel_rssi'],
          "gw_eui": gw_eui,
          "gw_id": gw_id,
          "uplink_token": gw['uplink_token']

        }

      }

      ubidots_payload['snr-' + gw_id] = gw['snr'];
  
    }

    // Get Fcnt and Port variables:

    ubidots_payload['f_cnt'] = args['uplink_message']['f_cnt'];
    ubidots_payload['f_port'] = args['uplink_message']['f_port'];

    
    // Get uplink's timestamp

    ubidots_payload['timestamp'] = new Date(args['uplink_message']['received_at']).getTime(); 
    
    // If you're already decoding in TTS using payload formatters, 
    // then uncomment the following line to use "uplink_message.decoded_payload".
    // PROTIP: Make sure the incoming decoded payload is an Ubidots-compatible JSON (See https://ubidots.com/docs/hw/#sending-data)
    // var decoded_payload = args['uplink_message']['decoded_payload'];
    // By default, this plugin uses "uplink_message.frm_payload" and sends it to the decoding function "decodeUplink".
    // For more vendor-specific decoders, check out https://github.com/TheThingsNetwork/lorawan-devices/tree/master/vendor

    let bytes =  Buffer.from(args['uplink_message']['frm_payload'], 'base64');
    var decoded_payload = decodeUplink(bytes)['data'];

    // Merge decoded payload into Ubidots payload
    Object.assign(ubidots_payload, decoded_payload);
    return ubidots_payload

  }
  
  function decodeUplink(bytes) {

    // Decoder for the RAK1906 WisBlock Environmental Sensor (https://store.rakwireless.com/products/rak1906-bme680-environment-sensor)

    var decoded = {};

    if (bytes[0] == 1) {

        // If received data is of Environment Monitoring type
        decoded.air_humidity = (bytes[0] << 8 | (bytes[1])) / 100;
        decoded.air_temperature = (bytes[2] << 8 | (bytes[3])) / 100;
        decoded.air_pressure = (bytes[6] |(bytes[5] << 8) | (bytes[4] << 16)) / 100;
        decoded.light_level = (bytes[9] |(bytes[8] << 8) | (bytes[7] << 16));
        decoded.soil_moisture = (bytes[10] << 8 | (bytes[11]));
        decoded.soil_temperature = (bytes[10] << 8 | (bytes[11])) / 10;

    } 
    return {"data": decoded};
  }
  

  module.exports = { formatPayload };

 

Blues Notecard and Notehub Setup

Create an account on the Notehub page and start a new project. For step-by-step instructions, refer to the Blues documentation.

Ubidots JSON Mapping for Notehub

🗒️
NOTE

This JSON file is used when the transmitted data is sent via the Blues Wireless hardware.

 

{

    "air_temperature": {"value": body.air_temperature},
    "air_humidity": {"value": body.air_humidity},
    "air_pressure": {"value": body.air_pressure},
    "light_level": {"value": body.light_level},
    "soil_moisture": {"value": body.soil_moisture},
    "soil_temperature": {"value": body.soil_temperature}

}

 

Ubidots Dashboard and Alerts

The Blues accelerator executes business logic directly through Notehub and Notecard. This design, while functional, limits scalability across other networks and reduces accessibility for non-expert users who require graphical data presentation.

Ubidots provides a solution by enabling alarms and signals that control maximum and minimum data ranges. These features allow for easier data adjustment and continuous monitoring for errors or out-of-range values. 

Additionally, Ubidots supports multiple notification channels, including SMS, email, and Telegram, ensuring that important events are reported quickly.

Following the configuration steps in the Ubidots Events setup guide, two events can be established: 

Event Trigger Condition Notification
Low Crop Humidity Crop humidity falls below the defined threshold Email notification sent to the user
Low Ambient Temperature Ambient temperature drops below the defined limit Email notification sent to the user

These alerts allow continuous monitoring of environmental conditions and help ensure that critical changes affecting crop health are detected and communicated promptly.

 

Ubidots Events
Figure 5: Ubidots event configuration for low humidity and temperature alerts in greenhouse monitoring 

 

After completing the Notehub and TTN integration using Ubidots’ official guides, your dashboard should look similar to Figure 6:
 

Ubidots Dashboard Result
Figure 6: Ubidots dashboard displaying greenhouse sensor data from RAK WisBlock via LoRaWAN and Blues Notecard

 

From there, data can be sent to Ubidots using LoRaWAN or NB-IoT/BLE/Cat-1. 

Implementation Notes

Comparison of RAKwireless vs Blues Wireless
Figure 7: Comparison table of RAKwireless and Blues Wireless greenhouse monitoring implementations
  • Network Flexibility: The system can transmit data through LoRaWAN or cellular connectivity, depending on available infrastructure.

  • Power Requirements: Cellular transmission using the Blues Notecard requires sufficient peak current, so the power supply must be sized accordingly.

  • Component Availability: Some components referenced in the Blues Wireless accelerator may no longer be available and may require compatible alternatives.

  • Deployment Environment: Gateway placement and RF conditions can affect LoRaWAN reliability and overall data transmission performance.

Summary

This project shows how WisBlock’s modular architecture can be used to build a deployable environmental monitoring device without a custom hardware design. By combining sensor modules, the RAK4631, and LoRaWAN/cellular connectivity, the system adapts to different deployment environments while maintaining consistent firmware and cloud workflows.

Key characteristics of the implementation include:

  • Modular Hardware Integration: WisBlock modules allow sensors and communication components to be assembled without a custom PCB design.

  • Dual Connectivity Support: The system can operate through LoRaWAN infrastructure or cellular networks, depending on deployment requirements.

  • Cloud-Based Monitoring: Platforms such as Ubidots enable dashboards, data visualization, and automated alerts.

  • Efficient Development Workflow: Compatibility with Arduino and PlatformIO simplifies firmware development and deployment.

The resulting system provides a scalable foundation for greenhouse monitoring deployments where environmental visibility, remote access, and reliable data transmission are required.

FAQs

1. Why does the Blues Notecard reset or fail during data transmission?

The Blues Notecard can draw up to 2 A peak current when transmitting over NB-IoT or LTE Cat-1. The VDD output of the RAK19001 WisBlock Baseboard cannot supply that current. When the Notecard begins a transmission burst, voltage drops occur, causing brownouts or repeated resets.

The visible effect is failed Notehub sync, incomplete uplinks, or random device reboots.

To prevent this, power the system with a properly rated LiPo battery capable of handling peak current, or provide a dedicated USB supply during testing. Always size power systems for peak transmission current, not just average consumption.

2. The RAK4631 joins TTN successfully, but no sensor data appears in Ubidots. What is wrong?

If the device joins The Things Network but Ubidots shows no environmental variables, the issue is typically in the TTN payload decoder or webhook integration.

The provided decoder converts a Base64 payload into structured JSON. If it is not correctly pasted into TTN’s Payload Formatter or if the FPort in the firmware does not match the decoder logic, Ubidots will receive empty or malformed data.

Check that:

  • The decoder is active in TTN.

  • The uplink FPort matches the firmware configuration.

  • The Ubidots webhook integration is enabled.

If RSSI/SNR appears but sensor values do not, the decoding structure likely does not match the firmware payload.

3. Why are my soil moisture readings unstable or unrealistic?

The soil moisture sensor connected through RAK12023 measures the electrical properties of the soil, not the direct volumetric water content. Soil type, salinity, fertilizer concentration, and compaction all influence readings.

If the probe is partially exposed to air, loosely inserted, or placed near irrigation emitters, readings may fluctuate sharply.

For better stability:

  • Insert the probe fully into compacted soil.

  • Avoid placement near drip lines.

  • Establish dry and saturated reference values.

  • Treat raw values as relative trends unless calibration is performed.

Without calibration, the sensor is best used for detecting changes over time rather than absolute moisture percentage.

4. Can LoRaWAN and cellular (Blues Notecard) run at the same time?

No. In this implementation, LoRaWAN and cellular do not operate simultaneously. The system is designed to use LoRaWAN as the primary communication path and switch to the Blues Notecard only when LoRaWAN transmission fails.

This means the Notecard acts as a failover link, not a parallel transport. Under normal operation, sensor data is sent through the LoRaWAN path. If the firmware detects that LoRaWAN is unavailable or unsuccessful, it reroutes transmission through the cellular path.

The main effect is improved communication resilience without the constant power cost of running both links at the same time. This approach helps preserve battery life while maintaining a backup path for remote monitoring.

5. Why does my RAK7268V2 gateway receive uplinks, but RSSI or SNR values are poor?

Low RSSI or SNR is often caused by antenna placement and greenhouse structure. Metal frames, irrigation pipes, and reflective surfaces inside greenhouses attenuate and distort RF signals.

Poor link quality leads to packet loss, increased retransmissions, and higher battery consumption.

To improve performance:

  • Mount the gateway antenna above roof level if possible.

  • Keep antennas away from metal surfaces.

  • Verify correct regional frequency configuration (EU868, US915, etc.).

  • Use a properly tuned antenna for your frequency band.

Weak RF conditions reduce network reliability even if the gateway still shows packet reception.


harold-duarte.png

Harold Duarte

Harold is an electronics engineer and senior technical content writer at RAKwireless. He is passionate about learning and developing new solutions for IoT, making it #IoTMadeEasy.


Changelog

  • Version 1 - Greenhouse Monitoring with RAK WisBlock and Blues Notecard
    • Author: Harold Duarte
    • Reviewer: Karla Jimenez
    • Date Published: 10/02/2025

Updated