Phone

    00852-6915 1330

hc-sr04 Related Articles

Stay Ahead with Expert Electronics Insights,
Industry Trends, and Innovative Tips

Sensor

Smart Walking Stick for Visually Impaired

CatalogIntroductionComponents RequiredSoftware RequiredHardwareUltrasonic Sensor (HC-SR04)WorkingCOMPLETE HARDWARESoftwareConclusion Future Enhancement in the Project IntroductionThe aim of this undertaking is to educate ourselves on the creation of a Blind Walking Stick that utilizes an Arduino and an Ultrasonic Sensor HC-SR04. There are Billions of people who are blind in this world. These individuals require assistance from others to navigate and move around as they are unable to do so independently. To address this issue, we have developed a device called the Blind Walking Stick which enables visually impaired individuals to walk more easily without relying on others for assistance. To enhance the device's accuracy and efficiency, two or three Ultrasonic Sensors can be incorporated into the project.  Components Required: Arduino UNO BoardHC-SR04 Ultrasonic SensorBuzzer9 Volt BatterySwitch (Optional) Software Required:Arduino IDE  Hardware: Connection of Ultrasonic Sensor with Arduino.  Vcc pin of Ultrasonic Sensor  is connected to 5-volt pin of ArduinoTrigger pin of Sensor is connected to D9 pin of ArduinoEcho pin of Sensor is connected to the D10 pin of ArduinoThe ground of Sensor is connected to the GND pin of Arduino.The positive terminal of the 9-volt battery is connected to the Vin pin of Arduino and the negative terminal is connected to the GND pin of Arduino.A buzzer is connected between the D9 pin of Arduino and the GND pin Ultrasonic Sensor (HC-SR04)An electronic device known as an ultrasonic sensor is utilized to determine the distance of an object by emitting ultrasonic sound waves and then transforming the reflected sound into an electrical signal. These ultrasonic waves travel at a faster rate than audible sound, which cannot be perceived by humans. The ultrasonic sensor is comprised of two major components: the transmitter, which uses piezoelectric crystals to emit the sound, and the receiver, which detects the sound after it has traveled to and from the object. To compute the distance between the object and the sensor, the sensor calculates the time taken for the sound to travel from the transmitter to the receiver. This calculation is based on the formula D = ½ T x C, where D represents distance, T denotes time, and C is the speed of sound, roughly 343 meters/second. As an illustration, if an ultrasonic sensor is pointed at a box and it takes 0.025 seconds for the sound to return, then the distance between the sensor and the box can be calculated.D = 0.5 x 0.025 x 343  Ultrasonic sensors are used primarily as proximity sensors. They can be found in automobile self-parking technology and anti-collision safety systems. Ultrasonic sensors are also used in robotic obstacle detection systems, as well as manufacturing technology. In comparison to infrared (IR) sensors in proximity sensing applications, ultrasonic sensors are not as susceptible to interference of smoke, gas, and other airborne particles (though the physical components are still affected by variables such as heat).  Ultrasonic sensors are also used as level sensors to detect, monitor, and regulate liquid levels in closed containers (such as vats in chemical factories). Most notably, ultrasonic technology has enabled the medical industry to produce images of internal organs, identify tumors, and ensure the health of babies in the womb. WorkingThe primary aim of this project is to facilitate blind individuals in walking without difficulty and provide them with alerts whenever their path is obstructed by obstacles. The device utilizes a buzzer that emits a warning signal, the frequency of which changes based on the distance of the object. The buzzer will beep more frequently when the obstruction is closer. The core component used in the device is the Ultrasonic Sensor HC-SR04, which functions by transmitting a high-frequency sound pulse and then measuring the time taken to receive the sound echo reflection. The sensor is equipped with a transmitter and a receiver surface, with one transmitting ultrasonic waves and the other receiving the echoed sound signal. The sensor's calibration is based on the speed of sound in air, which is approximately 341 meters per second. After the distance measurement, Arduino makes a beep format using a buzzer also the led glow as well, The frequency of the beep is reduced when the distance is greater, and increased when the distance is shorter. COMPLETE HARDWARE  This is the Complete Hardware of our Project. Since this is a Prototype circuit so we used Selfie stick because it can extend and also We did not used 9V battery but instead we used 2 Lithium Ion cell and one rechargeable circuit to charge these cells, but for simple explanation of the project 9v battery can be used. We used On and Off simple switch to power On and Off the circuit and at the front of the stick we placed our Buzzer, Arduino and Ultrasonic Sensor. You can build the hardware the way you like but the circuit remains same.      Software // defines pins numbersconst int trigPin = 9;const int echoPin = 10;const int buzzer = 11;const int ledPin = 13; // defines variableslong duration;int distance;int safetyDistance;  void setup() {pinMode(trigPin, OUTPUT); // Sets the trigPin as an OutputpinMode(echoPin, INPUT); // Sets the echoPin as an InputpinMode(buzzer, OUTPUT);pinMode(ledPin, OUTPUT);Serial.begin(9600); // Starts the serial communication}  void loop() {// Clears the trigPindigitalWrite(trigPin, LOW);delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro secondsdigitalWrite(trigPin, HIGH);delayMicroseconds(10);digitalWrite(trigPin, LOW); // Reads the echoPin, returns the sound wave travel time in microsecondsduration = pulseIn(echoPin, HIGH); // Calculating the distancedistance= duration*0.034/2; safetyDistance = distance;if (safetyDistance <= 5){  digitalWrite(buzzer, HIGH);  digitalWrite(ledPin, HIGH);}else{  digitalWrite(buzzer, LOW);  digitalWrite(ledPin, LOW);} // Prints the distance on the Serial MonitorSerial.print("Distance: ");Serial.println(distance);}   Conclusion Smart Walking Stick is very useful especially for blind people who want to go out for a walk. It helps them to walk smoothly  Future Enhancement in the Project We can add GPS in order to pinpoint the exact location of the personAlso we can add Voice recognition system which can tell where we are going and if any obstacle comes in our way it will let us know
Kynix On 2023-03-21   287
Sensor

How to Wire Ultrasonic Sensor-HC-SR04-with Raspberry Pi3?

Ⅰ Introduction In this project, we will use hardware ultrasonic sensor and  Raspberry Pi 3, Software Python code. Not everyone is familiar with ultrasonic sensor and Raspberry Pi3. Therefore, in the front part ,we will introduce some basic knowledge about ultrasonic sensor and Raspberry Pi3. This is conducive to understanding the project better. And then, we will have a look at the project of wiring Ultrasonic Sensor  (HC-SR04) with Raspberry Pi3 Catalog Ⅰ Introduction Ⅱ Ultrasonic Sensor Related Video Ⅲ Basic Guide to Ultrasonic Sensor  3.1 What is an ultrasonic sensor? 3.2 How Ultrasonic Sensors Work? 3.3 Using Multiple Sensors & Avoiding Disruption 3.4 How are Ultrasonic Sensors Used? Ⅳ Basic Guide to Raspberry Pi3 4.1 What is  Raspberry Pi3? 4.2 What Is the Raspberry Pi3 Capable of? 4.3 How do I Get Started With the Raspberry Pi 3? 4.4 How Is the Raspberry Pi 3 Different From Its Predecessors? Ⅴ Ultrasonic Sensor (HC-SR04) + Raspberry Pi3 5.1 Hardware 5.2 Wire Setup 5.3  Breadboard  5.4 Software Ⅵ FAQ     Ⅱ Ultrasonic Sensor Related Video   Ultrasonic Sensor Video Description: Connecting the Ultrasonic Sensor( HC-SR04) to the Raspberry Pi to measure distance. Equipment you need One 1 kilo-Ohm resistor One 2 kilo-Ohm resistor 8 Female-Male Jumper Wire   Ⅲ Basic Guide to Ultrasonic Sensor  3.1 What is an ultrasonic sensor? An ultrasonic sensor is a device that uses ultrasonic sound waves  to determine the distance between two objects. An ultrasonic sensor employs a transducer to send and receive ultrasonic pulses that relay information about the proximity of an object. High-frequency sound waves  reflect off boundaries, resulting in distinct echo patterns. Fihure1: Ultrasonic Sensor   3.2 How Ultrasonic Sensors Work? Ultrasonic sensors  operate by emitting a sound wave at a frequency  that is above the range of human hearing. To receive and transmit an ultrasonic sound, the sensor's transducer functions as a microphone. Like many others, our ultrasonic sensors  use a single transducer to send a pulse and receive the echo. The sensor calculates the distance to a target by measuring the time elapsed between sending and receiving the ultrasonic pulse. Figure2:How Ultrasonic Sensors Work This module's operation is straightforward. It emits a 40kHz ultrasonic pulse that travels through the air and, if it encounters an obstacle or object, bounces back to the sensor. The distance can be calculated by multiplying the travel time by the speed of sound. Ultrasonic sensors  are an excellent solution for detecting clear objects. Because of target translucence, applications that use infrared sensors.  for example, struggle with this particular use case for liquid level measurement. Ultrasonic sensors  detect objects regardless of color, surface, or material for presence detection (unless the material is very soft like wool, as it would absorb sound.) Ultrasonic sensors  are a reliable choice for detecting transparent and other items where optical technologies may fail.   3.3 Using Multiple Sensors & Avoiding Disruption When putting multiple sensors  into an application, it's critical to connect them in a way that prevents crosstalk and other interference. To prevent the ultrasonic signals from your sensor from being disrupted, keep the face of the ultrasonic transducer clear of any obstructions. Common obstructions include: DirtSnowIceOther Condensation We recommend our Self Cleaning sensors  for this application. Our self-cleaning function is designed to run continuously for the self-cleaning feature to be active. They are intended specifically for applications requiring condensation resistance in high moisture environments. Please keep in mind that the Self Cleaning function is not intended to remove dirt from the transducer's surface. Its purpose is to clear the transducer's face of moisture so that it can operate normally.   3.4 How are Ultrasonic Sensors Used? Our ultrasonic distance, level, and proximity sensors  are frequently used in conjunction with microcontroller platforms such as Raspberry Pi,  ARM , PIC,  Arduino , Beagle Board, and others. Ultrasonic sensors send sound waves  toward a target and measure the time it takes for the reflected waves to return to the receiver to determine their distance. This sensor is an electronic device that transmits ultrasonic sound waves  to measure the distance to a target and then converts the reflected sound into an electrical signal. Our sensors are frequently used as proximity detectors. Ultrasonic sensors are also used in obstacle detection systems and in manufacturing. Our ShortRange sensors provide the option for closer range detection in situations where a sensor that ranges objects as close to 2cm is required. These are also designed with very low power requirements in mind, as well as environments requiring noise rejection.   Ⅳ Basic Guide to Raspberry Pi3 4.1 What is  Raspberry Pi3? The  Raspberry Pi 3 Model B is the most recent model of the $35 Raspberry Pi computer. The Pi isn't your typical machine; in its most basic form, it lacks a case and is simply a credit-card-sized electronic board, similar to those found inside a PC or laptop but much smaller.   4.2 What Is the Raspberry Pi3 Capable of? Surprisingly large. For starters, the Pi 3 can be used as a low-cost desktop, media center, retro gaming console, or router, as shown below. That, however, is only the tip of the iceberg. There are hundreds of projects where people have used the Raspberry Pi to build tablets, laptops, phones, robots, smart mirrors, take pictures on the edge of space, and run experiments on the International Space Station.   Figure3:The Raspberry Pi 3.   4.3 How do I Get Started With the Raspberry Pi 3? One thing to keep in mind is that the Pi is merely a bare board. You'll also need a power supply, a monitor or TV,  HDMI  cables to connect to the monitor, and a mouse and keyboard. After connecting all of the cables, the simplest way for new users to get up and running on the Pi is to download the NOOBS (New Out-Of-Box Software) installer. Once the download is complete, follow the instructions to learn how to install an operating system on the Raspberry Pi. The installer makes it simple to install various operating systems, though the official OS Raspbian is a good choice for first-time users—other operating systems are listed below. Raspbian's appearance and feel should be familiar to any desktop computer user. The operating system, which is constantly being updated, recently received a graphical makeover and now includes an optimized web browser, an office suite, programming tools, educational games, and other software.   4.4 How Is the Raspberry Pi 3 Different From Its Predecessors? The Raspberry Pi 3 quad-core processor is both faster and more capable than its predecessor, the Raspberry Pi 2. For those interested in benchmarks, the Pi 3's CPU—the board's main processor—outperforms the Pi 2 by roughly 50-60% in 32-bit mode, and is 10x faster than the original single-core Raspberry Pi (based on a multi-threaded CPU benchmark in SysBench). Real-world applications will see performance increases ranging from 2.5x for single-threaded applications to more than 20x when video playback is accelerated by the chip's NEON engine when compared to the original Pi. Unlike its predecessor, the new board can play 1080p MP4 video at 60 frames per second (with a bitrate of around 5400Kbps), further enhancing the Pi's media center credentials. That's not to say that all videos will playback this smoothly; performance will vary depending on the source video, the player used, and the bitrate. With built-in Wi-Fi and Bluetooth, the Pi 3 also supports wireless internet right out of the box. The most recent board can also boot directly from a USB-attached hard drive or a pen drive, as well as from a network-attached file system via PXE, which is useful for remotely updating a Pi and sharing an operating system image between multiple machines.   Ⅴ Ultrasonic Sensor (HC-SR04) + Raspberry Pi3 A distance measurement is required or advantageous for many (outdoor) projects. These small modules, which start at 1-2 dollars and can measure distances of up to 4-5 meters using ultrasound, are surprisingly accurate. The connection and control are demonstrated in this tutorial. 5.1 Hardware Raspberry pi 3Ultrasonic Sensor(s) - HC-SR04A set of resistors for each sensor you are connecting330Ω and 470ΩJumper wires to connect the sensor(s) to the piBreadboard to connect the sensor(s) to the pi   5.2 Wire Setup Pins The sensor has four (labeled) pins that must be connected to the Raspberry Pi's pins. Pin 2 to VCC (5v - power)Pin 6 to GND (ground)Pin 12 receives a TRIG signal (GPIO18) The ECHO resistor 330 - Attach it to Pin 18 at one end (GPIO24) - Connect it to Pin6 as well, using a 470 resistor (ground). - This is done because GPIO pins can only withstand a maximum voltage of 3.3V.   5.3  Breadboard  As shown in the circuit diagram, connect the sensor to the pi using a breadboard. By replicating this exact setup on the other half of the breadboard, an additional sensor can be connected to the pi. Connect the VCC and GND pins together (2 and 6) For the TRIG and ECHO connections, use any two GPIO pins. Just make sure to include the correct GPIO pins in your code. Figure4: Connecting resistors and jumper wires between sensors and pi       5.4 Software Python Create a new script Figure5:Creating a new script in Python 3 Choose Menu → Programming → Click on Python 3 to create a new scriptWhen you run the code, the script below will print the distance of the object in front of the sensor.Because this code is easily manipulated to add another sensor, all variables have a "1" after them.Simply copy and paste each section of code, renaming variables with a "2."Make sure to connect a TRIG2 and an ECHO2 to the pi's two new GPIO Pins and to mirror the circuit diagram on the other half of the breadboard. import  RPi.GPIO  as GPIO import time GPIO.setmode(GPIO.BCM) TRIG1 = 18 ECHO1 = 24 #print ("Distance Measurement In Process") GPIO.setup(TRIG1, GPIO.OUT) GPIO.output(TRIG1, False) GPIO.setup(ECHO1, GPIO.IN) #print ("Waiting For Sensor1 To Settle") time.sleep(.1) GPIO.output(TRIG1, True) time.sleep(0.00001) GPIO.output(TRIG1, False) while GPIO.input(ECHO1) == 0:     pass     pulse_start1 = time.time() while GPIO.input(ECHO1) == 1:     pass     pulse_end1 = time.time() pulse_duration1 = pulse_end1 - pulse_start1 distance1 = pulse_duration1 * 17150 distance1= round(distance1, 2) print ("Distance1:",distance1, "cm") time.sleep(10) GPIO.cleanup()   Make a copy of your script and save it as ultrasonic distance.py. Go to File and click on Save as In the Save in field, navigate to the C: drive and then select a folder to save in. In the File name field, enter ultrasonic distance.py. Select All Files in the Save as type field. Click the Save button. To run the script, use the terminal. Clicking on the monitor icon at the top of the screen will launch the terminal. Enter cd "folder name" to change directory to your pythonpractice folder, then enter ultrasonic distance.py to run your program. Ⅵ FAQ 1. Does HC-SR04 need resistor? If you are using the ultrasonic transmitter from a HC-SR04 , I think you will find it needs between 5 and 12V to drive it. So you don't need a resistor you actually need a transistor circuit to provide the greater voltage under the control of the gpio. 2. What is the range of HC SR04? 2 cm to 400 cm The HC-SR04 ultrasonic sensor uses SONAR to determine the distance of an object just like the bats do. It offers excellent non-contact range detection with high accuracy and stable readings in an easy-to-use package from 2 cm to 400 cm or 1” to 13 feet. 3. Is ultrasonic sensor digital or analog? The output of the Ultrasonic Sensor is digital. Two of the four pins are forsupplying power to it, one is for sending an echo signature to it, and the other is for getting output from it. 4. What is ultrasonic sensor HC-SR04? The HC-SR04 Ultrasonic Distance Sensor is a sensor used for detecting the distance to an object using sonar. ... The HC-SR04 uses non-contact ultrasound sonar to measure the distance to an object, and consists of two ultrasonic transmitters (basically speakers), a receiver, and a control circuit. 5. What are the types of ultrasonic sensor? All together there are four types of ultrasonic sensors, classified by frequency and shape: the drip-proof type, high-frequency type, and open structure type (lead type and SMD type). 6. Is HC SR04 analog or digital? One of them is digital and the other is analog. We choose to use two sensors that measure: The UltraSonic Sensor (HC-SR04): Digital Sensor.
kynix On 2022-01-06   1732

Kynix

Kynix was founded in 2008, specializing in the electronic components distribution business. We adhere to honesty and ethics as our business philosophy and have gradually established an excellent reputation and credibility in our international business. With the accurate quotation, excellent credit, reasonable price, reliable quality, fast delivery, and authentic service, we have won the praise of the majority of customers.

Follow us

Join our mailing list!

Be the first to know about new products, special offers, and more.

Kynix

  • How to purchase

  • Order
  • Search & Inquiry
  • Shipping & Tracking
  • Payment Methods
  • Contact Us

  • Tel: 00852-6915 1330
  • Email: info@kynix.com
  • Follow Us

authentication

Kynix

© 2008-2026 kynix.com all rights reserve.