LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsIndustrial soil probes have sealed stainless pins and an RS485 output that works over tens of metres of cable, unlike cheap analog probes that corrode. The SN-300SD reports volumetric soil moisture over Modbus RTU. A MAX3485 module turns the ESP32's 3.3 V serial into RS485, and the ModbusMaster library reads the register. RS485 sensors from different makers use different default addresses, baud rates and register numbers. The values in the sketch are typical defaults; check them against the manual that came with your sensor before you rely on the readings.
Keep the 12 V adapter and electronics in a waterproof box; only the probe goes in the soil.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
12 V adapter for the probe; the ESP32 runs from it through the 5 V buck.
rs485_soil.inoVerify & upload in Electrolark#include <ModbusMaster.h>
#include <Adafruit_SSD1306.h>
// From the sensor's manual: address, baud and the register to read
const uint8_t ADDR = 1;
const long BAUD = 4800;
const uint16_t REG = 0x0000; // moisture x10 on many probes
const float SCALE = 0.1;
ModbusMaster node;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const int DE_RE = 4;
void preTx() { digitalWrite(DE_RE, HIGH); }
void postTx() { digitalWrite(DE_RE, LOW); }
void setup() {
Serial.begin(115200);
Serial2.begin(BAUD, SERIAL_8N1, 16, 17); // RX, TX to the MAX3485
pinMode(DE_RE, OUTPUT); postTx();
node.begin(ADDR, Serial2);
node.preTransmission(preTx);
node.postTransmission(postTx);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}
void loop() {
uint8_t r = node.readHoldingRegisters(REG, 1);
oled.clearDisplay(); oled.setTextColor(WHITE); oled.setTextSize(2); oled.setCursor(0, 10);
if (r == node.ku8MBSuccess) {
oled.print(node.getResponseBuffer(0) * SCALE, 1); oled.print(" %");
} else {
oled.setTextSize(1); oled.print("No reply, code "); oled.print(r, HEX);
}
oled.display();
delay(2000);
}
Wrong baud or address, or A and B are swapped.
The probe is in air or loose soil; reinstall it firmly.
Join all grounds and keep the RS485 pair twisted.
RS485 works over hundreds of metres at low baud rates; use twisted pair.
Yes, give each a different Modbus address and read them in turn.
Yes, add a relay and switch it below a moisture threshold.
8 parts: SN-300SD-TR-N01 RS485 Soil Moisture Sensor, MAX3485 TTL to RS485 Converter Module – 3.3V Logic, ESP32-WROOM-32 38-Pin Development Board, 0.96" OLED Display 128x64, Step-Down Converter to 5V USB / 5V 3A, DC Power Adapter (5.5x2.1mm), Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
No. This page has the complete, tested code (rs485_soil.ino).
About ₹2,663 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Modbus RTU basics: address, function, register; Driving an RS485 transceiver's DE/RE pins; Installing a soil probe for good readings.
Keep the 12 V adapter and electronics in a waterproof box; only the probe goes in the soil.
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
See the smoke level live on a crisp screen and get a loud warning when it spikes.
An infrared eye that spots an open flame and raises the alarm.
Walk into the room and it sounds the alarm: the classic first security build.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.