LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe RPLIDAR A1M8 spins a laser range finder 5-10 times a second and measures up to about 12 m in every direction. Instead of drawing a map, this project watches a zone, for example 'between 30 and 90 degrees, closer than 1.5 m', such as a machine's danger area or a doorway. The rplidar Python library reads the scans; when enough points land in the zone, it prints an alert and can trigger anything else you like.
Not a certified machine guard; never rely on it to protect people from moving machinery.
Tick anything you already have and the total updates.
Slamtec RPLIDAR A1M8
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB from the computer.
zone_alarm.pyfrom rplidar import RPLidar
import time
PORT = "/dev/ttyUSB0"
ZONE = (30, 90, 1500) # from angle, to angle (degrees), max distance (mm)
MIN_POINTS = 5
lidar = RPLidar(PORT)
last = 0
try:
for scan in lidar.iter_scans():
hits = [d for (q, a, d) in scan if ZONE[0] <= a <= ZONE[1] and 0 < d < ZONE[2]]
if len(hits) >= MIN_POINTS and time.time() - last > 3:
last = time.time()
print(time.strftime("%H:%M:%S"), "ALERT: something at", int(min(hits)), "mm")
print("\a", end="") # terminal bell; swap for a GPIO buzzer on a Pi
except KeyboardInterrupt:
pass
finally:
lidar.stop(); lidar.stop_motor(); lidar.disconnect()
Unplug and replug, then start the script again; the lidar was mid-scan.
Shiny or black surfaces give stray points; raise MIN_POINTS or shrink the zone.
Weak USB port; use a powered hub.
At the cable end on the A1; check by placing an object and printing its angle.
Yes, keep a list of zones and check each one per scan.
No, it is a learning project; machines need certified safety scanners.
1 part: Slamtec RPLIDAR A1M8 360° Laser Range Finder 6m Radius – 12m Diameter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 hours. The build on this page has 5 steps.
No. This page has the complete, tested code (zone_alarm.py).
About ₹9,899 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Reading RPLIDAR scans in Python; Defining zones in polar coordinates; Filtering noise by needing several points.
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.