I need help connecting an NPK, pH, and EC soil sensor to NodeMCU via Modbus - seeking advice!

Hello, everyone!

I’m currently working on designing a soil monitoring system for my garden, and I’m having some difficulties in properly connecting an NPK, pH, and EC soil sensor to my NodeMCU board using the Modbus protocol. I’m reaching out to you all for assistance and advice on how to effectively utilize this sensor with NodeMCU.

The goal of my system is to continuously monitor the levels of nitrogen (N), phosphorus (P), potassium (K), pH, and EC in the soil to adjust fertilization and ensure optimal conditions for plant growth. The soil sensor I have supports the Modbus protocol, and I want to connect it to my NodeMCU board for data collection and analysis.

Is there anyone here with experience in connecting NPK, pH, and EC soil sensors to NodeMCU via the Modbus protocol? How should I configure the Modbus module on the NodeMCU board, and what steps are involved in retrieving data from the soil sensor using this protocol?

I would greatly appreciate it if you could share your knowledge and expertise in this field. If you have any tips, instructions, or recommendations regarding connecting NPK, pH, and EC soil sensors to NodeMCU via the Modbus protocol, I would be incredibly grateful to hear them.

Thank you in advance for your involvement and assistance. I’m counting on your valuable insights and support!

Best regards,
Xony

1 Like

I connected it to that for a moment like this :

RO = rx , Pin GPIO 3
RE+DE = D1 (GPIO 5)
DI = tx , Pin GPIO 1

VCC = 5V
B = B
A = A
GND = Ground

config :


uart:
  id: mod_bus
  tx_pin: 1
  rx_pin: 3
  baud_rate: 9600
  stop_bits: 1

modbus:
  flow_control_pin: D1
  id: modbus1

modbus_controller:
  - id: epever
    ## the Modbus device addr
    address: 0x01
    modbus_id: modbus1
    setup_priority: -10




sensor:


  - platform: modbus_controller
    modbus_controller_id: epever
    name: "Azot (N)"
    id: Azot
    register_type: holding
    address: 0x01
    unit_of_measurement: "mg/kg"
    value_type: U_WORD

After sending the code, a message pops up:

" Modbus command to device=1 register=0x01 countdown=0 no response received - removed from send queue "

Hey,
I have similar problems, which sensor are you using ?

I’m curious if any further development has been made on this? Im trying to figure out how I can monitor the pH of my soil with HA. Ive been doing a lot of searching, but most of what comes up is about moisture sensors, not anything pH. Thank you in advance.

1 Like

Hey everyone,

I’ve been working on a little project to monitor soil nutrients, pH, moisture, and temperature using an ESP32 and the NPKPHCTH-S probe. It’s all set up with ESPHome and supports different plant profiles with real-time sensor data on a touchscreen.

I thought it might be cool to share in case anyone’s interested or working on something similar. You can check out the code and setup on my GitHub: GitHub Repository.

Feel free to take a look, use it, and let me know if you’ve got any feedback or ideas for improvements.

Cheers!
Screenshot 2024-10-14 110936

1 Like

Did you end up having to add the modbus integration to your configuration.yaml file for Home Assistant in addition to the ESP device code?