Water level measurement by an Ultrasonic sensor using Raspberry Pi

Call for Price

Water level measurement by an Ultrasonic sensor using Raspberry Pi

SKU: level measurement by an Ultrasonic sensor using Raspberry Pi Category:

Description

ABSTRACT

Raspberry Pi which is a tiny PC which having inbuilt Bluetooth and Wi-Fi, which is programmed by using Python programming. By this Project, you will learn to interface Ultrasonic sensor with Raspberry Pi and to get the distance value. From the ultrasonic sensor. The Ultrasonic sensor is used to measure the distance in Centimeters, thus the sensor is placed in the top of the container to measure the presence of a substance which presents inside the container, as water increases, ultrasound gets reflected back to the echo phase, which triggered from Trigger phase. From this Raspberry Pi beginner project, you will learn to use an ultrasonic sensor with Raspberry Pi for various applications.

HARDWARE REQUIRED

  • Raspberry Pi
  • SD card
  • Power supply
  • VGA to HDMI converter (Optional)
  • MCP3008 (ADC IC)
  • Ultrasonic sensor

 

SOFTWARE REQUIRED

  • Raspbian Stretch OS      
  • SD card Formatter
  • Win32DiskImager (or) Etcher

PYTHON LIBRARIES USED

  • RPi.GPIO as GPIO (To access the GPIO Pins of Raspberry Pi)
  • Time library (For Time delay)

CODE

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(23,GPIO.OUT)
GPIO.setup(24,GPIO.IN)
TRIG=23
ECHO=24
GPIO.output(TRIG, False)
time.sleep(2)
def val():
	GPIO.output(TRIG, True)
	time.sleep(0.00001)
	GPIO.output(TRIG, False)
	while GPIO.input(ECHO)==0:
		pulse_start = time.time()
	while GPIO.input(ECHO)==1:
		pulse_end = time.time()
	pulse_duration = pulse_end - pulse_start
	distance = pulse_duration*17150
	distance = round(distance, 2)
	return distance
while True:
        x=val()
        print("LEVEL in the unit of Centimeters:")
        print (x)
        time.sleep(1)

Additional information

Weight 1.000000 kg

Reviews

There are no reviews yet.

Be the first to review “Water level measurement by an Ultrasonic sensor using Raspberry Pi”

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.