Community project

Sistem Deteksi Dini Kebakaran Hutan

Photo of Sistem Deteksi Dini Kebakaran Hutan
Generated with AI

Mubarok982

Published November 21, 2026

This early forest fire detection system uses an ESP32-based network of remote sensor nodes connected via LoRa radio to a central gateway. Each node monitors temperature, humidity, soil moisture, flame presence, and smoke levels, transmitting alerts when dangerous conditions are detected. The system displays real-time sensor data on local LCD screens and triggers visual and audio alarms at the gateway.

This guide provides a complete wiring diagram, parts list, and step-by-step assembly instructions for building both the distributed sensor nodes and the central gateway station. The included firmware handles LoRa communication, multi-sensor integration, and configurable alert thresholds, allowing makers to deploy an effective early warning network across forest areas.

Wiring diagram

Loading diagram…

Gather all the parts

QtyComponent
1

ESP32 DevKit v1 — Gateway

Standalone USB prototype component

1

RFM95W LoRa Transceiver Module (SX1276)

HopeRF RFM95W long-range LoRa/LoRaWAN radio module based on Semtech SX1276. Typically used at 868 MHz (EU) or 915 MHz (US) ISM bands. SPI interface plus RESET and DIO interrupt lines. 3.3 V logic only. Requires an external antenna — never transmit without one.

1

Electrolytic Capacitor

100 µF / 10 V

Radial aluminium electrolytic capacitor bought by value and voltage rating, such as 10 µF, 100 µF or 1000 µF 10 V. It is polarised: the + lead goes to the higher voltage and the - lead, marked by the stripe on the sleeve, to the lower voltage or ground. It is mostly used for bulk filtering across a power rail, with a voltage rating comfortably above the rail.

1

LED

Green

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

LED

Yellow

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

LED

Red

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

RFM95W LoRa Transceiver Module (SX1276)

HopeRF RFM95W long-range LoRa/LoRaWAN radio module based on Semtech SX1276. Typically used at 868 MHz (EU) or 915 MHz (US) ISM bands. SPI interface plus RESET and DIO interrupt lines. 3.3 V logic only. Requires an external antenna — never transmit without one.

1

Electrolytic Capacitor

100 µF / 10 V

Radial aluminium electrolytic capacitor bought by value and voltage rating, such as 10 µF, 100 µF or 1000 µF 10 V. It is polarised: the + lead goes to the higher voltage and the - lead, marked by the stripe on the sleeve, to the lower voltage or ground. It is mostly used for bulk filtering across a power rail, with a voltage rating comfortably above the rail.

1

LED

Green

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

LED

Yellow

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

LED

Red

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

330 Ω

Through-hole resistor (current-limiting in series with an LED)

1

SSD1306 OLED

0.96-inch 128 x 64 white monochrome OLED display module driven by an SSD1306 controller over I2C (address 0x3C). It runs from 3 V to 5 V and connects through a 4-pin 2.54 mm header (GND, VCC, SCL, SDA); the self-emitting pixels need no backlight.

1

Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor

Adafruit breakout for the Bosch BME280 sensor, measuring temperature, relative humidity and barometric pressure. It talks over I2C (address 0x77, or 0x76 with SDO to ground) or SPI, runs from 3 to 5 V through an on-board regulator with level shifting, and connects through STEMMA QT/Qwiic connectors or a 7-pin 0.1 in header.

1

Adafruit STEMMA Soil Sensor – I2C Capacitive Moisture Sensor

Adafruit STEMMA capacitive soil moisture sensor using an I2C interface. Operates at 3.3V or 5V. Reports moisture (and optionally temperature) via I2C at default address 0x36. Compatible with common 3.3V/5V microcontroller and Raspberry Pi I2C hosts. No analog pin required; uses internal SAMD10 microcontroller to digitise readings over I2C.

1

KY-026 Flame Sensor Module

KY-026 infrared flame detector module with LM393 comparator, sensitivity trimmer, analog output for IR intensity, and threshold digital output. Common Arduino/ESP32 fire-fighting robot sensor; detects flame-like IR in roughly the 760-1100 nm range.

1

MQ-2 Gas Sensor

Analog combustible-gas and smoke sensor module. Detects LPG, propane, methane, hydrogen, alcohol, and smoke using a heated tin-dioxide (SnO2) sensing element whose resistance falls as gas concentration rises. The breakout board provides an analog output (AO) proportional to concentration plus a digital output (DO) that trips when concentration crosses an onboard potentiometer threshold. Requires a 5 V supply for the internal heater and a 20-30 s warm-up before readings stabilise; the AO voltage is relative, so the sensor needs a clean-air baseline calibration rather than reporting an absolute ppm value.

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

5 V active piezo buzzer (DC, polarized)

Standalone USB prototype component

1

AO3400A

30V 5.7A N-channel enhancement-mode logic-level MOSFET in SOT-23-3L. Vgs(th) typically ~0.7V (max 1.45V at Id=250 uA), fully enhanced at Vgs=2.5V-4.5V. RDS(on) ~26 mOhm at Vgs=4.5V, ~38 mOhm at Vgs=2.5V. Driven directly by 3.3V or 5V microcontroller GPIO/PWM as a low-side switch for loads up to its Id and VDS limits. No firmware library required.

1

Resistor

100 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

LCD 16x2 I2C

16x2 character LCD display with I2C backpack

1

BSS138 Logic Level Shifter

Bidirectional I2C voltage translator module

1

TP-Link TL-SG108 Ethernet Switch

External network switch with its own adapter

1

FiberHome HG680-P 1

Use original power adapter; LAN is an external RJ45 connection

1

FiberHome HG680-P 2

Use original power adapter; LAN is an external RJ45 connection

1

FiberHome HG680-P 3

Use original power adapter; LAN is an external RJ45 connection

1

FiberHome HG680-P 4

Use original power adapter; LAN is an external RJ45 connection

1

FiberHome HG680-P 5

Use original power adapter; LAN is an external RJ45 connection

Assemble it in 7 steps

1. Pisahkan node dan gateway

ESP32 utama pada gambar adalah node. Rakit gateway di breadboard lain. Masing-masing ESP32 diberi daya lewat USB sendiri. Jangan satukan jalur daya kedua rangkaian. Gunakan adaptor breadboard yang sesuai untuk modul RFM95W dan AO3400A.

2. Pasang radio dan antena

Pasang kapasitor dekat suplai tiap radio, kaki positif ke 3,3 V dan negatif ke GND setempat. Pasang antena cocok pada pad ANT masing-masing RFM95W. Bila menggunakan pigtail coax, inti ke ANT dan pelindung ke GND radio.

  • Jangan memancar tanpa antena. Periksa aturan frekuensi dan daya pancar setempat sebelum uji radio.

3. Sambungkan sensor di node

BME280 dan sensor tanah berbagi jalur data GPIO21 dan jalur jam GPIO22. KY-026 memakai 3,3 V dan mengirim sinyal analog ke GPIO35. MQ-2 memakai 5 V. Hubungkan AO MQ-2 lewat resistor atas; GPIO33 berada di titik tengah kedua resistor. Biarkan DO MQ-2 kosong.

  • Jangan hubungkan AO MQ-2 langsung ke ESP32. Pastikan pin 5 V DevKit mendapat 5 V dari USB sebelum memasang MQ-2.

4. Pasang lampu, buzzer, dan layar

Tiap LED memakai resistor 330 ohm pada kaki anoda. Hubungkan kaki katoda ke GND board setempat. Di node, buzzer piezo aktif 5 V disakelarkan oleh AO3400A. Di gateway, OLED memakai 3,3 V dengan GPIO21 sebagai data dan GPIO22 sebagai jam.

5. Pasang LCD di node

Pasang konverter BSS138 antara ESP32 dan LCD 5 V. GPIO21 dan GPIO22 masuk ke LV1 dan LV2. HV1 ke SDA LCD dan HV2 ke SCL LCD. Sambungkan LV ke 3,3 V, HV ke 5 V dan satukan GND node dengan GND LCD. Gunakan backpack PCF8574 yang kompatibel dengan LiquidCrystal_I2C (0x27 atau 0x3F).

6. Hubungkan lima STB ke switch

Sambungkan setiap port RJ45 HG680-P ke port LAN switch yang berbeda. Gunakan adaptor daya asli masing-masing STB dan switch. Jangan sambungkan pin internal atau satukan keluaran adaptor. Port kosong bisa menuju router untuk alamat IP otomatis. Setelah kedua ESP32 diisi firmware dan disetel perannya, pindahkan kabel USB data gateway dari komputer ke USB host STB 1 jika sistem operasi STB bisa membaca USB serial. Gunakan 115200 baud. Empat STB lain terhubung melalui LAN; firmware ESP32 tidak menjalankan pengolahan gambar.

7. Terima data di HG680-P 1

Gunakan kabel USB data dari gateway ke USB host STB 1 setelah mengatur peran GATEWAY. Pada STB yang menjalankan Linux dengan dukungan USB serial, instal paket python3-serial yang sesuai distribusinya. Salin data/stb_receiver.py ke STB, cek nama port (/dev/ttyUSB0 atau /dev/ttyACM0), lalu jalankan python3 stb_receiver.py /dev/ttyUSB0. Output berupa satu objek JSON per baris. Tambahkan >> telemetry.jsonl untuk menyimpan log. Lihat data/diagram-berlabel.svg untuk nama setiap komponen.

Review all connections

1. Connections between "node_lora" and "ESP32"

Functionnode_loraESP32
powerVCC3V3
groundGNDGND
spiSCKGPIO 18
spiMISOGPIO 19
spiMOSIGPIO 23
spiNSSGPIO 4
digitalRESETGPIO 16
digitalDIO0GPIO 17

2. Connections between "node_cap" and "ESP32"

Functionnode_capESP32
power+3V3
ground-GND

3. Connections between "node_green_r" and "ESP32"

Functionnode_green_rESP32
digitalP1GPIO 25
digitalP2 → LED ANODEEXT

4. Connections between "node_green" and "ESP32"

Functionnode_greenESP32
groundGNDGND

5. Connections between "node_yellow_r" and "ESP32"

Functionnode_yellow_rESP32
digitalP1GPIO 26
digitalP2 → LED ANODEEXT

6. Connections between "node_yellow" and "ESP32"

Functionnode_yellowESP32
groundGNDGND

7. Connections between "node_red_r" and "ESP32"

Functionnode_red_rESP32
digitalP1GPIO 27
digitalP2 → LED ANODEEXT

8. Connections between "node_red" and "ESP32"

Functionnode_redESP32
groundGNDGND

9. Connections between "gw_lora" and "ESP32"

Functiongw_loraESP32
powerVCC → ESP32 DevKit v1 — Gateway 3.3VEXT
groundGND → ESP32 DevKit v1 — Gateway GNDEXT
spiSCK → ESP32 DevKit v1 — Gateway GPIO18EXT
spiMISO → ESP32 DevKit v1 — Gateway GPIO19EXT
spiMOSI → ESP32 DevKit v1 — Gateway GPIO23EXT
spiNSS → ESP32 DevKit v1 — Gateway GPIO4EXT
digitalRESET → ESP32 DevKit v1 — Gateway GPIO16EXT
digitalDIO0 → ESP32 DevKit v1 — Gateway GPIO17EXT

10. Connections between "gw_cap" and "ESP32"

Functiongw_capESP32
power+ → ESP32 DevKit v1 — Gateway 3.3VEXT
ground- → ESP32 DevKit v1 — Gateway GNDEXT

11. Connections between "gw_green_r" and "ESP32"

Functiongw_green_rESP32
digitalP1 → ESP32 DevKit v1 — Gateway GPIO25EXT
digitalP2 → LED ANODEEXT

12. Connections between "gw_green" and "ESP32"

Functiongw_greenESP32
groundGND → ESP32 DevKit v1 — Gateway GNDEXT

13. Connections between "gw_yellow_r" and "ESP32"

Functiongw_yellow_rESP32
digitalP1 → ESP32 DevKit v1 — Gateway GPIO26EXT
digitalP2 → LED ANODEEXT

14. Connections between "gw_yellow" and "ESP32"

Functiongw_yellowESP32
groundGND → ESP32 DevKit v1 — Gateway GNDEXT

15. Connections between "gw_red_r" and "ESP32"

Functiongw_red_rESP32
digitalP1 → ESP32 DevKit v1 — Gateway GPIO27EXT
digitalP2 → LED ANODEEXT

16. Connections between "gw_red" and "ESP32"

Functiongw_redESP32
groundGND → ESP32 DevKit v1 — Gateway GNDEXT

17. Connections between "oled" and "ESP32"

FunctionoledESP32
powerVCC → ESP32 DevKit v1 — Gateway 3.3VEXT
groundGND → ESP32 DevKit v1 — Gateway GNDEXT
i2cSDA → ESP32 DevKit v1 — Gateway GPIO21EXT
i2cSCL → ESP32 DevKit v1 — Gateway GPIO22EXT

18. Connections between "bme" and "ESP32"

FunctionbmeESP32
powerVIN3V3
groundGNDGND
i2cSDIGPIO 21
i2cSCKGPIO 22

19. Connections between "soil" and "ESP32"

FunctionsoilESP32
powerVCC3V3
groundGNDGND
i2cSDA → Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor SDIEXT
i2cSCL → Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor SCKEXT

20. Connections between "flame" and "ESP32"

FunctionflameESP32
powerVCC3V3
groundGNDGND
analogAOGPIO 35

21. Connections between "mq" and "ESP32"

FunctionmqESP32
powerVCC5V
groundGNDGND

22. Connections between "mq_top" and "ESP32"

Functionmq_topESP32
digitalP1 → MQ-2 Gas Sensor AOEXT
digitalP2GPIO 33

23. Connections between "mq_bottom" and "ESP32"

Functionmq_bottomESP32
digitalP1 → Resistor P2EXT
groundP2GND

24. Connections between "alarm" and "ESP32"

FunctionalarmESP32
power+5V
ground- → AO3400A Drain (D)EXT

25. Connections between "switch" and "ESP32"

FunctionswitchESP32
groundSource (S)GND
digitalGate (G)GPIO 32

26. Connections between "gate_down" and "ESP32"

Functiongate_downESP32
digitalP1 → AO3400A Gate (G)EXT
groundP2GND

27. Connections between "stb1" and "ESP32"

Functionstb1ESP32
dataRJ45 → TP-Link TL-SG108 Ethernet Switch LAN1EXT

28. Connections between "stb2" and "ESP32"

Functionstb2ESP32
dataRJ45 → TP-Link TL-SG108 Ethernet Switch LAN2EXT

29. Connections between "stb3" and "ESP32"

Functionstb3ESP32
dataRJ45 → TP-Link TL-SG108 Ethernet Switch LAN3EXT

30. Connections between "stb4" and "ESP32"

Functionstb4ESP32
dataRJ45 → TP-Link TL-SG108 Ethernet Switch LAN4EXT

31. Connections between "stb5" and "ESP32"

Functionstb5ESP32
dataRJ45 → TP-Link TL-SG108 Ethernet Switch LAN5EXT

32. Connections between "lcd_shift" and "ESP32"

Functionlcd_shiftESP32
powerLV3V3
powerHV5V
groundGNDGND
i2cLV1 → Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor SDIEXT
i2cLV2 → Adafruit BME280 I2C or SPI Temperature Humidity Pressure Sensor SCKEXT

33. Connections between "lcd" and "ESP32"

FunctionlcdESP32
i2cSDA → BSS138 Logic Level Shifter HV1EXT
i2cSCL → BSS138 Logic Level Shifter HV2EXT
powerVCC5V
groundGNDGND

34. Connections between "gateway" and "ESP32"

FunctiongatewayESP32
dataUSB_SERIAL → FiberHome HG680-P 1 USB_HOSTEXT

Deploy the firmware

#include <Arduino.h>
#include <Wire.h>
#include <SPI.h>
#include <Preferences.h>
#include <LoRa.h>
#include <Adafruit_BME280.h>
#include <Adafruit_seesaw.h>
#include <Adafruit_SSD1306.h>
#include <LiquidCrystal_I2C.h>

Preferences cfg;
Adafruit_BME280 bme;
Adafruit_seesaw soil;
Adafruit_SSD1306 oled(128,64,&Wire,-1);
LiquidCrystal_I2C lcd27(0x27,16,2), lcd3f(0x3f,16,2);
LiquidCrystal_I2C *lcd=nullptr;
bool gateway, radio, screen, bmeOK, soilOK;
unsigned long lastRx, lastSample, bootAt;
bool received=false;
int statusRx=1, rssi=0;
float t=NAN,h=NAN;
int moisture=-1,mq=0,flame=0;
char oldA[17]={}, oldB[17]={}, oldO[100]={}, command[48]={};
size_t used=0;
unsigned smokeLimit, flameLimit;
int txPower;

bool probe(uint8_t a){ Wire.beginTransmission(a); return Wire.endTransmission()==0; }
void lights(int s){ digitalWrite(25,s==0); digitalWrite(26,s==1); digitalWrite(27,s==2); }
void line(int row,const char *text,char *old){
  char padded[17]; snprintf(padded,sizeof padded,"%-16.16s",text);
  if(lcd && strcmp(padded,old)){ lcd->setCursor(0,row); lcd->print(padded); strcpy(old,padded); }
}
void setup(){
  Serial.begin(115200);
  cfg.begin("forest",false);
  gateway=cfg.getBool("gateway",false);
  smokeLimit=cfg.getUInt("smoke",0); flameLimit=cfg.getUInt("flame",0);
  for(int p:{25,26,27}) pinMode(p,OUTPUT);
  lights(1);
  if(!gateway){ pinMode(32,OUTPUT); digitalWrite(32,LOW); }
  Wire.begin(21,22); Wire.setTimeOut(50);
  if(gateway){
    int addr=probe(0x3c)?0x3c:probe(0x3d)?0x3d:0;
    screen=addr && oled.begin(SSD1306_SWITCHCAPVCC,addr,false,false);
  } else {
    bmeOK=bme.begin(0x77)||bme.begin(0x76);
    soilOK=soil.begin(0x36);
    lcd=probe(0x27)?&lcd27:probe(0x3f)?&lcd3f:nullptr;
    if(lcd){lcd->init();lcd->backlight();}
  }
  unsigned khz=cfg.getUInt("khz",0);
  txPower=cfg.getInt("dbm",2);
  if(khz>=902000 && khz<=928000){
    SPI.begin(18,19,23,4); LoRa.setPins(4,16,17);
    radio=LoRa.begin(khz*1000L);
    if(radio){LoRa.setTxPower(txPower);LoRa.setSyncWord(0x42);LoRa.enableCrc();}
  }
  bootAt=millis(); lastSample=bootAt-5000;
  Serial.printf("ROLE %s RADIO %s\n",gateway?"GATEWAY":"NODE",radio?"ON":khz?"ERROR":"OFF");
  Serial.println("Commands: NODE | GATEWAY | RADIO <kHz> <dBm> | RADIO OFF | THRESH <MQ_mV_min> <IR_mV_max> | TEST");
}
void settings(){
  while(Serial.available()){
    char c=Serial.read();
    if(c=='\r') continue;
    if(c!='\n'){ if(used<sizeof(command)-1) command[used]=c; ++used; continue; }
    if(used>=sizeof(command)){used=0;continue;}
    command[used]=0; used=0;
    unsigned a,b; char extra;
    if(!strcmp(command,"NODE")||!strcmp(command,"GATEWAY"))cfg.putBool("gateway",command[0]=='G');
    else if(!strcmp(command,"RADIO OFF"))cfg.putUInt("khz",0);
    else if(sscanf(command,"RADIO %u %u %c",&a,&b,&extra)==2 && a>=902000 && a<=928000 && b>=2 && b<=17){cfg.putUInt("khz",a);cfg.putInt("dbm",b);}
    else if(sscanf(command,"THRESH %u %u %c",&a,&b,&extra)==2 && a<=2500 && b<=3100){cfg.putUInt("smoke",a);cfg.putUInt("flame",b);}
    else if(!strcmp(command,"TEST") && !gateway){lights(2);digitalWrite(32,HIGH);delay(500);digitalWrite(32,LOW);lastSample=millis()-5000;continue;}
    else continue;
    ESP.restart();
  }
}
int avgMv(int p){int sum=0;for(int i=0;i<12;i++)sum+=analogReadMilliVolts(p);return sum/12;}
void node(unsigned long now){
  if(now-lastSample<2000)return;
  lastSample=now;
  bool hasBme=bmeOK && (probe(0x76)||probe(0x77));
  t=hasBme?bme.readTemperature():NAN; h=hasBme?bme.readHumidity():NAN;
  moisture=soilOK && probe(0x36)?soil.touchRead(0):-1;
  mq=avgMv(33); flame=avgMv(35);
  bool ready=now-bootAt>=180000UL;
  bool smoke=ready && smokeLimit && mq>=int(smokeLimit);
  bool ir=flameLimit && flame<=int(flameLimit);
  // Require agreement for two successive samples before sounding the alarm.
  static int hits=0; hits=smoke && ir?min(2,hits+1):0;
  int s=hits==2?2:(!radio||!ready||!smokeLimit||!flameLimit||smoke||ir||!isfinite(t)||!isfinite(h)||moisture<0)?1:0;
  lights(s);digitalWrite(32,s==2);
  char a[32],b[32],packet[100];
  snprintf(a,sizeof a,"T%.1fC H%.0f%%",t,h);
  snprintf(b,sizeof b,"%s M%d",s==2?"ALARM":!radio?"RADIO OFF":!ready?"PANAS MQ":s==1?"CEK":"NORMAL",mq);
  line(0,a,oldA);line(1,b,oldB);
  snprintf(packet,sizeof packet,"FF1,%d,%.1f,%.1f,%d,%d,%d",s,t,h,moisture,mq,flame);
  Serial.println(packet);
  static unsigned long sent=0;
  if(radio && now-sent>=10000){sent=now; if(LoRa.beginPacket()){LoRa.print(packet);LoRa.endPacket(true);}}
}
void receivePacket(unsigned long now){
  if(!radio || !LoRa.parsePacket()) return;
  char buf[100]; size_t n=0; bool valid=true;
  while(LoRa.available()){int c=LoRa.read();if(n<sizeof(buf)-1 && c>=32 && c<=126)buf[n++]=c;else valid=false;}
  buf[n]=0;
  int s,soilRaw,m,f;float temp,hum;char extra;
  if(!valid || sscanf(buf,"FF1,%d,%f,%f,%d,%d,%d%c",&s,&temp,&hum,&soilRaw,&m,&f,&extra)!=6 || s<0 || s>2 || m<0 || m>3300 || f<0 || f>3300)return;
  statusRx=s;t=temp;h=hum;moisture=soilRaw;mq=m;flame=f;rssi=LoRa.packetRssi();lastRx=now;received=true;
  Serial.printf("%s,%d\n",buf,rssi);
}
void showGateway(unsigned long now){
  receivePacket(now);
  bool online=received&&now-lastRx<35000UL;
  static bool wasOnline=false;
  if(wasOnline && !online)Serial.println("LINK,LOST");
  wasOnline=online;
  lights(online?statusRx:1);
  char msg[100];
  if(!online)snprintf(msg,sizeof msg,"%s",!radio?"RADIO OFF / ERROR":received?"KONEKSI PUTUS":"MENUNGGU NODE");
  else snprintf(msg,sizeof msg,"%s\nT %.1f C H %.0f %%\nTanah %d\nMQ %d IR %d mV\nRSSI %d dBm",statusRx==2?"ALARM":statusRx==1?"CEK NODE":"NORMAL",t,h,moisture,mq,flame,rssi);
  if(screen && strcmp(oldO,msg)){strcpy(oldO,msg);oled.clearDisplay();oled.setCursor(0,0);oled.setTextSize(1);oled.setTextColor(SSD1306_WHITE);oled.print(msg);oled.display();}
}
void loop(){settings();unsigned long now=millis();if(gateway)showGateway(now);else node(now);delay(10);}

// LCD shares GPIO21/22 through the bidirectional translator.

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik