Skip to content

Add rak12035 VB Soil Monitor Tested & Working #6741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 69 commits into
base: master
Choose a base branch
from

Conversation

Justin-Mann
Copy link

@Justin-Mann Justin-Mann commented May 5, 2025

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 and others added 29 commits March 7, 2025 21:19
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.

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: @Justin-Mann
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.

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: @Justin-Mann
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.

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: @Justin-Mann
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.

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: @Justin-Mann
…K: RAK19007/RAK4631/RAK12035VB/RAK12500

looks like soil monitor is working correctly, new environmental metrics are comming thru [new protos soil_moisture, soil_temperature] and GPS is working again with the RAK 12500.

improvements could be made around the configuration of the monitor.

next steps include updating the client(s) to react to, log and display the new proto metrics for soil temp and humidity.
@Justin-Mann
Copy link
Author

@fifieldt

@Justin-Mann
Copy link
Author

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 thebentern requested a review from caveman99 May 28, 2025 16:53
@Justin-Mann
Copy link
Author

@thebentern @fifieldt ty for all your help, sorry is a pita.

Copy link
Member

@caveman99 caveman99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some nitpicking about, nothing serious. see above.

@Justin-Mann
Copy link
Author

Justin-Mann commented May 28, 2025 via email

@Justin-Mann
Copy link
Author

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 Justin-Mann requested a review from caveman99 May 28, 2025 23:43
@thebentern thebentern requested a review from Copilot May 29, 2025 00:08
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates the RAK12035 soil moisture/temperature sensor into the existing telemetry framework, wiring it through I²C, telemetry routines, and build configs.

  • Add RAK12035Sensor class with setup, runOnce, and metrics collection
  • Extend I²C scanning, main setup, and telemetry loop to handle RAK12035 devices
  • Update variant headers and PlatformIO manifests to expose the new sensor library and pins

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
variants/*/variant.h Define WB_IO4/5 and WB_IO2 for all RAK4631-based variants
variants/*/platformio.ini Add beegee-tokyo/RAK12035_SoilMoisture@^1.0.4 dependency
src/modules/Telemetry/Sensor/RAK12035Sensor.* New sensor class header + implementation
src/modules/Telemetry/EnvironmentTelemetry.cpp Register and invoke the new sensor in telemetry loops
src/main.cpp Map ScanI2C DeviceType::RAK12035 to telemetry sensor
src/detect/ScanI2C.{cpp,h} Add RAK12035 to I²C scan cases and enum
src/configuration.h Define default I²C addresses for up to three RAK12035
Comments suppressed due to low confidence (1)

src/modules/Telemetry/Sensor/RAK12035Sensor.cpp:1

  • [nitpick] The new RAK12035Sensor integration contains non-trivial initialization and measurement logic but has no accompanying unit or integration tests. Consider adding tests for setup, calibration fallback, and successful/failed reads.
#include "configuration.h"

@thebentern
Copy link
Contributor

@Justin-Mann we good to go now?

@Justin-Mann
Copy link
Author

@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.

@Justin-Mann
Copy link
Author

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 $PAIR021
39 (Airoha Family)...
DEBUG | ??:??:?? 3 [GPS] Trying $PQTMVERNO58 (LC86)...
DEBUG | ??:??:?? 4 [GPS] Trying $PCAS06,0
1B (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.

@Justin-Mann
Copy link
Author

Justin-Mann commented May 30, 2025

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.

@Justin-Mann
Copy link
Author

@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.

@Justin-Mann
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants