// Agrinovo GF-201-CH4 combustible gas detector // Prints combustible gas every 5 seconds. // // Sensor terminals // 24V+ supply +, 12-30 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/gf-201-ch4-combustible-gas-sensor/ #include #include const int DE_PIN = 4; // transceiver DE and RE, tied together AgrinovoBus bus(AGRINOVO_PORT, DE_PIN); AgrinovoGF201CH4 sensor(bus); // Modbus address 1 void setup() { Serial.begin(115200); agrinovoPortBegin(9600); bus.begin(); } void loop() { if (sensor.read()) { Serial.print("Combustible gas: "); Serial.print(sensor.combustibleGas(), 1); Serial.println(" %LEL"); } else { Serial.println(sensor.errorText()); } delay(5000); }