// Agrinovo THS-100 temperature and humidity sensor // Prints temperature and humidity every 5 seconds. // // Sensor cable // Red supply +, 5-28 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/environmental/ths-100-rs485-temperature-humidity-sensor/ #include #include const int DE_PIN = 4; // transceiver DE and RE, tied together AgrinovoBus bus(AGRINOVO_PORT, DE_PIN); AgrinovoTHS100 sensor(bus); // Modbus address 1 void setup() { Serial.begin(115200); agrinovoPortBegin(9600); bus.begin(); } void loop() { if (sensor.read()) { Serial.print("Temperature: "); Serial.print(sensor.temperature(), 1); Serial.println(" °C"); Serial.print("Humidity: "); Serial.print(sensor.humidity(), 1); Serial.println(" % RH"); } else { Serial.println(sensor.errorText()); } delay(5000); }