LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsLight a row of LEDs automatically when the surroundings get dark, and switch them off again at dawn, the logic behind every street lamp in your town. An LDR is simply a resistor whose value falls when light hits it. On its own the ESP32 cannot measure resistance, so the LDR is paired with a fixed 10kΩ resistor to form a voltage divider: as the light changes, the voltage at GPIO34 changes with it. The threshold in the sketch is the decision point between day and night, read your own room's values in the Serial Monitor first and set it about halfway between the lit and the covered reading.
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
LEDs from the kit's red, green, yellow and blue packs
220 ohm resistors: one in series with every LED
10k resistor: the fixed half of the light-sensing divider
LDR: its resistance falls as the light gets brighter
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_019_smart_street_light.inoVerify & upload in Electrolarkint ldrPin = 34;
int ledPins[4] = {13, 12, 14, 27};
int threshold = 400;
void setup()
{
analogReadResolution(10); // ESP32 is 12-bit; use 0-1023 like the examples
for (int i = 0; i < 4; i++)
{
pinMode(ledPins[i], OUTPUT);
}
Serial.begin(9600);
}
void setLamps(int state)
{
for (int i = 0; i < 4; i++)
{
digitalWrite(ledPins[i], state);
}
}
void loop()
{
int lightLevel = analogRead(ldrPin);
Serial.print("Light level: ");
Serial.println(lightLevel);
if (lightLevel < threshold)
{
setLamps(HIGH); // Dark - street lights ON
}
else
{
setLamps(LOW); // Bright - street lights OFF
}
delay(300);
}
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 it round: the long leg (anode) goes to the GPIO side through the 220 ohm resistor, the short leg to GND.
The LDR and the 10k resistor must meet at the analog GPIO: LDR to 3V3, resistor to GND.
An LDR is simply a resistor whose value falls when light hits it. On its own the ESP32 cannot measure resistance, so the LDR is paired with a fixed 10kΩ resistor to form a voltage divider: as the light changes, the voltage at GPIO34 changes with it. The threshold in the sketch is the decision point between day and night, read your own room's values in the Serial Monitor first and set it about halfway between the lit and the covered reading.
Serial Monitor prints Light level: 720 in a lit room. Cover the LDR with your hand and all four LEDs switch on together. Uncover it and they switch off again.
Yes. It is project 19 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.
9 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), 4 × Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), 5 mm LDR Light Dependent Resistor 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_019_smart_street_light.ino).
About ₹764 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
LDR thresholds and automation; Voltage dividers, turning resistance into voltage; Driving several outputs from one function; Calibrating a sensor to its environment.
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.