The JSN-SR20-Y1 is an ultrasonic distance sensor manufactured by JSN. It operates by emitting ultrasonic sound waves and measuring the time it takes for the sound waves to bounce back after hitting an object. This sensor is capable of measuring distances ranging from 20 cm to 600 cm with high accuracy, making it ideal for applications such as:
Robotics and automation
Obstacle detection in autonomous vehicles
Distance measurement in industrial systems
Smart parking systems
Liquid level detection
Its robust design and waterproof casing make it suitable for both indoor and outdoor environments.
Explore Projects Built with JSN-SR20-Y1
Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
This circuit is a sensor-based data acquisition system using an Arduino Nano, which collects data from a GSR sensor, an ADXL377 accelerometer, and a Neo 6M GPS module. The collected data is then transmitted via a WiFi module (ESP8266-01) for remote monitoring. The system is powered by a 12V battery, which is charged by a solar panel.
This circuit is a sensor and motor control system powered by a 9V battery and regulated by a buck converter. It includes multiple sensors (SEN0245, SEN0427, I2C BMI160) connected via I2C to an ESP32 microcontroller, which also controls two N20 motors with encoders through an MX1508 DC motor driver.
This is a sensor-based data acquisition system with GSM communication capability. It uses an ESP8266 NodeMCU to collect environmental data from a DHT22 sensor and light levels from an LDR, as well as distance measurements from an HC-SR04 ultrasonic sensor. The SIM900A GSM module enables the system to transmit the collected data over a cellular network.
This is a motor control system with wireless communication capabilities, designed to operate multiple motors via Cytron motor drivers, controlled by Arduino UNOs. It includes relays for activating a light and buzzer, and uses Bluetooth for remote operation. The system's software is in the initial stages of development.
The JSN-SR20-Y1 has a 4-pin interface for easy integration into circuits. The pinout is as follows:
Pin Name
Pin Number
Description
VCC
1
Power supply input (5V DC)
TRIG
2
Trigger pin: Sends an ultrasonic pulse
ECHO
3
Echo pin: Receives the reflected ultrasonic pulse
GND
4
Ground connection
Usage Instructions
How to Use the JSN-SR20-Y1 in a Circuit
Power the Sensor: Connect the VCC pin to a 5V DC power source and the GND pin to ground.
Trigger the Sensor: Send a 10 µs HIGH pulse to the TRIG pin to initiate a measurement.
Read the Echo: Measure the duration of the HIGH signal on the ECHO pin. This duration corresponds to the time taken for the ultrasonic pulse to travel to the object and back.
Calculate Distance: Use the formula below to calculate the distance:
[
\text{Distance (cm)} = \frac{\text{Time (µs)} \times 0.034}{2}
]
The factor 0.034 accounts for the speed of sound in air (340 m/s).
Important Considerations and Best Practices
Ensure the sensor is mounted securely and aligned properly for accurate measurements.
Avoid placing the sensor near sources of ultrasonic noise or vibrations.
Use a capacitor (e.g., 10 µF) across the power supply pins to reduce noise.
For outdoor use, ensure the sensor is protected from extreme environmental conditions despite its waterproof design.
Example Code for Arduino UNO
Below is an example of how to use the JSN-SR20-Y1 with an Arduino UNO:
// Define pins for the JSN-SR20-Y1 sensor
const int trigPin = 9; // TRIG pin connected to digital pin 9
const int echoPin = 10; // ECHO pin connected to digital pin 10
void setup() {
pinMode(trigPin, OUTPUT); // Set TRIG pin as output
pinMode(echoPin, INPUT); // Set ECHO pin as input
Serial.begin(9600); // Initialize serial communication
}
void loop() {
// Send a 10 µs HIGH pulse to the TRIG pin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Measure the duration of the HIGH signal on the ECHO pin
long duration = pulseIn(echoPin, HIGH);
// Calculate the distance in cm
float distance = (duration * 0.034) / 2;
// Print the distance to the Serial Monitor
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(500); // Wait for 500 ms before the next measurement
}
Troubleshooting and FAQs
Common Issues and Solutions
No Output or Incorrect Readings
Cause: Improper wiring or loose connections.
Solution: Double-check all connections, ensuring the VCC and GND pins are properly connected.
Fluctuating Distance Measurements
Cause: Electrical noise or interference.
Solution: Add a decoupling capacitor (e.g., 10 µF) across the power supply pins to stabilize the voltage.
Sensor Not Detecting Objects
Cause: Object is outside the sensor's range or has a poor reflective surface.
Solution: Ensure the object is within the 20 cm to 600 cm range and has a surface that reflects sound waves effectively.
Sensor Fails in Outdoor Conditions
Cause: Extreme environmental conditions or water ingress.
Solution: Verify the sensor's waterproof casing is intact and avoid exposing it to temperatures beyond its operating range.
FAQs
Q1: Can the JSN-SR20-Y1 measure distances below 20 cm?
A1: No, the sensor's minimum range is 20 cm. Objects closer than this may result in inaccurate readings.
Q2: Is the sensor compatible with 3.3V microcontrollers?
A2: The JSN-SR20-Y1 requires a 5V power supply. However, logic level shifters can be used to interface it with 3.3V microcontrollers.
Q3: Can the sensor detect transparent objects?
A3: Ultrasonic sensors may struggle with transparent or very thin objects as they do not reflect sound waves effectively.
Q4: How can I improve measurement accuracy?
A4: Use the sensor in a stable environment, avoid obstacles in the ultrasonic path, and ensure proper alignment.
This concludes the documentation for the JSN-SR20-Y1 ultrasonic distance sensor.