LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsMeasure how much water is in the soil of a plant pot and report it on the LCD as a percentage with a plain-English status. Wet soil conducts electricity better than dry soil, so the analog reading falls as the soil gets wetter. That is backwards from what a person expects, so map() is used with its input range reversed, 1023 becomes 0% and 300 becomes 100%. constrain() then clips anything outside that band so the display never shows 104%.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
Every part for this build comes in the Geekobot Titan Kit box, a Geekobot exclusive, together with the parts for all 120 projects, from a first blinking LED to a smart fan and a reaction game. The wiring below is the kit's own wiring.
Tick anything you already have and the total updates.
ESP32 DevKit V1 (38-pin): the brain of every Titan Kit project, with Wi-Fi and Bluetooth
Male-to-female and female-to-female leads for the modules
16x2 LCD with I2C backpack: four wires, two lines of text
Soil moisture sensor: the reading changes as the soil gets wetter
ESP32 expansion board from the kit: every GPIO has its own S, V, G header
Follow the colours: red is power, dark grey is ground, blue is a signal.
titan_kit_021_soil_moisture_detector.inoVerify & upload in Electrolark#include <Wire.h>
#include <LiquidCrystal_I2C.h>
int soilPin = 34;
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
analogReadResolution(10); // ESP32 is 12-bit; use 0-1023 like the examples
lcd.init();
lcd.backlight();
Serial.begin(9600);
lcd.setCursor(0, 0);
lcd.print("Soil Monitor");
delay(2000);
lcd.clear();
}
void loop()
{
int raw = analogRead(soilPin);
// Wet soil gives a LOW reading, so the range is reversed
int moisture = map(raw, 1023, 300, 0, 100);
moisture = constrain(moisture, 0, 100);
Serial.print("Raw: ");
Serial.print(raw);
Serial.print(" Moisture: ");
Serial.println(moisture);
lcd.setCursor(0, 0);
lcd.print("Moisture: ");
lcd.print(moisture);
lcd.print("% ");
lcd.setCursor(0, 1);
if (moisture < 30)
{
lcd.print("Status: DRY ");
}
else if (moisture < 70)
{
lcd.print("Status: OK ");
}
else
{
lcd.print("Status: WET ");
}
delay(1000);
}
Use a micro-USB data cable (some cables only charge), install the CP210x or CH340 driver if no port appears, pick Tools > Board > ESP32 Dev Module and hold the BOOT button on the board until the upload starts.
Turn the small contrast pot on the back of the I2C board. If still blank, change 0x27 in the sketch to 0x3F.
Note the reading in dry air and in a glass of water, then put those two numbers into the map() line of the sketch.
Wet soil conducts electricity better than dry soil, so the analog reading falls as the soil gets wetter. That is backwards from what a person expects, so map() is used with its input range reversed, 1023 becomes 0% and 300 becomes 100%. constrain() then clips anything outside that band so the display never shows 104%.
Sensor in air: Moisture: 0% / Status: DRY. Sensor in damp soil: Moisture: 55% / Status: OK. Sensor in a glass of water: Moisture: 100% / Status: WET.
Yes. It is project 21 of 120 in the Geekobot Titan Kit, in level 4 (Light and sensing). Every part on the list comes in the kit box, and you can also buy the parts one by one from the list above.
No. Every Titan Kit project is wired on the ESP32 expansion board and the breadboard with jumper wires.
6 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Dupont Jumper Wires (40 pcs), LCD1602 16x2 Character LCD Display, Capacitive Soil Moisture Sensor – 3.3V/5V Analog Output, PH2.54-3P Interface and ESP32 38-Pin Expansion Board. On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 30 minutes. The build on this page has 5 steps.
No. This page has the complete, tested code (titan_kit_021_soil_moisture_detector.ino).
About ₹823 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Analog sensor reading for soil; Reversing a range with map(); Keeping values in bounds with constrain(); Turning a number into a readable status.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
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.