NPK Soil Sensor RS485

Rs 26,990.00

Out of stock

Quick Info :

  • Units of measurement : mg/kg(mg/L)
  • Measurement parameters : Soil Nitrogen, Phosphorus, Potassium
  • Measurement range : 0-1999mg/kg(mg/L)
  • Measurement accuracy : ±3%(mg/kg)
  • Resolution : 1mg/kg(mg/L)
  • Supply voltage : 5-30V DC
Categories: ,

Frequently Bought Together

NPK(nitrogen, phosphorus and potassium) Soil Sensor RS485 measures sensor is suitable for detecting the content of nitrogen, phosphorus and potassium in the soil.It can judge the fertility of the soil by detecting the content of nitrogen, phosphorus and potassium in the soil, which is convenient for customers to systematically evaluate the soil condition.

Features :

  • The sensor is compact in size, easy to carry, easy to install, operate and maintain
  • Good sealing, can be directly buried in the soil, and will not be corroded
  • The soil quality has little influence and is widely used in a wide range of areas
  • High measurement accuracy and reliable performance to ensure normal work
  • Fast response, good interchangeability, and high data transmission efficiency

Specifications :

  • Units of measurement : mg/kg(mg/L)
  • Measurement parameters : Soil Nitrogen, Phosphorus, Potassium
  • Measurement range : 0-1999mg/kg(mg/L)
  • Measurement accuracy : ±3%(mg/kg)
  • Resolution : 1mg/kg(mg/L)
  • Supply voltage : 5-30V DC
  • The scope of work : 0-50ºC
  • Stable schedule : 1 second after power on
  • Response time : < 10 seconds
  • Probe length : 55mm,φ3mm
  • Sealing material : ABS engineering plastic, epoxy resin,
  • Probe material : 316L stainless steel
  • Cable Specifications : Standard 2 meters (other cable lengths can be customized, up to 1200 meters)
  • Output signal : RS485 (standard Modbus-RTU protocol, device default address: 0x01)

Pinout:

  • Red : VCC
  • Black : GND
  • Green : RS485A
  • White : RS485B

Library :

Code :

#include  // rs 485 lib

// RS485 Enable Pins
#define RE 18
#define DE 19

// RS485 RX TX 
#define RX2 16
#define TX2 17

// RS485 Addresses
#define NITROGEN_ADDR   0x00
#define PHOSPHORUS_ADDR 0x02
#define POTASSIUM_ADDR  0x04

ModbusMaster node;

// NPK Variables 
int nitrogenValue;
int phosphorousValue;
int potassiumValue;

// Put the MAX485 into transmit mode
void preTransmission()
{
  digitalWrite(RE, 1);
  digitalWrite(DE, 1);
}

// Put the MAX485 into receive mode
void postTransmission()
{
  digitalWrite(RE, 0);
  digitalWrite(DE, 0);
}


void setup() {
  Serial.begin(9600);
  Serial2.begin(4800, SERIAL_8N1, RX2, TX2);

  pinMode(RE, OUTPUT);
  pinMode(DE, OUTPUT);
  digitalWrite(DE, LOW);
  digitalWrite(RE, LOW);

  // ModBus Configuration
  node.begin(1, Serial2);

  // Callbacks to allow us to set the RS485 Tx/Rx direction
  node.preTransmission(preTransmission);
  node.postTransmission(postTransmission);
}

// print out the error received from the Modbus library
void printModbusError( uint8_t errNum )
{
  switch ( errNum ) {
    case node.ku8MBSuccess:
      Serial.println(F("Success"));
      break;
    case node.ku8MBIllegalFunction:
      Serial.println(F("Illegal Function Exception"));
      break;
    case node.ku8MBIllegalDataAddress:
      Serial.println(F("Illegal Data Address Exception"));
      break;
    case node.ku8MBIllegalDataValue:
      Serial.println(F("Illegal Data Value Exception"));
      break;
    case node.ku8MBSlaveDeviceFailure:
      Serial.println(F("Slave Device Failure"));
      break;
    case node.ku8MBInvalidSlaveID:
      Serial.println(F("Invalid Slave ID"));
      break;
    case node.ku8MBInvalidFunction:
      Serial.println(F("Invalid Function"));
      break;
    case node.ku8MBResponseTimedOut:
      Serial.println(F("Response Timed Out"));
      break;
    case node.ku8MBInvalidCRC:
      Serial.println(F("Invalid CRC"));
      break;
    default:
      Serial.println(F("Unknown Error"));
      break;
  }
}

void npk_readings() 
{
  uint8_t result;

  // NITROGEN
  result = node.readHoldingRegisters(NITROGEN_ADDR, 1);
  if (result == node.ku8MBSuccess)
  {
    nitrogenValue = node.getResponseBuffer(0x0);
    Serial.print("   Nitrogen: ");
    Serial.print(nitrogenValue);
    Serial.println(" mg/kg");
  } else {
    printModbusError( result );
  }

  // PHOSPHORUS
  result = node.readHoldingRegisters(PHOSPHORUS_ADDR, 1);
  if (result == node.ku8MBSuccess)
  {
    phosphorousValue = node.getResponseBuffer(0x0);
    Serial.print("Phosphorous: ");
    Serial.print(phosphorousValue);
    Serial.println(" mg/kg");
  } else {
    printModbusError( result );
  }

  // POTASSIUM
  result = node.readHoldingRegisters(POTASSIUM_ADDR, 1);
  if (result == node.ku8MBSuccess)
  {
    potassiumValue = node.getResponseBuffer(0x0);
    Serial.print("  Potassium: ");
    Serial.print(potassiumValue);
    Serial.println(" mg/kg");
  } else {
    printModbusError( result );
  }
  Serial.println();
}


void loop() {
  // put your main code here, to run repeatedly:
  npk_readings();
}

Only logged in customers who have purchased this product may leave a review.

Reviews

There are no reviews yet.

Main Menu

NPK Soil Sensor RS485 in Sri Lanka

NPK Soil Sensor RS485

Rs 26,990.00