Step 1: Mounting WisBlock Parts
Assemble the RAK4631 WisBlock Core onto the RAK19003 WisBlock Base Board. Connect the RAK12033 motion sensor (positioned to detect pests at ground level or near plants). Attach the RAK1921 power module. Integrate the RAK13009 relay module, connecting it to a pest deterrent device (e.g., an ultrasonic repellent, a small motor to trigger a trap, or a solenoid valve for a natural repellent spray).
Step 2: Link to PC (via USB Cable)
Connect the assembled WisBlock unit (via the RAK4631) to your PC using a standard USB cable.
Step 3: Setup Arduino IDE and Load Files
Configure Arduino IDE for the RAK4631. Install libraries for the RAK12033 motion sensor. Load the Arduino sketch designed to detect motion and activate the relay based on a timer or number of detections.
Step 4: Upload the Code
Select RAK4631 Board and the correct COM port. Upload the code to your WisBlock device. After successful upload, open the Serial Monitor (set Baud rate to 15200) to observe motion detection events. The device will send motion detection events via LoRaWAN to your RAK7268V2 gateway. TheThingsNetwork will then forward this data to Node-RED. Node-RED will process the motion events and, if a certain number of detections occur within a time frame, send a command back via TheThingsNetwork (or directly if LoRaWAN downlink is used) to activate the RAK13009 relay, triggering the pest deterrent. This reduces reliance on chemical pesticides and minimizes crop damage.
Explanation: The code initializes the RAK4631, the RAK12033 motion sensor, and the RAK13009 relay module. It continuously monitors for motion events (indicating pest presence). When motion is detected, the device sends a motion_detected payload via LoRaWAN to TheThingsNetwork. Node-RED subscribes to this data stream. A flow in Node-RED analyzes the frequency of motion detections. If a rapid succession of movements or sustained activity suggests a pest infestation, Node-RED sends a control command (via TheThingsNetwork downlink) back to the device. Upon receiving this command, the RAK13009 relay activates, triggering an attached pest deterrent (e.g., an ultrasonic sound generator, a light, or a simple trap mechanism). This approach minimizes manual intervention and reduces reliance on chemical pesticides, promoting sustainable agriculture.
Comments