firmware
firmware copied to clipboard
Add rak12035 VB Soil Monitor Tested & Working
Introduce the RAK12035 sensor as an environmental telemetry sensor, including necessary calibration checks and default values. Update relevant files to integrate the sensor into the existing telemetry system.
star of the show... https://docs.rakwireless.com/product-categories/wisblock/rak12035/quickstart/
This hardware is not just one module, but a couple.. RAK12023 and RAK12035 is the component stack, the RAK12023 does not seem to matter much and allows for multiple RAK12035 devices to be used.
Co-Authored-By: @fifieldt
This has been uploaded and tested on a RAK WIS Block hardware stack. RAK19007 WIS Block Base Board w/ RAK4631 WIS Block Module RAK12500 GPS WIS Block Module RAK12035 VB SOIL Monitor WIS Block Module w/ solar panel battery
Improvements could be made around the calibration of the RAK12035 devices.. I currently have it checking to see if the device has been pre-calibrated (this is highly recommended) and if not I am simply using some 'reasonable' values. the pre-calibration can be done by following the instructions and using the sketch supplied here [https://github.com/RAKWireless/RAK12035_SoilMoisture?tab=readme-ov-file#usage].
My build is currently in a waterproof case WISBLOCK Unify Enclosure and is use as part of an irrigation monitoring network we use to know when it is time to make certain adjustments to our physical irrigation resources. Pretty simple. Wanted to use WISBLOCK stuff, wanted to use Meshtastic, built using resilient enclosures and kept the code pretty simple.. Wanted the GPS for recovery purposes.. Got lots of help from @fifieldt. Things work well now. I have not finalized yet so no URL, but you can check on Instructables.com to find more detailed info about this build running in the wild (will post soon).
- NOTES:
- Currently this allows for a single RAK12035 to be installed and used with the RAK12023 WISBLOCK component.
- There is nothing in any of the device clients showing the data yet.. I will work on the android stuff first probably, cause I need that for my real life project..
- Future plan is, I will try to do some work to allow support for up to 3 RAK12035 soil monitors. I might work on allowing for some configuration values to be adjusted via the client apps as well once I start working on the android app a little. Other clients will (hopefully) get support as the community and myself have time to build it out. I would like to continue to add additional RAK WISBLOCK component support for different WISBLOCK components in general.
🤝 Attestations
- [ Y ] I have tested that my proposed changes behave as described.
- [ - ] I have tested that my proposed changes do not cause any obvious regressions on the following devices:
- [ Y ] Heltec (Lora32) V3
- [ N ] LilyGo T-Deck
- [ N ] LilyGo T-Beam
- [ Y ] RAK WisBlock 4631
- [ N ] Seeed Studio T-1000E tracker card
- [ N ] Other (please specify below)
@fifieldt
@fifieldt @thebentern this is same as toms branch, just has a few modifications and kept up to date with master.
@Justin-Mann can you change the protobufs submodule ref. We're ready to merge this otherwise
@thebentern I will... attempt that. ngl... you kind found my critical weakness... I barely understand what a protobuff is.. I will try to find the reference in the firmware project and correct.
@Justin-Mann I took care of it :-)
I am doing things and stuff.. hopefully i didn't undo a thing u did man. I'll keep working on the project and get a better understanding of how to update the proto stuff appropriately. I'm used to doing nuget things for all my dependencies...
@thebentern @fifieldt ty for all your help, sorry is a pita.
Tom things.. I had them hard defined in the applicable variants.
On Wed, May 28, 2025, 3:35 PM Thomas Göttgens @.***> wrote:
@.**** requested changes on this pull request.
some nitpicking about, nothing serious. see above.
In src/modules/Telemetry/Sensor/RAK12035Sensor.cpp https://github.com/meshtastic/firmware/pull/6741#discussion_r2112790071:
- // -- how to do this.. this could get a little complex..
- // ie - 1> we combine them into an average and send that, 2> we send them as separate metrics
- // ^-- these scenarios would require different handling of the metrics in the receiving end and maybe a setting in the
- // device ui and an additional proto for that?
- measurement->variant.environment_metrics.has_soil_temperature = true;
- measurement->variant.environment_metrics.has_soil_moisture = true;
- uint8_t moisture = 0;
- uint16_t temp = 0;
- bool success = false;
- sensor.sensor_on();
- delay(200);
- success = sensor.get_sensor_moisture(&moisture);
- delay(200);
- success = sensor.get_sensor_temperature(&temp);
you need to AND this. success is only if both values are read successfully.
In src/modules/Telemetry/Sensor/RAK12035Sensor.cpp https://github.com/meshtastic/firmware/pull/6741#discussion_r2112790165:
+void RAK12035Sensor::setup() +{
- // Set the calibration values
- // Reading the saved calibration values from the sensor.
- // TODO:: Check for and run calibration check for up to 2 additional sensors if present.
- uint16_t zero_val = 0;
- uint16_t hundred_val = 0;
- uint16_t default_zero_val = 550;
- uint16_t default_hundred_val = 420;
- sensor.sensor_on();
- delay(200);
- sensor.get_dry_cal(&zero_val);
- sensor.get_wet_cal(&hundred_val);
- delay(200);
- if (zero_val == 0 || zero_val <= hundred_val) {
Can we deduplicate this block and make the wording a little bit more dense? e.g. output the values only once after the conditional and just set flags there for detemining what to actually output.
In variants/rak4631/variant.h https://github.com/meshtastic/firmware/pull/6741#discussion_r2112792992:
@@ -90,6 +90,8 @@ static const uint8_t A7 = PIN_A7; // Other pins #define PIN_AREF (2) #define PIN_NFC1 (9) +#define WB_IO5 PIN_NFC1
i honestly thought these were defined in the toolchain already.
— Reply to this email directly, view it on GitHub https://github.com/meshtastic/firmware/pull/6741#pullrequestreview-2876493901, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAFYBUZMSAS54IY3GQYM3T3AYT2FAVCNFSM6AAAAAB4PKAC4CVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDQNZWGQ4TGOJQGE . You are receiving this because you were mentioned.Message ID: @.***>
sry, I fix...
... INFO | ??:??:?? 7 [PowerFSM] Advertise INFO | ??:??:?? 11 [EnvironmentTelemetry] Environment Telemetry: init INFO | ??:??:?? 15 [EnvironmentTelemetry] Init sensor: RAK12035 INFO | ??:??:?? 15 [EnvironmentTelemetry] RAK12035Sensor Init Succeed Sensor1 Firmware version: 2 INFO | ??:??:?? 15 [EnvironmentTelemetry] Opened RAK12035 sensor on i2c bus INFO | ??:??:?? 17 [EnvironmentTelemetry] Dry calibration value is 558 INFO | ??:??:?? 17 [EnvironmentTelemetry] Wet calibration value is 395 INFO | ??:??:?? 17 [PowerTelemetry] Power Telemetry: init DEBUG | ??:??:?? 21 [Power] Battery: usbPower=1, isCharging=1, batMv=4075, batPct=91 ... DEBUG | ??:??:?? 81 [Power] Battery: usbPower=1, isCharging=1, batMv=4075, batPct=91 INFO | ??:??:?? 94 [EnvironmentTelemetry] Send: barometric_pressure=0.000000, current=0.000000, gas_resistance=0.000000, relative_humidity=0.000000, temperature=0.000000 INFO | ??:??:?? 94 [EnvironmentTelemetry] Send: voltage=0.000000, IAQ=0, distance=0.000000, lux=0.000000 INFO | ??:??:?? 94 [EnvironmentTelemetry] Send: wind speed=0.000000m/s, direction=0 degrees, weight=0.000000kg INFO | ??:??:?? 94 [EnvironmentTelemetry] Send: radiation=0.000000##R/h INFO | ??:??:?? 94 [EnvironmentTelemetry] Send: soil_temperature=26.000000, soil_moisture=3 DEBUG | ??:??:?? 94 [EnvironmentTelemetry] Partially randomized packet id 3903145531 INFO | ??:??:?? 94 [EnvironmentTelemetry] Send packet to mesh ...
@Justin-Mann we good to go now?
@thebentern im in the woods again, but I think so.. saw u made a few chages.. saw and looked at a few copilot suggestions.. the ones I saw were nothing burgers, but didn't see them all. Will look things over when I get back to town, but last build I tested on my device and it looked fine.
pulled most recent branch ~8 am 5/30...
build/deploy on RAK
- RAK19007, 4631, RAK12500 (GPS), RAK12023/12035
... Linking .pio\build\rak4631\firmware.elf Checking size .pio\build\rak4631\firmware.elf Building .pio\build\rak4631\firmware.hex Advanced Memory Usage is available via "PlatformIO Home > Project Inspect" RAM: [== ] 19.2% (used 47804 bytes from 248832 bytes) Flash: [======== ] 83.0% (used 676308 bytes from 815104 bytes) Generating UF2 file Converting to uf2, output size: 1352704, start address: 0x26000 Wrote 1352704 bytes to C:\Users\justi\Repos\Meshtastic\firmware.pio\build\rak4631/firmware.uf2 Building .pio\build\rak4631\firmware.zip Zip created at .pio\build\rak4631\firmware.zip ... INFO | ??:??:?? 1 Scan for i2c devices DEBUG | ??:??:?? 1 Scan for I2C devices on port 1 INFO | ??:??:?? 1 RAK12035 found at address 0x20 DEBUG | ??:??:?? 1 Register MFG_UID FE: 0xffff DEBUG | ??:??:?? 1 Register MFG_UID 05: 0xffff INFO | ??:??:?? 1 1 I2C devices found ... DEBUG | ??:??:?? 1 [GPS] Probe for GPS at 9600 DEBUG | ??:??:?? 1 [GPS] Trying $PDTINFO (Unicore Family)... DEBUG | ??:??:?? 2 [GPS] Trying $PCAS06,11A (ATGM33xx Family)... DEBUG | ??:??:?? 2 [GPS] Trying $PAIR02139 (Airoha Family)... DEBUG | ??:??:?? 3 [GPS] Trying $PQTMVERNO58 (LC86)... DEBUG | ??:??:?? 4 [GPS] Trying $PCAS06,01B (L76K)... DEBUG | ??:??:?? 4 [GPS] Trying $PMTK605*31 (MTK Family)... DEBUG | ??:??:?? 5 [GPS] Module Info : DEBUG | ??:??:?? 5 [GPS] Soft version: ROM CORE 3.01 (107888) DEBUG | ??:??:?? 5 [GPS] Hard version: 00080000 DEBUG | ??:??:?? 5 [GPS] Extensions:4 DEBUG | ??:??:?? 5 [GPS] FWVER=SPG 3.01 DEBUG | ??:??:?? 5 [GPS] PROTVER=18.00 DEBUG | ??:??:?? 5 [GPS] GPS;GLO;GAL;BDS DEBUG | ??:??:?? 5 [GPS] SBAS;IMES;QZSS DEBUG | ??:??:?? 5 [GPS] Protocol Version:18.00 DEBUG | ??:??:?? 5 [GPS] ProtVer=18 INFO | ??:??:?? 5 [GPS] U-blox 8 detected INFO | ??:??:?? 5 [GPS] GPS+SBAS+GLONASS+Galileo configured INFO | ??:??:?? 7 [GPS] GNSS module configuration saved! DEBUG | ??:??:?? 7 [GPS] Publish pos@0:2, hasVal=0, Sats=0, GPSlock=0 DEBUG | ??:??:?? 7 [GPS] No GPS lock DEBUG | ??:??:?? 7 [GPS] onGPSChanged() pos@0 time=0 lat=0 lon=0 alt=0 INFO | ??:??:?? 7 [GPS] updatePosition LOCAL pos@0 time=0 lat=0 lon=0 alt=0 DEBUG | ??:??:?? 7 [GPS] Set local position: lat=0 lon=0 time=0 timestamp=0 ... INFO | ??:??:?? 11 [EnvironmentTelemetry] Environment Telemetry: init INFO | ??:??:?? 15 [EnvironmentTelemetry] Init sensor: RAK12035 INFO | ??:??:?? 15 [EnvironmentTelemetry] RAK12035Sensor Init Succeed Sensor1 Firmware version: 2, Sensor Name: RAK12035 INFO | ??:??:?? 15 [EnvironmentTelemetry] Opened RAK12035 sensor on i2c bus INFO | ??:??:?? 17 [EnvironmentTelemetry] Dry calibration value is 558 INFO | ??:??:?? 17 [EnvironmentTelemetry] Wet calibration value is 395 ... INFO | ??:??:?? 216 [EnvironmentTelemetry] Send: barometric_pressure=0.000000, current=0.000000, gas_resistance=0.000000, relative_humidity=0.000000, temperature=0.000000 INFO | ??:??:?? 216 [EnvironmentTelemetry] Send: voltage=0.000000, IAQ=0, distance=0.000000, lux=0.000000 INFO | ??:??:?? 216 [EnvironmentTelemetry] Send: wind speed=0.000000m/s, direction=0 degrees, weight=0.000000kg INFO | ??:??:?? 216 [EnvironmentTelemetry] Send: radiation=0.000000##R/h INFO | ??:??:?? 216 [EnvironmentTelemetry] Send: soil_temperature=24.299999, soil_moisture=3
spot checking some other builds...
t-beam s3 core ... Environment Status Duration
tbeam-s3-core SUCCESS 00:05:46.620
heltec v3 ... Environment Status Duration
heltec-v3 SUCCESS 00:05:53.346
IT IS FUNCTIONAL.. see next comment.
Seems like there is an issue with the GPS and the RAK12035..
They both seem to work, but the GPS is very hit and miss..
So.. what I think is going on.. If the GPS finishes it's initialization and acquires a sat (geta a reading), it seems to send the data and have a location associated... HOWEVER.. If the RAK12035 initializes BEFORE this happens with the GPS no GPS data.
I think if there is a pin conflict then this is making it impossible for the RAK to update it's position moving forward..
I will experiment more and verify what I can around this behavior.
I think there might be a pin conflict? experiment I did this AM.. moved GPS from SLOT A to SLOT D, no significant change. **- GPS module in SLOT D causes a reboot cycle.
@thebentern .. idk if you want this in it's current state or should chase this down and fix it first.
Can confirm 2 issues...
RAK12023/12035 - IO SLOT, RAK12500 - SLOT A Some conflict between modules, causes no GPS sat. acquisition resulting in no lat/long.
RAK12023/12035 - IO SLOT, RAK12500 - SLOT D This caused the RAK to fall into a reboot cycle. No idea if the cycle exists without the RAK12035, should have tested, but did not think of it in the moment. I will test this down the line.
@thebentern cannot resolve GPS on RAK. tried a few things.. not a lotta feedback from you guys. im about done with this I think. Let me know if you want me to remove the pr.
@thebentern correction. I have gps on my test device with the latest build...
@thebentern correction. I have gps on my test device with the latest build...
Oh, you got it working?! I just got a box of sensors from RAK wireless and I need to see if the 12035 is in there to test. :-)
I didn't do anything to the code base. Just grabbed the latest build and merged into the branch. ... and attempt was made, but I didn't fix it. It seems someone did tho cause im getting gps data now.
Just FYI I attempted to use alternate pins for ic2_sda and ic2_scl. I did this by attempting to define I2C_SCL_RAK12023 (to i2c2_sda and i2c2_scl values according to the rak19007 datasheet).. 35,36 respectively.. the idea was to define I2C_SCL_RAK12023 AND I2C_SDA_RAK12023 to those values and avoid a conflict highlighted on the wisblock io pin mapper. This .. did not work at all. I dont think (did not see) those definitions exist in the modules code, but I tried anyways. Perhaps they do and im missing something or the plan to define them in the variant was never gonna work either way.
I basically used the pin mapper spreadsheet to see there was a conflict and what it was. Unfortunately I have literally no idea wtf im doing.. good news is I didn't burn up a board.. :) the other source of info is the dataset for the rak12023/12035..
Whatever the case it seems to be working without me doing anything at all. Hopefully u can verify and all is well.. either way when I say im done with this I mean to say.. im tapping out either way. I will move on to the android app feature request. I have never worked with kotlin so gotta learn a bit..
Thanks for getting back man.
On Sat, Jun 14, 2025, 5:39 AM Ben Meadors @.***> wrote:
thebentern left a comment (meshtastic/firmware#6741) https://github.com/meshtastic/firmware/pull/6741#issuecomment-2972643311
@thebentern https://github.com/thebentern correction. I have gps on my test device with the latest build...
Oh, you got it working?! I just got a box of sensors from RAK wireless and I need to see if the 12035 is in there to test. :-)
— Reply to this email directly, view it on GitHub https://github.com/meshtastic/firmware/pull/6741#issuecomment-2972643311, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAFYBSVP3EWJ4KQPP7L3E33DQCWLAVCNFSM6AAAAAB4PKAC4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNZSGY2DGMZRGE . You are receiving this because you were mentioned.Message ID: @.***>
And I'll send u the monitor and io module if u are in need and comfortable with that. I have extras.. im actively using this irl and have replacement parts for my monitors. I am mcluvin7930 on discord if u need to pm.
On Sat, Jun 14, 2025, 5:39 AM Ben Meadors @.***> wrote:
thebentern left a comment (meshtastic/firmware#6741) https://github.com/meshtastic/firmware/pull/6741#issuecomment-2972643311
@thebentern https://github.com/thebentern correction. I have gps on my test device with the latest build...
Oh, you got it working?! I just got a box of sensors from RAK wireless and I need to see if the 12035 is in there to test. :-)
— Reply to this email directly, view it on GitHub https://github.com/meshtastic/firmware/pull/6741#issuecomment-2972643311, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACAFYBSVP3EWJ4KQPP7L3E33DQCWLAVCNFSM6AAAAAB4PKAC4CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNZSGY2DGMZRGE . You are receiving this because you were mentioned.Message ID: @.***>