Added Sensor RAK12035 Soil Moisture and Temperature#2191
Added Sensor RAK12035 Soil Moisture and Temperature#2191KPrivitt wants to merge 11 commits intomeshcore-dev:devfrom
Conversation
Update Docs URL
|
This has been tested on a RAK19007 with a RAK12023 and a single RAK12035 (default I2C 0x20) sensor installed. Repeater and Companion versions have been tested and operated correctly for 48 hours. This has been tested with a RAK1901 and RAK1902 sensor installed which report their data on Channel 1. This sensor reports its data on Channel 2 (there is no conflict) A RAK12035 sensor was calibrated, and it now reports Soil Moisture percentage (0 - 100%) as well as the Soil Temperature. The displayed % Moisture value changes continuously when inserted into water and taken out and dried. The Temperature changes if it is placed in warm or cold water or held in your hand to warm it up. |
|
you're using main as source branch, can you change it to dev? |
|
|
||
| #if MESH_DEBUG && ARDUINO | ||
| #include <Arduino.h> | ||
| #define MESH_DEBUG_PRINT(F, ...) Serial.printf("DEBUG: " F, ##__VA_ARGS__) |
There was a problem hiding this comment.
The MESH_DEBUG_ logging functions are defined in src/MeshCore.h, we probably shouldn't redefine them in a sensor class.
| -D ENV_INCLUDE_VL53L0X=1 | ||
| -D ENV_INCLUDE_BME680=1 | ||
| -D ENV_INCLUDE_BMP085=1 | ||
| -D ENV_INCLUDE_RAK12035=1 |
There was a problem hiding this comment.
The ENV_INCLUDE_RAK12035 will probably need to be moved to the RAK4631 variant platformio.ini instead of global sensors, as it causes compilation errors for other devices, due to RAK WisBlock specific pin defines not existing.
src/helpers/sensors/RAK12035_SoilMoisture.cpp:246:18: error: 'WB_IO2' was not declared in this scope
You can see these errors in the automated tests run against this PR.
https://github.com/meshcore-dev/MeshCore/actions/runs/23731296245/job/69516637482?pr=2191
A RAK12035 Soil Moisture Sensor will be automatically detected and incorporated into the Telemetry and
can be accessed via the Telemetry screen in a repeater or a companion. The sensor data is displayed on Channel 2.
This code also supports Calibration of a sensor via a custom version of the firmware. See the RAK12035_SoilMoisture.cpp for instructions on the calibration procedure, which uses Channel 3. Calibration must be done to a sensor; each sensor will generate different capacitance output values. Calibration will ensure the reported Moisture will return a value between 0 and 100%.
The RAK12035 Soil Moisture Sensor connects to a RAK12023 which provide three connectors for sensors. This driver only supports one sensor attached with a default I2C address of 0x20. Support can be added for additional sensors via the Set Sensor Address command (which is incorporated). The sensors attached must all have a different I2C address (this can be done by changing an additional sensors I2C address to 0x21 or 0x22) and this code will need to include the initialization of each of these sensors (but this is not included).