// Agrinovo TVOC-100 TVOC air quality sensor // Prints TVOC and CO2 equivalent every 5 seconds. // // Sensor terminals // V+ supply +, 5-12 V DC // GND supply ground, joined to the board's ground // A+ RS485 A // B- 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/tvoc-100-rs485-air-quality-sensor/ #include #include const int DE_PIN = 4; // transceiver DE and RE, tied together AgrinovoBus bus(AGRINOVO_PORT, DE_PIN); AgrinovoTVOC100 sensor(bus); // Modbus address 1 void setup() { Serial.begin(115200); agrinovoPortBegin(9600); bus.begin(); } void loop() { if (sensor.read()) { Serial.print("TVOC: "); Serial.print(sensor.tvoc(), 0); Serial.println(" ppb"); Serial.print("CO2 equivalent: "); Serial.print(sensor.co2Equivalent(), 0); Serial.println(" ppm"); } else { Serial.println(sensor.errorText()); } delay(5000); }