Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use Ultrasonic Distance Sensor: Examples, Pinouts, and Specs

Image of Ultrasonic Distance Sensor
Cirkit Designer LogoDesign with Ultrasonic Distance Sensor in Cirkit Designer

Introduction

The Adafruit US-100 Ultrasonic Distance Sensor is a versatile and reliable device designed to measure distances using ultrasonic waves. It emits a sound wave at a frequency beyond human hearing and calculates the distance to an object based on the time it takes for the echo to return. This sensor is widely used in robotics, automation, and IoT applications due to its accuracy, ease of use, and compatibility with microcontrollers like Arduino.

Explore Projects Built with Ultrasonic Distance Sensor

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Arduino UNO with HC-SR04 Ultrasonic Sensor and Buzzer Alert System
Image of ultrasonic: A project utilizing Ultrasonic Distance Sensor in a practical application
This circuit consists of an HC-SR04 Ultrasonic Distance Sensor interfaced with an Arduino UNO for measuring distances. The Arduino is programmed to trigger the sensor and read the echo signal to determine the distance to an object. A buzzer is also connected to the Arduino and can be used to provide audible feedback based on the distance measurements.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO-Based Ultrasonic Distance Sensor with OLED Display and SIM900A Communication
Image of SENSOR: A project utilizing Ultrasonic Distance Sensor in a practical application
This circuit is a distance measurement and communication system using an Arduino UNO, an ultrasonic sensor, an OLED display, and a SIM900A module. The ultrasonic sensor measures the distance to an object, which is then displayed on the OLED screen and transmitted via the SIM900A module. The system is powered by a 18650 Li-ion battery.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino Nano and NRF24L01 Based Ultrasonic Distance Measurement System
Image of transmitter_circuit: A project utilizing Ultrasonic Distance Sensor in a practical application
This circuit is designed to measure distances using an HC-SR04 Ultrasonic Sensor and transmit the measured data wirelessly via an NRF24L01 module. An Arduino Nano serves as the central controller, interfacing with the ultrasonic sensor to trigger distance measurements and with the NRF24L01 to send the results to a remote receiver. The code provided for the Arduino Nano manages the measurement process, calculates the distance, and handles the wireless communication.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO Based Ultrasonic Distance Sensor with Buzzer Alert
Image of Copy of shoe: A project utilizing Ultrasonic Distance Sensor in a practical application
This circuit functions as an ultrasonic distance detector with an audible alert. The HC-SR04 Ultrasonic Sensor is interfaced with an Arduino UNO to measure the distance to objects, and a buzzer is triggered to sound an alert when the object is within a predefined proximity.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with Ultrasonic Distance Sensor

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of ultrasonic: A project utilizing Ultrasonic Distance Sensor in a practical application
Arduino UNO with HC-SR04 Ultrasonic Sensor and Buzzer Alert System
This circuit consists of an HC-SR04 Ultrasonic Distance Sensor interfaced with an Arduino UNO for measuring distances. The Arduino is programmed to trigger the sensor and read the echo signal to determine the distance to an object. A buzzer is also connected to the Arduino and can be used to provide audible feedback based on the distance measurements.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of SENSOR: A project utilizing Ultrasonic Distance Sensor in a practical application
Arduino UNO-Based Ultrasonic Distance Sensor with OLED Display and SIM900A Communication
This circuit is a distance measurement and communication system using an Arduino UNO, an ultrasonic sensor, an OLED display, and a SIM900A module. The ultrasonic sensor measures the distance to an object, which is then displayed on the OLED screen and transmitted via the SIM900A module. The system is powered by a 18650 Li-ion battery.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of transmitter_circuit: A project utilizing Ultrasonic Distance Sensor in a practical application
Arduino Nano and NRF24L01 Based Ultrasonic Distance Measurement System
This circuit is designed to measure distances using an HC-SR04 Ultrasonic Sensor and transmit the measured data wirelessly via an NRF24L01 module. An Arduino Nano serves as the central controller, interfacing with the ultrasonic sensor to trigger distance measurements and with the NRF24L01 to send the results to a remote receiver. The code provided for the Arduino Nano manages the measurement process, calculates the distance, and handles the wireless communication.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Copy of shoe: A project utilizing Ultrasonic Distance Sensor in a practical application
Arduino UNO Based Ultrasonic Distance Sensor with Buzzer Alert
This circuit functions as an ultrasonic distance detector with an audible alert. The HC-SR04 Ultrasonic Sensor is interfaced with an Arduino UNO to measure the distance to objects, and a buzzer is triggered to sound an alert when the object is within a predefined proximity.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Obstacle detection in robotics
  • Distance measurement in automation systems
  • Liquid level sensing in tanks
  • Proximity detection in security systems
  • Smart parking systems

Technical Specifications

The following table outlines the key technical details of the Adafruit US-100 Ultrasonic Distance Sensor:

Parameter Specification
Operating Voltage 2.4V to 5.5V
Operating Current ~2mA
Measuring Range 2cm to 450cm
Accuracy ±0.3cm
Output Modes Serial (UART) or PWM
Operating Temperature -20°C to 70°C
Dimensions 45mm x 20mm x 15mm

Pin Configuration and Descriptions

The US-100 sensor has a 4-pin interface. The pinout is as follows:

Pin Name Description
1 VCC Power supply input (2.4V to 5.5V). Connect to the 5V pin of your microcontroller.
2 Trig/TX Trigger pin for PWM mode or TX pin for UART mode.
3 Echo/RX Echo pin for PWM mode or RX pin for UART mode.
4 GND Ground. Connect to the GND pin of your microcontroller.

Usage Instructions

Using the US-100 in a Circuit

  1. Power the Sensor: Connect the VCC pin to a 5V power source and the GND pin to ground.
  2. Select Output Mode:
    • For PWM mode, use the Trig and Echo pins to send and receive ultrasonic signals.
    • For UART mode, connect the TX and RX pins to the corresponding UART pins on your microcontroller.
  3. Connect to a Microcontroller: For example, when using an Arduino UNO:
    • Connect the Trig pin to a digital output pin (e.g., D9).
    • Connect the Echo pin to a digital input pin (e.g., D10).

Important Considerations and Best Practices

  • Ensure the sensor is mounted securely and is not obstructed by nearby objects.
  • Avoid placing the sensor in environments with excessive noise or vibrations, as this may affect accuracy.
  • Use a resistor divider or level shifter if interfacing with a 3.3V microcontroller to avoid damaging the sensor.

Example Code for Arduino UNO (PWM Mode)

// Example code for using the Adafruit US-100 Ultrasonic Distance Sensor in PWM mode
// with an Arduino UNO. This code measures the distance to an object and prints it
// to the Serial Monitor.

#define TRIG_PIN 9  // Define the pin connected to the Trig pin of the sensor
#define ECHO_PIN 10 // Define the pin connected to the Echo pin of the sensor

void setup() {
  pinMode(TRIG_PIN, OUTPUT); // Set the Trig pin as an output
  pinMode(ECHO_PIN, INPUT);  // Set the Echo pin as an input
  Serial.begin(9600);        // Initialize serial communication at 9600 baud
}

void loop() {
  // Send a 10-microsecond pulse to the Trig pin to trigger the sensor
  digitalWrite(TRIG_PIN, LOW);
  delayMicroseconds(2);
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);

  // Measure the duration of the pulse on the Echo pin
  long duration = pulseIn(ECHO_PIN, HIGH);

  // Calculate the distance in centimeters
  float distance = (duration / 2.0) * 0.0343;

  // Print the distance to the Serial Monitor
  Serial.print("Distance: ");
  Serial.print(distance);
  Serial.println(" cm");

  delay(500); // Wait for 500ms before taking the next measurement
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. No Output or Incorrect Readings:

    • Ensure the sensor is powered correctly (2.4V to 5.5V).
    • Verify the connections to the microcontroller are secure and match the pin configuration.
    • Check for obstacles or interference in the sensor's field of view.
  2. Inconsistent Measurements:

    • Ensure the sensor is mounted on a stable surface to minimize vibrations.
    • Avoid using the sensor in environments with high humidity or extreme temperatures.
  3. Sensor Not Responding in UART Mode:

    • Verify the baud rate is set to 9600 in your microcontroller's code.
    • Ensure the TX and RX pins are connected correctly.

FAQs

Q: Can the US-100 measure distances below 2cm?
A: No, the minimum measurable distance is 2cm. Objects closer than this may not be detected accurately.

Q: How do I switch between PWM and UART modes?
A: The US-100 defaults to PWM mode. To use UART mode, send a specific command via the TX pin. Refer to the manufacturer's datasheet for details.

Q: Can I use the US-100 with a 3.3V microcontroller?
A: Yes, but you should use a level shifter or resistor divider to ensure the sensor's 5V signals are compatible with the 3.3V logic levels of your microcontroller.