LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThis turns project 10's numbers into a decision. The sketch reads the LDR on A0, compares it with a threshold and switches the LED on D2. The threshold and the direction live in two constants at the top, so you set them once from your Serial Monitor readings and the lamp works with any LDR module.
Every part for this build comes in the Geekobot Spark Kit box, a Geekobot exclusive, together with the parts for all 24 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.
The brain of every Spark Kit project
LDR light sensor module with analog output
220 ohm resistor pack: limits the LED current
Sensor Shield v5.0 from the kit: every pin has its own G, V, S header, so modules plug in with female jumpers
Follow the colours: red is power, dark grey is ground, blue is a signal.
spark_kit_11_automatic_night_lamp.inoVerify & upload in Electrolark// Spark Kit 11: automatic night lamp
int ldr = A0;
int led = 2;
int THRESHOLD = 300; // halfway between your bright and dark readings
bool DARK_IS_LOW = true; // set false if your module reads higher in the dark
void setup() {
pinMode(led, OUTPUT);
Serial.begin(9600);
}
void loop() {
int value = analogRead(ldr);
Serial.println(value);
bool dark = DARK_IS_LOW ? (value < THRESHOLD) : (value > THRESHOLD);
digitalWrite(led, dark ? HIGH : LOW);
delay(200);
}
Use the kit's USB cable (some phone cables carry power only), install the CH340 driver on Windows if the port does not appear, and pick Tools > Board > Arduino Uno.
Set DARK_IS_LOW to false (or true) to match your module.
The reading is sitting on the threshold. Move THRESHOLD further from the bright reading.
Print the readings, cover the sensor with your hand for the dark value, and choose a number halfway between dark and normal room light.
With a relay module and a qualified person for the mains side, yes. Keep the kit build to the LED.
Yes. It is one of the 24 projects in the Geekobot Spark Kit, and every part on the list comes in the kit box. You can also buy the parts one by one from the list above.
No. Every Spark Kit project is wired on the breadboard or the Sensor Shield with jumper wires.
8 parts: Uno R3 CH340G ATmega328p Compatible Development Board, Arduino USB-A to USB-B Data Cable for UNO/MEGA, Generic Photosensitive Resistor Sensor Module for Arduino – Light Dependent Resistor (LDR), Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), Solderless Breadboard, Dupont Jumper Wires (40 pcs) and Arduino Sensor Shield V5 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 6 steps.
No. This page has the complete, tested code (spark_kit_11_automatic_night_lamp.ino).
About ₹455 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Analog thresholds; Automatic control; Calibrating a sensor from real readings.
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.