Beijing Ultrasonic

  • Products
  • Contact Us
  • No products in cart.
  • EnglishEnglish
    • Español Español
    • Français Français
    • Deutsch Deutsch
    • Italiano Italiano
    • Português Português
    • Українська Українська
    • Русский Русский
    • Türkçe Türkçe
    • Polski Polski
    • Nederlands Nederlands
    • Čeština Čeština
    • Svenska Svenska
    • עברית עברית
    • العربية العربية
    • فارسی فارسی
    • 简体中文 简体中文
    • 日本語 日本語
    • 한국어 한국어
    • हिन्दी हिन्दी
    • Melayu Melayu
    • Indonesia Indonesia
    • Tiếng Việt Tiếng Việt
  • Home
  • Blog
  • Ultrasonic Technology
  • How to make ultrasonic sensor

How to make ultrasonic sensor

by Jessie Wong / Saturday, 22 April 2023 / Published in Ultrasonic Technology

Ultrasonic sensors are widely used in various applications, from robotics to industrial automation, due to their ability to measure distances accurately by using sound waves. Unlike traditional sensors, ultrasonic sensors operate by emitting high-frequency sound waves and measuring the time it takes for the sound to reflect back. Building your own ultrasonic sensor can be both educational and cost-effective. This article outlines a detailed guide to creating an ultrasonic sensor from scratch.

1. Understanding the Core Components of an Ultrasonic Sensor

To build an ultrasonic sensor, understanding its essential components is crucial. Typically, an ultrasonic sensor is composed of the following:

  • Transmitter: Emits high-frequency sound waves, usually in the ultrasonic range (above 20 kHz).
  • Receiver: Captures the reflected sound waves after they bounce off an object.
  • Microcontroller: Processes the signals and calculates distances based on the time it takes for sound waves to return. A microcontroller like Arduino can be an excellent choice for this purpose.
  • Amplifier Circuit: Enhances the signal for more accurate detection.
  • Power Supply: Provides energy to drive the sensor and associated circuitry.
  • PCB (Printed Circuit Board): Serves as the foundation to connect all components properly.

2. Materials and Tools Required

Before starting the assembly, gather the necessary materials and tools. Below is a list to ensure you have everything on hand:

Component/Tool Specifications/Examples
Ultrasonic Transducer 40 kHz transmitter and receiver pair
Microcontroller Arduino Uno, Nano, or equivalent
Resistors 220 Ω, 1 kΩ, 10 kΩ
Capacitors 10 µF, 100 µF
Op-amp IC LM358 or similar
Crystal Oscillator 16 MHz
Jumper Wires Standard male-to-male and female-to-male wires
Breadboard Medium-sized
Soldering Kit Soldering iron, flux, and solder wire
Power Supply 5V DC

3. Circuit Design and Configuration

The circuit design is the heart of your ultrasonic sensor, as it dictates the efficiency and accuracy of sound wave transmission and reception.

Step 1: Transmitter Circuit

The transmitter generates ultrasonic sound waves. Using the crystal oscillator in combination with an op-amp (e.g., LM358), you can create a 40 kHz square wave signal. Connect the transmitter transducer to the output of this oscillator circuit.

Step 2: Receiver Circuit

The receiver captures the reflected waves and converts them into an electrical signal. An amplifier circuit is needed to boost the weak signals before they are processed by the microcontroller. Use the LM358 IC to build a simple amplification circuit. Connect the receiver transducer to the input of the amplifier.

Step 3: Microcontroller Connection

The microcontroller acts as the brain of your setup. Use the Arduino’s GPIO pins to send the trigger signal to the transmitter and read the echo signal from the receiver. The Arduino will calculate the distance based on the time delay between the transmitted and received signals.

Here’s an example of how the ultrasonic sensor connects to the Arduino:

Arduino Pin Connection
Pin 7 (Trigger) Transmitter control input
Pin 6 (Echo) Amplifier output (Receiver)
GND Ground (0V)
5V Power supply for circuits

4. Writing the Microcontroller Code

The microcontroller code is responsible for calculating the distance based on the sound wave travel time. Below is an example of Arduino code:

#define TRIG_PIN 7
#define ECHO_PIN 6

void setup() {
  pinMode(TRIG_PIN, OUTPUT);
  pinMode(ECHO_PIN, INPUT);
  Serial.begin(9600); 
}

void loop() {
  digitalWrite(TRIG_PIN, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);

  long duration = pulseIn(ECHO_PIN, HIGH);
  float distance = (duration / 2.0) * 0.0343;

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

  delay(500);
}

This code sends a short pulse from the transmitter, measures the duration of the returning echo, and calculates the distance using the speed of sound (343 m/s).

5. Assembling the Components

Once the circuit is designed and the code is ready, it’s time to assemble everything:

  1. Place the components on a breadboard for prototyping.
  2. Connect the transmitter and receiver to the respective circuits.
  3. Link the amplifier output to the microcontroller’s input pin.
  4. Upload the Arduino code to the microcontroller.
  5. Power up the circuit and test the sensor functionality.

6. Testing and Calibration

After assembling the ultrasonic sensor, testing and calibration are critical to ensure accuracy:

  • Initial Testing: Place an object at a known distance and verify the output on the serial monitor.
  • Calibration: Adjust the amplifier gain and oscillator frequency for optimal performance.
  • Troubleshooting: If the sensor doesn’t work as expected, check for loose connections or faulty components.

7. Enclosure and Final Assembly

For durability and practical usage, consider housing the sensor in a protective enclosure. Use materials like plastic or aluminum to shield the electronics while allowing sound waves to pass through. For professional-grade sensors, brands like Beijing Ultrasonic offer inspiration with their high-quality designs and rugged enclosures.

Building an ultrasonic sensor from scratch provides valuable insights into the principles of sound wave propagation and electronics. By following the steps outlined above, you can create a functional sensor capable of measuring distances with precision. While your DIY sensor may not rival commercial options from companies like Beijing Ultrasonic in terms of durability or advanced features, it serves as an excellent learning tool and can be customized to meet specific project requirements. With continued experimentation and refinement, you can enhance the performance and versatility of your ultrasonic sensor.

What you can read next

Why is my H2O humidifier not working
DIY greenhouse humidifier
Electrosonic Cleaning
How to Use Ultrasonic Cleaners for Electrosonic Cleaning

Product categories

  • Piezoceramics
    • Piezoceramic Ball/Hemisphere
    • Piezoceramic Cylinder
    • Piezoceramic Discs
    • Piezoceramic Rings
    • Piezoceramic Square/Rectangular
    • Piezoceramic Tube
  • Ultrasonic Cleaner
    • 120kHz Digital Ultrasonic Cleaner
    • 40kHz Digital Ultrasonic Cleaner
    • 80kHz Digital Ultrasonic Cleaner
    • Dual Frequency Digital Ultrasonic Cleaner
    • Immersible Ultrasonic Transducer
    • Industrial Ultrasonic Cleaner
    • Mechanical Ultrasonic Cleaner
    • Power Adjustable Digital Ultrasonic Cleaner
  • Ultrasonic Generator
    • [100-120V] Ultrasonic Transducer Driver Circuit & Transducer Bundles
    • [100-120V/200-240V] Ultrasonic Transducer Driver Circuit & Transducer Bundles
    • [200-240V] Ultrasonic Transducer Driver Circuit & Transducer Bundles
    • Digital Ultrasonic Generator
    • Digital Ultrasonic Transducer Driver Circuit & Transducer Bundles
    • Ultrasonic Transducer Driver Circuit
  • Ultrasonic Humidifier
  • Ultrasonic Meter
  • Ultrasonic Processor
    • Ultrasonic Biodiesel Reactor
    • Ultrasonic Homogenizer
  • Ultrasonic Transducer
  • Ultrasonic Welder

Recent Posts

  • 2L Mechanical Ultrasonic Cleaner Time Temperature-05

    A Comprehensive Guide to Wholesale Ultrasonic Cleaners

    Ultrasonic cleaning technology has revolutioniz...
  • The Benefits of Combining Disruption and Homogenization in a Single Instrument

    Combining disruption and homogenization capabil...
  • Ensuring Cleanroom Compatibility: Ultrasonic Welding in Electronics Manufacturing

    The electronics industry demands manufacturing ...
  • Ultrasonic Welding: A Boon for Innovation in Consumer Goods

    Ultrasonic welding has emerged as a pivotal tec...
  • 5000ML Fog Water Fountain Ultrasonic Cool Mist Humidifier (2)

    The Science of Moisture: How Ultrasonic Humidifiers Add Humidity to Your Air

    Ultrasonic humidifiers have become a popular ch...
  • Beyond Heat and Glue: The Science Behind Ultrasonic Bonds

    The realm of manufacturing and assembly is cons...
  • Ultrasonic Sensors

    From Bumpers to Brakes: Piezoceramic Sensors in Automotive Applications

    Piezoceramic sensors have become indispensable ...
  • From Tough Tissues to Delicate Cells: The Power of Ultrasonic Homogenization for Diverse Samples

    Ultrasonic homogenization, a technique employin...
  • Ultrasonic Cell Disruptor Homogenizer Transducer (4)

    Streamlining Workflows in Microbiology: Ultrasonic Homogenization for Faster Sample Prep

    In the fast-paced world of microbiology, effici...
  • The Future of Sound: How Ultrasonic Generators are Shaping Diverse Industries

    The world of sound extends far beyond what the ...

Customer Care

  • My Account
  • About Us
  • Return Policy
  • Privacy Policy
  • Terms & Conditions
  • Resource Center
  • Blog & News
  • China Public Holiday
  • Sitemap

Technical Info

  • Ultrasonic Cleaner Overview
  • Ultrasonic Cleaner FAQs
  • Ultrasonic Generator Overview
  • Ultrasonic Generator FAQs
  • Ultrasonic Transducer Overview
  • Ultrasonic Transducer FAQs
  • Piezoceramics Overview
  • Piezoceramic FAQs

Product Catalog

Beijing-Ultrasonic-Product-Catalog

Secure Payment

Buy now with PayPal
  • GET SOCIAL

© 2011 - 2026 Beijing Ultrasonic. All Rights Reserved.

TOP