Challenge

Project 2 - Measuring the distance of an object using ultrasonic sensor and also smoothen the sensor data using moving average filter

Measuring distance of an object using ultrasonic distance sensor (28015 Ping) and also smoothen the sensor data using moving average filter

  • Ultrasonic sensors are great tools to measure distance and detect objects without any actual contact with the physical world.
  • The basic principle of ultrasonic distance measurement is based on ECHO.
  • When sound waves are transmitted in the environment then waves return back to the origin as ECHO after striking on the obstacle.
  • So we only need to calculate the traveling time of both sounds means outgoing time and returning time to origin after striking on the obstacle.

In this project the implementation of code for “Measuring distance of an object using ultrasonic distance sensor (28015 Ping)

PING))) Sensor Features

  • The PING))) has only has three connections: Vdd, Vss, and one I/O pin.
  • It detects the distance of the closest object in front of the sensor (from 3 cm up to 400 cm).
  • The circuit:
    * +V connection of the PING))) attached to +5V
    * GND connection attached to ground
    * SIG connection attached to digital pin 7

CIRCUIT DIAGRAM

CODE

Smoothening the sensor data by removing high frequency variations using Moving Average Filter Technique

What is a Moving Average Filter

  • A moving average filter is a basic technique that can be used to remove noise (random interference) from a signal.
  • It is a simplified form of a low-pass filter.
  • Running a signal through this filter will remove higher frequency information from the output.
  • The only real parameter that can be controlled in the moving average filter is the window size.
  • which is the amount of previous signal entries that can be averaged together.
  • If the window is too small, the signal may still end up being very noisy.
  • However, if the window is too large, critical information in the signal may be lost.
  • Choosing the right window size is a matter of trial and error.
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.