Skip to content

ItsCaptainEXE/SteadyPing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slayd Development Shutdown

SteadyPing 📡

Arduino Registry GitHub release (latest by date) License Maintained

SteadyPing is a high-stability Arduino library developed and maintained by CaptainEXE to solve the common "jitter" problem found in HC-SR04 ultrasonic sensors.

While traditional ultrasonic sensor code often produces unstable readings such as 25.1, 26.4, and 24.8, SteadyPing uses lightweight signal-processing techniques to deliver smooth, reliable, single-decimal measurements.


✨ Features

  • Median Filtering: Captures a burst of 5 samples and selects the true median value to eliminate random interference and "ghost" pings.
  • Precision Rounding: Automatically formats measurements to one decimal place for clean and professional Serial output.
  • Micro-Delay Timing: Optimized pulseIn() handling prevents freezes or hangs when no object is detected.
  • Universal Compatibility: Efficiently designed for Arduino Uno, Mega, Nano, and ESP-based boards.
  • Lightweight Performance: Minimal memory overhead for embedded projects and robotics systems.

🚀 Installation

Via Arduino Library Manager (Recommended)

  1. Open the Arduino IDE.
  2. Navigate to Sketch → Include Library → Manage Libraries...
  3. Search for SteadyPing.
  4. Click Install.

Manual Installation

  1. Download the latest .zip release.
  2. Open the Arduino IDE.
  3. Navigate to Sketch → Include Library → Add .ZIP Library...
  4. Select the downloaded archive.

🛠️ Quick Start

#include <SteadyPing.h>

// Initialize: SteadyPing objectName(TrigPin, EchoPin);
SteadyPing sonar(9, 10);

void setup() {
  Serial.begin(9600);
}

void loop() {
  // Retrieve a stable distance reading
  float distance = sonar.getDistance();

  Serial.print("Stable Distance: ");
  Serial.print(distance);
  Serial.println(" cm");

  delay(100);
}

🔧 Engineering Logic

SteadyPing does not rely on basic averaging methods, since averages can still be heavily affected by large sensor errors or invalid readings.

Instead, the library uses a sorting-based median filtering system to determine the mathematical center value of the sensor sample buffer. Even if the sensor accidentally reports a 0 or invalid spike, the final output remains smooth and stable.

This makes SteadyPing especially useful for:

  • Robotics
  • Distance monitoring systems
  • Obstacle avoidance
  • STEM and classroom projects
  • Embedded automation systems

📂 Repository Information

Maintainer: CaptainEXE Organization: CaptainEXE Studios Website: https://captainexe.vercel.app Status: v1.1.0-Stable


📜 License

SteadyPing is open-source software released under the MIT License.

About

A high-stability Arduino library for the HC-SR04 ultrasonic sensor that uses median filtering and precision rounding to eliminate data jitter.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages