// Agrinovo TUR-100 turbidity sensor // Prints turbidity every 5 seconds. // // Sensor cable // Red supply +, 12-24 V DC // Black supply ground, joined to the board's ground // Yellow RS485 A // Green RS485 B // // The board talks to the sensor through an RS485 transceiver (MAX485 or // similar). AgrinovoDefaultPort.h lists the serial pins used on each board. // // https://agrinovo.io/products/sensors/aqua/turbidity/tur-100-turbidity-sensor/ #include #include const int DE_PIN = 4; // transceiver DE and RE, tied together AgrinovoBus bus(AGRINOVO_PORT, DE_PIN); AgrinovoTUR100 sensor(bus); // Modbus address 1 void setup() { Serial.begin(115200); agrinovoPortBegin(9600); bus.begin(); } void loop() { if (sensor.read()) { Serial.print("Turbidity: "); Serial.print(sensor.turbidity(), 1); Serial.println(" NTU"); } else { Serial.println(sensor.errorText()); } delay(5000); }