LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsThe SparkFun SAM-M8Q breakout has a u-blox GPS module with its own chip antenna, so there is no separate antenna to mount. Over I2C (Qwiic) the ESP32 asks for position and ground speed using u-blox's binary protocol through SparkFun's library. The sketch adds up the distance between fixes, ignoring tiny jumps while you stand still.
Do not look at the display for long while riding; glance only when safe.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB power bank or a LiPo with charger on the bike.
gps_speedo.inoVerify & upload in Electrolark#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
#include <SparkFun_u-blox_GNSS_v3.h>
SFE_UBLOX_GNSS gnss;
double lastLat = 0, lastLon = 0, tripKm = 0;
double distKm(double a1, double o1, double a2, double o2) {
const double R = 6371.0, d2r = PI / 180;
double dA = (a2 - a1) * d2r, dO = (o2 - o1) * d2r;
double h = sin(dA / 2) * sin(dA / 2) + cos(a1 * d2r) * cos(a2 * d2r) * sin(dO / 2) * sin(dO / 2);
return 2 * R * asin(sqrt(h));
}
void setup() {
Wire.begin();
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(WHITE);
while (!gnss.begin()) delay(1000);
gnss.setI2COutput(COM_TYPE_UBX);
gnss.setNavigationFrequency(1);
}
void loop() {
if (!gnss.getPVT()) return;
int sats = gnss.getSIV();
float kmh = gnss.getGroundSpeed() * 0.0036; // mm/s to km/h
double lat = gnss.getLatitude() / 1e7, lon = gnss.getLongitude() / 1e7;
if (gnss.getFixType() >= 3 && lastLat != 0 && kmh > 2) tripKm += distKm(lastLat, lastLon, lat, lon);
if (gnss.getFixType() >= 3) { lastLat = lat; lastLon = lon; }
oled.clearDisplay();
oled.setTextSize(1); oled.setCursor(0, 0); oled.print("Sats "); oled.print(sats);
oled.setTextSize(3); oled.setCursor(0, 16); oled.print(kmh, 1); oled.setTextSize(1); oled.print(" km/h");
oled.setTextSize(2); oled.setCursor(0, 46); oled.print(tripKm, 2); oled.setTextSize(1); oled.print(" km");
oled.display();
}
Indoors or under a roof; GPS needs open sky.
GPS wanders a few metres; the sketch ignores speeds under 2 km/h, raise it if needed.
Check the I2C wiring; the SAM-M8Q runs on 3.3 V.
No, GPS works anywhere with a view of the sky.
Usually within about 0.5 km/h when moving steadily.
Yes, add a microSD module and write a GPX file.
6 parts: SparkFun SAM-M8Q GPS Breakout w/ Chip Antenna (Qwiic), ESP32-WROOM-32 38-Pin Development Board, 0.96" OLED Display 128x64, Lithium Polymer (LiPo) Cell 3.7V, Solderless Breadboard and Dupont Jumper Wires (40 pcs). 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 (gps_speedo.ino).
About ₹4,872 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
How GPS gives speed as well as position; Reading a u-blox module over I2C; Adding up distance between GPS fixes.
Do not look at the display for long while riding; glance only when safe.
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.