LPG gas leak alarm
A kitchen gas sniffer that beeps and flashes the moment LPG levels climb.
Shop by category
Shop all componentsA pedometer counts the up-and-down bounce of walking. This project reads an ADXL345 accelerometer, takes the overall acceleration magnitude, smooths it and counts each time it crosses a threshold, with a short lockout so one step is not counted twice. The OLED shows steps and a rough distance using an average step length. It is a learning build and not a medical device; accuracy depends on where you wear it, and a belt or pocket works best.
This is not a medical device.
Tick anything you already have and the total updates.
ADXL345 accelerometer module
Follow the colours: red is power, dark grey is ground, blue is a signal.
A small power bank in your pocket.
pedometer.inoVerify & upload in Electrolark#include <Wire.h>
#include <Adafruit_ADXL345_U.h>
#include <Adafruit_SSD1306.h>
Adafruit_ADXL345_Unified accel(12345);
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const float STEP_LIMIT = 11.5; // m/s^2 above gravity-ish baseline: tune for your pocket or belt
const float STEP_M = 0.7; // your average step length in metres
float smooth = 9.8;
bool above = false;
unsigned long lastStep = 0;
int steps = 0;
void setup() {
Wire.begin(21, 22);
accel.begin();
accel.setRange(ADXL345_RANGE_8_G);
oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled.setTextColor(WHITE);
}
void loop() {
sensors_event_t e;
accel.getEvent(&e);
float mag = sqrt(e.acceleration.x * e.acceleration.x + e.acceleration.y * e.acceleration.y + e.acceleration.z * e.acceleration.z);
smooth = 0.7 * smooth + 0.3 * mag; // smooth the noise
if (smooth > STEP_LIMIT && !above && millis() - lastStep > 300) {
steps++; above = true; lastStep = millis();
}
if (smooth < STEP_LIMIT - 1.0) above = false;
oled.clearDisplay();
oled.setTextSize(1); oled.setCursor(0, 0); oled.print("Steps");
oled.setTextSize(3); oled.setCursor(0, 12); oled.print(steps);
oled.setTextSize(1); oled.setCursor(0, 48); oled.printf("%.2f km", steps * STEP_M / 1000.0);
oled.display();
delay(20);
}
Raise STEP_LIMIT or the lockout time. Jolts from a loose cable are counted as steps.
Lower STEP_LIMIT and wear it tighter against the body.
Check the I2C wiring; the address is usually 0x53.
Within about 10 percent when tuned, for casual use.
At the hip or in a trouser pocket, firmly held.
No, it is a learning project and not for medical use.
5 parts: ESP32-WROOM-32 38-Pin Development Board, Generic ADXL345 Digital Acceleration Sensor Module – I2C/SPI, 3.3V/5V Compatible, 0.96" OLED Display 128x64, 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 6 steps.
No. This page has the complete, tested code (pedometer.ino).
About ₹781 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Reading an ADXL345 over I2C; Detecting steps with a threshold and a lockout; Estimating distance from step count.
This is not a medical device.
Ideas that reuse this build: ESP32 MPU6050 spirit level. They are listed under Take it further on this page.
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.