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

How to Use ULTRASONIC RANGING: Examples, Pinouts, and Specs

Image of ULTRASONIC RANGING
Cirkit Designer LogoDesign with ULTRASONIC RANGING in Cirkit Designer

Introduction

The JSN-SR04M-2 is an ultrasonic ranging module manufactured by SUNLEPHANT. This component is designed to measure distances by emitting ultrasonic waves and detecting the time it takes for the echoes to return. It is widely used in robotics, obstacle avoidance systems, distance measurement applications, and various automation projects.

Explore Projects Built with ULTRASONIC RANGING

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 Based Ultrasonic Radar System with Servo Motor
Image of ultrasonic radar: A project utilizing ULTRASONIC RANGING in a practical application
This circuit is designed to function as an ultrasonic radar system, utilizing an Arduino UNO microcontroller, an HC-SR04 ultrasonic sensor, and an SG90 servo motor. The Arduino controls the servo to sweep the ultrasonic sensor through a range of angles, while the sensor measures the distance to any objects in its path. The system outputs the angle and distance measurements to the serial monitor and provides an indication when an obstacle is detected within 20 cm.
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 RANGING 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 RANGING 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 Mega 2560 Bluetooth-Controlled Ultrasonic Distance Measurement
Image of circuitcycle: A project utilizing ULTRASONIC RANGING in a practical application
This circuit features an Arduino Mega 2560 microcontroller interfaced with an HC-05 Bluetooth Module and an HC-SR04 Ultrasonic Sensor. The HC-05 is powered by the Arduino's VIN pin and is grounded to the Arduino's GND, enabling wireless communication capabilities. The HC-SR04 is powered by the Arduino's 5V output and uses two digital PWM pins (D7 for TRIG and D6 for ECHO) to measure distances via ultrasonic waves.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with ULTRASONIC RANGING

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 radar: A project utilizing ULTRASONIC RANGING in a practical application
Arduino UNO Based Ultrasonic Radar System with Servo Motor
This circuit is designed to function as an ultrasonic radar system, utilizing an Arduino UNO microcontroller, an HC-SR04 ultrasonic sensor, and an SG90 servo motor. The Arduino controls the servo to sweep the ultrasonic sensor through a range of angles, while the sensor measures the distance to any objects in its path. The system outputs the angle and distance measurements to the serial monitor and provides an indication when an obstacle is detected within 20 cm.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of SENSOR: A project utilizing ULTRASONIC RANGING 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 RANGING 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 circuitcycle: A project utilizing ULTRASONIC RANGING in a practical application
Arduino Mega 2560 Bluetooth-Controlled Ultrasonic Distance Measurement
This circuit features an Arduino Mega 2560 microcontroller interfaced with an HC-05 Bluetooth Module and an HC-SR04 Ultrasonic Sensor. The HC-05 is powered by the Arduino's VIN pin and is grounded to the Arduino's GND, enabling wireless communication capabilities. The HC-SR04 is powered by the Arduino's 5V output and uses two digital PWM pins (D7 for TRIG and D6 for ECHO) to measure distances via ultrasonic waves.
Cirkit Designer LogoOpen Project in Cirkit Designer

Common Applications and Use Cases

  • Robotics for object detection and avoidance
  • Measuring distances in industrial environments
  • Parking sensors for vehicles
  • Level control in tanks or silos
  • DIY projects involving distance measurement or proximity sensing

Technical Specifications

Key Technical Details

  • Operating Voltage: 3.3V to 5V DC
  • Quiescent Current: <2mA
  • Operating Current: 15mA
  • Acoustic Emission Frequency: 40kHz
  • Max Range: 4.5m
  • Min Range: 25cm
  • Resolution: 0.3cm
  • Measuring Angle: 75 degrees
  • Operating Temperature: -20°C to +70°C

Pin Configuration and Descriptions

Pin Number Pin Name Description
1 VCC Power supply (3.3V to 5V DC)
2 Trig Trigger input (TTL pulse)
3 Echo Echo output (TTL level signal)
4 GND Ground

Usage Instructions

How to Use the Component in a Circuit

  1. Connect the VCC pin to a 3.3V or 5V power supply.
  2. Connect the GND pin to the ground of the power supply.
  3. The Trig pin should be connected to a digital output pin on the microcontroller.
  4. The Echo pin should be connected to a digital input pin on the microcontroller.

Important Considerations and Best Practices

  • Ensure that the power supply is stable and within the specified voltage range.
  • Avoid physical obstructions in front of the sensor within the minimum range.
  • Use a pull-up resistor if necessary on the Echo pin to ensure proper logic level reading.
  • Keep the module away from noisy electrical environments to prevent false readings.

Example Code for Arduino UNO

// Define the connection pins
const int trigPin = 9;
const int echoPin = 10;

void setup() {
  // Initialize serial communication
  Serial.begin(9600);
  // Define pin modes
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
}

void loop() {
  // Clear the trigPin by setting it LOW
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);

  // Set the trigPin HIGH for 10 microseconds to send the ultrasonic pulse
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  // Read the echoPin; pulseIn returns the duration in microseconds
  long duration = pulseIn(echoPin, HIGH);

  // Calculate the distance in centimeters
  long distance = duration * 0.034 / 2;

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

  // Delay between measurements
  delay(500);
}

Troubleshooting and FAQs

Common Issues Users Might Face

  • Inaccurate Readings: Ensure there are no obstacles or sound-absorbing materials in front of the sensor that could affect the readings.
  • No Readings: Check the power supply and wiring connections. Ensure the Trig and Echo pins are connected correctly.
  • Intermittent Readings: This could be due to electrical noise. Try adding a capacitor across the power supply pins close to the module.

Solutions and Tips for Troubleshooting

  • Always test the module in a controlled environment before deploying it in the field.
  • Use twisted pair cables for Trig and Echo pins to reduce susceptibility to electrical noise.
  • If the module is being used outdoors, protect it from the elements, such as water or dust.

FAQs

Q: Can the JSN-SR04M-2 be used to detect non-solid objects, like liquids? A: The module is designed for solid objects. It may not give reliable readings for liquids due to their varying density and surface reflectivity.

Q: What is the maximum distance the JSN-SR04M-2 can measure? A: The maximum range is 4.5 meters under ideal conditions.

Q: Is it possible to use multiple JSN-SR04M-2 modules in one project? A: Yes, but ensure that the ultrasonic signals from one module do not interfere with another by staggering the trigger signals.

Q: How can I extend the range of the module? A: The range cannot be extended beyond the specified maximum range. However, ensuring a clear path and minimal interference can help achieve the best possible range within the specified limits.