Step 1: Mounting WisBlock Parts
Assemble the RAK4631 WisBlock Core onto the RAK19003 WisBlock Base Board. Connect the RAK1906 environmental sensor and the RAK12004 ambient light sensor to available sensor slots on the base board. Attach the RAK1921 power module. Integrate the RAK13009 and/or RAK13010 relay modules, ensuring they are connected to the appropriate digital pins on the RAK19003 for control of external actuators (e.g., ventilation fans, heaters, shading systems).
Step 2: Link to PC (via USB Cable)
Connect the assembled WisBlock unit (via the RAK4631) to your PC using a standard USB cable. Verify that your PC recognizes the device and that any necessary drivers for the RAK4631 are installed.
Step 3: Setup Arduino IDE and Load Files
Download and install the Arduino IDE if you haven't already (available from arduino.cc). In the Arduino IDE, go to File > Preferences and add the RAKwireless Boards Manager URL. Then, open the Boards Manager from Tools > Board > Boards Manager and install the RAKwireless nRF52 Boards. Install necessary libraries via Sketch > Include Library > Manage Libraries...: Adafruit Unified Sensor, Adafruit BME680 (for RAK1906), and any specific libraries for the RAK12004 or generic relay control. Load the provided Arduino sketch (or an example modified for this project).
Step 4: Upload the Code
Select RAK4631 Board and the correct COM port in the Arduino IDE from Tools > Board and Tools > Port. Upload the code to your WisBlock device. After successful upload, open the Serial Monitor (set Baud rate to 15200) to verify sensor readings (temperature, humidity, light, gas) and confirm LoRaWAN join attempts. The code will periodically read sensor data, transmit it via LoRaWAN to your RAK7268V2 gateway, which then forwards it to TheThingsNetwork. ThingSpeak will receive this data and, based on defined thresholds (e.g., temperature too high, light too low), send commands back to the device via TheThingsNetwork (using ThingSpeak TalkBack/React) to activate or deactivate the relays, thus controlling the greenhouse environment.
Explanation: The code initializes the RAK4631, the RAK1906 environmental sensor (BME680 for Temp/Hum/Pressure/Gas), the RAK12004 ambient light sensor, and configures the digital pins for the RAK13009/RAK13010 relay modules. It continuously reads temperature, humidity, and light intensity. This sensor data is packaged into a LoRaWAN payload and transmitted to TheThingsNetwork. A ThingSpeak integration is set up to receive this data. On ThingSpeak, "React" applets are configured to monitor the incoming sensor values. For instance, if the temperature exceeds a set threshold, a "TalkBack" command is generated. The WisBlock device then queries ThingSpeak for pending commands. Upon receiving a command (e.g., "turn on fan"), the corresponding RAK13009/RAK13010 relay is activated, controlling the greenhouse's fan, heater, or shading to maintain optimal conditions for plant growth, thereby reducing energy consumption and optimizing resource use.









_M6kErcYJ84.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)




Comments