LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsTurn a single knob and sweep smoothly through the whole colour spectrum on an RGB LED. The potentiometer gives a number from 0 to 1023. That single number is stretched to a 0–764 colour wheel and then split into three stages: red fading into green, green into blue, and blue back into red. Each of the three channels is written with analogWrite(), which uses PWM, switching the LED on and off thousands of times a second so it appears dimmer or brighter rather than simply on or off.
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
220 ohm resistors: one in series with every LED
10k potentiometer: a knob the ESP32 reads on an analog pin
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_018_rgb_mood_lamp.inoVerify & upload in Electrolarkint potPin = 34;
int redPin = 32;
int greenPin = 5;
int bluePin = 23;
void setup()
{
analogReadResolution(10); // ESP32 is 12-bit; use 0-1023 like the examples
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop()
{
int potValue = analogRead(potPin);
int wheel = map(potValue, 0, 1023, 0, 764);
int r = 0;
int g = 0;
int b = 0;
if (wheel < 255)
{
r = 255 - wheel;
g = wheel;
b = 0;
}
else if (wheel < 510)
{
r = 0;
g = 510 - wheel;
b = wheel - 255;
}
else
{
r = wheel - 510;
g = 0;
b = 764 - wheel;
}
analogWrite(redPin, r);
analogWrite(greenPin, g);
analogWrite(bluePin, b);
delay(20);
}
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.
Check that it is the common-cathode type with the longest leg to GND, and that red, green and blue go to the GPIOs in the table.
The outer pins go to 3V3 and GND and the middle pin (wiper) to the analog GPIO.
The potentiometer gives a number from 0 to 1023. That single number is stretched to a 0–764 colour wheel and then split into three stages: red fading into green, green into blue, and blue back into red. Each of the three channels is written with analogWrite(), which uses PWM, switching the LED on and off thousands of times a second so it appears dimmer or brighter rather than simply on or off.
Knob fully left: pure red. Turning slowly: red → orange → green → cyan → blue → magenta. Knob fully right: back to red.
Yes. It is project 18 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.
8 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), 5mm RGB LED (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), 16mm Rotary Potentiometer (Linear) 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_018_rgb_mood_lamp.ino).
About ₹731 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Analog input mapping to PWM output; The map() function; Mixing colours from three channels; Why analogWrite() only works on PWM (~) pins.
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.