Skip to content

ChenBingWei1201/pedometer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Pedometer

A lightweight, battery-efficient step counter built with ESP32 and ADXL345 accelerometer. Created for 2024 MakeNTU hackathon.

Pedometer Device

✨ Features

  • Accurate Step Counting: Uses acceleration magnitude algorithm for reliable step detection
  • Persistent Memory: Retains step count even when power is lost
  • Low Power Consumption: Optimized for portable use
  • Touch Reset: Easy step counter reset with ESP32's touch sensor
  • Real-time Display: Instant step count feedback on OLED screen

🔧 Hardware Requirements

  • ESP32 Microcontroller
  • ADXL345 3-Axis Accelerometer
  • SSD1306 OLED Display (128x64)
  • Connecting wires
  • Power source (battery or USB)

📦 Software Dependencies

  • Arduino IDE
  • Libraries:
    • Adafruit_SSD1306
    • Adafruit_ADXL345
    • Adafruit_GFX
    • Wire
    • EEPROM

🏗️ Project Structure

pedometer/
│
├── pedometer.ino              # Main program file
├── src/
│   ├── constant.h             # Constants and configuration
│   ├── oled/                  # OLED display module
│   │   ├── oled.h
│   │   └── oled.cpp
│   ├── adxl/                  # Accelerometer module
│   │   ├── adxl.h
│   │   └── adxl.cpp
│   └── stepDetector/          # Step detection algorithm
│       ├── StepDetector.h
│       └── StepDetector.cpp

🚀 How It Works

  1. The ADXL345 accelerometer captures motion in three dimensions (X, Y, Z)
  2. The StepDetector algorithm:
    • Calculates the magnitude of acceleration across all axes
    • Maintains a rolling buffer of recent values
    • Detects a step when movement exceeds average + threshold
    • Uses debounce logic to prevent false counts
  3. Step count is displayed on the OLED screen and saved to EEPROM
  4. Touch the T0 pin to reset the counter

📺 Demo

🔄 Usage

  1. Connect the hardware components according to the pins defined in the code
  2. Upload the code to your ESP32
  3. Power on the device
  4. Start walking to see the step count increase
  5. Touch the T0 pin to reset the counter when needed

📚 References

⚠️ Disclaimer & License

This project is for educational purposes only. Not intended for commercial use.

This project is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License (CC BY-NC 4.0). You are free to use, share, and adapt the material for non-commercial purposes, provided you give appropriate credit to the original authors.


⭐ If you find this project helpful, please give it a star! Your support motivates us to create better projects! (❁´◡`❁)

About

pedometer with esp32, adxl345, and oled ssd1306 in OOP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors