LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe HWT901B-485 is WitMotion's high-accuracy 9-axis inertial sensor with an RS485 Modbus interface. It runs its own fusion, so it reports finished roll, pitch and yaw angles, not just raw readings. Bolted to a pole, tank, crane or machine base, it shows any change in tilt. A USB to RS485 adapter connects it to a computer, and a Python script reads the angle registers, logs them to CSV and prints a warning above a limit.
This is an early-warning aid; it does not replace a structural inspection.
Tick anything you already have and the total updates.
WitMotion HWT901B-485 9-axis IMU
Follow the colours: red is power, dark grey is ground, blue is a signal.
DC adapter within the sensor's rated supply range.
tilt_monitor.pyimport csv, time
from pymodbus.client import ModbusSerialClient
PORT, BAUD, UNIT = "/dev/ttyUSB0", 9600, 0x50
ROLL_REG = 0x3D # roll, pitch, yaw follow in 0x3D-0x3F (check the manual)
LIMIT = 2.0 # degrees of change before a warning
def s16(v): return v - 65536 if v > 32767 else v
c = ModbusSerialClient(port=PORT, baudrate=BAUD, timeout=1)
c.connect()
start = None
with open("tilt_log.csv", "a", newline="") as f:
log = csv.writer(f)
while True:
r = c.read_holding_registers(ROLL_REG, count=3, slave=UNIT)
if r.isError():
print("no reply"); time.sleep(2); continue
roll, pitch, yaw = (s16(v) / 32768 * 180 for v in r.registers)
if start is None: start = (roll, pitch)
d = max(abs(roll - start[0]), abs(pitch - start[1]))
log.writerow([time.strftime("%Y-%m-%d %H:%M:%S"), f"{roll:.2f}", f"{pitch:.2f}", f"{yaw:.1f}"]); f.flush()
print(f"roll {roll:6.2f} pitch {pitch:6.2f} yaw {yaw:6.1f}" + (" WARNING: tilt changed" if d > LIMIT else ""))
time.sleep(1)
Swap A and B, and check address 0x50 and the baud rate with WitMotion's PC software.
Calibrate the magnetometer with WitMotion's software away from steel.
Yaw wraps at plus and minus 180; compare roll and pitch for tilt.
Roll and pitch to a fraction of a degree when still; see the datasheet.
Yes, it is in a sealed case; protect the cable entry.
Yes, with an RS485 module and a Modbus library.
3 parts: WTMotion HWT901B High-Accuracy-485 9-Axis IMU Sensor | Gyroscope + Accelerometer + Magnetometer + Barometer, USB to RS485 Converter Adapter and DC Power Adapter (5.5x2.1mm). 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 6 steps.
No. This page has the complete, tested code (tilt_monitor.py).
About ₹8,142 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Reading Modbus holding registers; Roll, pitch and yaw; Logging a slow trend to CSV.
This is an early-warning aid; it does not replace a structural inspection.
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.