K2 is an ultrasonic ranging sensor that is waterproof this sensor can be operated in 2 modes, mode 1 is a pulsed mode in this mode it will work like most of the ultrasonic sensors on offer for Arduino projects. In mode 2 it is in a serial mode and you can
AED 34.50
1
Description
- The K02 sensor module is an ultrasonic ranging sensor designed to be waterproof, making it suitable for use in applications where it may be exposed to water or moisture. It features two operating modes, pulsed and serial, with the latter allowing for communication via UART and handling of timing complexities by the sensor module board.
- This sensor can be used to measure distances in a manner similar to other ultrasonic sensors for Arduino projects. It works by emitting ultrasound waves that bounce off objects and are detected by the sensor. By measuring the time it takes for the waves to travel to the object and back, the distance between the sensor and the object can be calculated.
- One of the main advantages of the K02 sensor is its waterproof design, which makes it suitable for use in applications such as water level measurement. Its ability to operate in both pulsed and serial modes also provides flexibility in how it can be used and integrated into projects.
Principle of work:
- The K02 waterproof ultrasonic distance measuring module works on the principle of ultrasonic ranging. It emits a high-frequency sound wave (40kHz) and then listens for the echo that bounces back off an object in front of it. The time it takes for the sound wave to travel to the object and back is measured, and this time is used to calculate the distance between the sensor and the object.
- The module has two main components, a trigger pin (IOTRIG) and an echo pin (IOECHO). When a high-level signal (at least 10us) is sent to the trigger pin, the module automatically sends out a 40kHz square wave and waits for a signal to return.
- If a signal is detected, the echo pin will output a high signal for a period of time that corresponds to the time it takes for the sound wave to travel to the object and back. This high period can be measured using a timer, and the time can be used to calculate the distance to the object using the formula: distance = (time * speed of sound (340m/s))/2.
- By continuously triggering the module and measuring the time it takes for the sound wave to travel, the K02 module can be used to achieve a moving value of distance measurements. This makes it suitable for a range of applications, such as water level measurement, object detection, and obstacle avoidance.
Features:
- Small size, easy to use
- Low voltage, low power consumption
- High measurement accuracy
- Strong anti-interference
- Integrated closed water with a line probe for wet, harsh measurement occasions
Specification:
- Operating Voltage: 5V
- Maximum Current: 30mA @ 5V
- Standby current: < 5mA @ 5V
- Low power consumption: <20uA
- Detection range: 20cm to 600cm
- Accuracy: ± 1cm
- Resolution: 1mm
- Measuring angle: 75 degrees
- Size: 42 x 29 x 12mm (L x W x H)
Working temperature: -20 - +70 Deg C
Applications:
- Water level measurement: The waterproof design of the K02 module makes it ideal for measuring water levels in tanks, reservoirs, and wells.
- Object detection: The K02 module can be used to detect the presence and distance of objects in various applications, such as in robotics, automated manufacturing, and security systems.
- Parking sensors: The module can be used as a parking sensor to help drivers park their vehicles safely and avoid collisions.
- Obstacle avoidance: The K02 module can be used in robotics to help avoid obstacles and navigate through environments.
- Distance measuring: The module can be used to measure distances in applications such as surveying, construction, and engineering.
- Smart agriculture: The module can be used in smart agriculture applications to measure the distance between plants and determine the optimal time for harvesting.
Pin Connections:
Pin | Description |
---|---|
VCC | Power supply pin, typically connected to +5V |
GND | Ground pin, typically connected to GND |
IOTRIG | Trigger pin for sending the ultrasonic signal, connected to a digital pin on the microcontroller board |
IOECHO | Echo pin for receiving the signal reflected from the object, connected to a digital pin on the microcontroller board |
Package Includes:
- 1 x Ultrasonic Ranging Waterproof K02 Sensor Module
Sample Project:
Circuit:
JSN-SR04T | Arduino |
---|---|
5V | 5V |
Trig | Pin 2 |
Echo | Pin 3 |
GND | GND |
Library:
- No external library is required for this module to work.
Code:
// Define Trig and Echo pin:
#define trigPin 2
#define echoPin 3
// Define variables:
long duration;
int distance;
void setup() {
// Define inputs and outputs
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
// Begin Serial communication at a baudrate of 9600:
Serial.begin(9600);
}
void loop() {
// Clear the trigPin by setting it LOW:
digitalWrite(trigPin, LOW);
delayMicroseconds(5);
// Trigger the sensor by setting the trigPin high for 10 microseconds:
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Read the echoPin. pulseIn() returns the duration (length of the pulse) in microseconds:
duration = pulseIn(echoPin, HIGH);
// Calculate the distance:
distance = duration * 0.034 / 2;
// Print the distance on the Serial Monitor (Ctrl+Shift+M):
Serial.print("Distance = ");
Serial.print(distance);
Serial.println(" cm");
}
Notes:
- This sensor only makes use of a single transducer