My soil Sensor does not detect Phosphorus and Pottasium

Hallo! I currently have this problem that my soil sensor does not detect Phosphorus and Potassium.
the soil sensor that im using.


the circuit setup

Here is my code,

#include <ModbusMaster.h>
ModbusMaster node;

// Soil sensor Modbus address (often 1 by default)
#define SENSOR_ID 1  

// RS485 control pin (RE/DE)
#define MAX485_RE_DE  4  

void preTransmission() {
  digitalWrite(MAX485_RE_DE, 1);
}

void postTransmission() {
  digitalWrite(MAX485_RE_DE, 0);
}

void setup() {
  Serial.begin(115200);  // USB Serial Monitor (set Serial Monitor to 115200)
  Serial.println("7-in-1 Soil Sensor Test");

  // Set RS485 RE/DE pin as output
  pinMode(MAX485_RE_DE, OUTPUT);
  digitalWrite(MAX485_RE_DE, 0);

  // Init Modbus
  node.begin(SENSOR_ID, Serial2);  
  node.preTransmission(preTransmission);
  node.postTransmission(postTransmission);

  // IMPORTANT: Sensor default = 4800 baud
  Serial2.begin(4800, SERIAL_8N1, 26, 27);  }

void loop() {
  uint8_t result;
  uint16_t data;

  // Moisture (0000H)
  result = node.readHoldingRegisters(0x0000, 1);
  if (result == node.ku8MBSuccess) {
    data = node.getResponseBuffer(0);
    Serial.print("Moisture: ");
    Serial.print(data);
    Serial.println(" %");
  }

  // EC (0002H)
  result = node.readHoldingRegisters(0x0002, 1);
  if (result == node.ku8MBSuccess) {
    data = node.getResponseBuffer(0);
    Serial.print("EC: ");
    Serial.print(data);
    Serial.println(" uS/cm");
  }

  // pH (0004H)
  result = node.readHoldingRegisters(0x0003, 1);
  if (result == node.ku8MBSuccess) {
    data = node.getResponseBuffer(0);
    Serial.print("pH: ");
    Serial.println(data / 10.0); // usually scaled by 10
  }

  // Nitrogen (001EH)
  result = node.readHoldingRegisters(0x001E, 1);
  if (result == node.ku8MBSuccess) {
    data = node.getResponseBuffer(0);
    Serial.print("Nitrogen: ");
    Serial.print(data);
    Serial.println(" mg/kg");
  }

  // Phosphorus (001FH)
  result = node.readHoldingRegisters(0x001F, 1);
  if (result == node.ku8MBSuccess) {
    data = node.getResponseBuffer(0);
    Serial.print("Phosphorus: ");
    Serial.print(data);
    Serial.println(" mg/kg");
  }

  // Potassium (0020H)
  result = node.readHoldingRegisters(0x0020, 1);
  if (result == node.ku8MBSuccess) {
    data = node.getResponseBuffer(0);
    Serial.print("Potassium: ");
    Serial.print(data);
    Serial.println(" mg/kg");
  }

  // Temperature (0001H)
  result = node.readHoldingRegisters(0x0001, 1);
  if (result == node.ku8MBSuccess) {
    data = node.getResponseBuffer(0);
    Serial.print("Temperature: ");
    Serial.print(data / 10.0); // usually scaled by 10
    Serial.println(" °C");
  }

  Serial.println("----------------------");
  delay(2000);  // Wait 2s before next read
}

Here is the sample output, the EC sometimes has value and i think the nitrogen has inflated value. I tested that it works because when i remove it from the soil the temperature increase then moisture go down but the nitrogen still remains on 4035 to 4045 range.

Moisture: 264 %
EC: 0 uS/cm
pH: 7.50
Nitrogen: 4038 mg/kg
Phosphorus: 0 mg/kg
Potassium: 0 mg/kg
Temperature: 25.80 °C

any insights are much welcome. Thank you!

If you search the forum and indeed the internet you will discover that device is a scam. You can't measure P and K with an inexpensive sensor stuck in the ground.

2 Likes

Feelsbadman :frowning:, i was late to discover that it was a scam

You can't measure any of those with a fork, with the exception possibly of conductivity.
Even less likely is a reported conductivity of zero. You do use moist soil?

My washing machine used to reckon the all the washing was 42% moisture, for years, even when it was dry.

If you are serious about doing it, temperature, conductivity, pH and some specific ion electrodes are available, the latter not really for hobby use. Ammonia is doable by converting the pH electrode, and nitrate and nitrite can be measured as ammonia after chemical reduction. Ammonia can be reported as nitrogen.

Your best bet is to find some soil testing strips.

Or read up on soil analysis.

Sometimes, it's worth running your ideas past the forum before you spend good money.

2 Likes