LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsUse a capacitive touch pad as a switch, where one tap turns the light on and the next turns it off. The TTP223 senses the tiny change in electrical capacitance your finger adds to its copper pad, no moving parts, and it works through several millimetres of plastic or wood. The important idea in the code is toggling: instead of the LED following the pad, one touch flips the state. The ! operator means "the opposite of", so lampOn = !lampOn turns true into false and back. Waiting for the finger to lift stops one touch from flipping the state dozens of times.
Every part for this build comes in the Geekobot Explorer Kit box, a Geekobot exclusive, together with the parts for all 61 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 Explorer Kit project
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 segment
TTP223 touch module (the kit has a pack of two, twice)
Nano I/O shield from the kit: every pin has its own S, V, G header, so modules plug in with jumpers
Follow the colours: red is power, dark grey is ground, blue is a signal.
explorer_kit_05_touch_sensor_lamp.inoVerify & upload in Electrolarkint touchPin = 2;
int led = 8;
bool lampOn = false;
void setup()
{
pinMode(touchPin, INPUT);
pinMode(led, OUTPUT);
Serial.begin(9600);
Serial.println("Touch the pad to switch the lamp");
}
void loop()
{
if (digitalRead(touchPin) == HIGH)
{
lampOn = !lampOn; // Flip to the opposite state
digitalWrite(led, lampOn);
Serial.print("Lamp is now ");
Serial.println(lampOn ? "ON" : "OFF");
// Wait until the finger is lifted before accepting another touch
while (digitalRead(touchPin) == HIGH)
{
delay(10);
}
delay(50);
}
}
Use the kit's mini-USB cable, install the CH340 driver on Windows if no port appears, pick Tools > Board > Arduino Nano and try Tools > Processor > ATmega328P (Old Bootloader) if the upload times out.
Turn it round: the long leg (anode) goes to the pin side through the 220 ohm resistor, the short leg to GND.
Power it from 5V and GND, and touch the pad itself. Some modules toggle on each touch: the sketch expects the default momentary mode.
The TTP223 senses the tiny change in electrical capacitance your finger adds to its copper pad, no moving parts, and it works through several millimetres of plastic or wood. The important idea in the code is toggling: instead of the LED following the pad, one touch flips the state. The ! operator means "the opposite of", so lampOn = !lampOn turns true into false and back. Waiting for the finger to lift stops one touch from flipping the state dozens of times.
Touch the pad once and the LED lights. Take your finger away, the LED stays on. Touch again and it goes out.
Yes. It is project 5 of 61 in the Geekobot Explorer Kit, in level 1 (Foundations). 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 Explorer Kit project is wired on the Nano I/O shield and the breadboard with jumper wires.
7 parts: Generic Nano CH340 Development Board (Soldered), USB Cable, Dupont Jumper Wires (40 pcs), Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), Capacitive Touch Sensor Module and Arduino Nano IO Expansion Shield (328P Compatible). 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 20 minutes. The build on this page has 5 steps.
No. This page has the complete, tested code (explorer_kit_05_touch_sensor_lamp.ino).
About ₹454 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Capacitive touch sensing basics; Toggling a state with the ! operator; Storing a state in a bool variable; Waiting for release so one touch counts once.
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.
Learning project. Check every circuit and the datasheet of each part before you power it up.