blog

RCWL-1670 Waterproof Ultrasonic Sensor: Full Guide with Arduino Projects & Comparisons

RCWL-1670 waterproof Transceiver split Ultrasonic

Introduction

In embedded projects like water level detection, distance measurement, and obstacle avoidance robots, a reliable ultrasonic sensor is a game-changer. The RCWL-1670 stands out with its IP67 waterproof design, making it perfect for both indoor and outdoor use—whether you’re monitoring a fish tank’s water level, building a rainproof obstacle-avoiding robot, or creating a smart irrigation system. Unlike ordinary ultrasonic sensors, it combines high accuracy, easy integration with platforms like Arduino and ESP32, and durable waterproofing, solving the hassle of sensor damage in humid or wet environments. Today, we’ll dive deep into the RCWL-1670, covering everything from its core design to practical Arduino projects, helping you unlock all its potential.

What is the RCWL-1670 Waterproof Ultrasonic Sensor?

The RCWL-1670 is a dedicated waterproof ultrasonic sensor designed for non-contact distance measurement and object detection. It uses ultrasonic waves (high-frequency sound waves beyond human hearing) to calculate distance by measuring the time it takes for the waves to emit, reflect off a target, and return to the sensor.

Its biggest highlight is the waterproof casing—the entire module is sealed to prevent water, dust, and moisture from entering, enabling stable operation in rain, underwater, or high-humidity scenarios (like bathrooms or greenhouses). Inside the compact housing, it integrates a transmitter (to send ultrasonic waves), a receiver (to capture reflected waves), a control circuit, and signal processing chips. It communicates via simple UART (RX/TX pins) or analog signals, supporting direct connection to microcontrollers like Arduino, ESP32, and Raspberry Pi without complex peripherals.

From consumer electronics projects to industrial environmental monitoring, the RCWL-1670’s versatility and waterproof advantage make it a top choice for developers needing reliable distance measurement in harsh conditions.

How dose Ultrasonic Sensor work?

Similar to the working principle of infrared and visible light sensors, ultrasonic sensors also measure distance and identify, distinguish and measure objects by emitting ultrasonic waves, which are reflected by the object being measured, and then using the received ultrasonic waves.Unlike light waves, microwaves, or infrared waves and other electromagnetic waves, ultrasonic waves are mechanical waves with a vibration frequency higher than 20kHz. The general application extends from 50 KHZ to 5MHz. Since 20kHz is the upper limit of the frequency of sound that humans can hear, it is called ultrasonic waves.

How dose Ultrasonic Sensor work?

Ultrasonic waves belong to sound waves and have the characteristics of good directionality and the ability to propagate in a specific direction. Its penetration into liquids and solids is also very good. We know that the propagation speed of sound waves in air medium is generally 340 m/s. When they encounter moving objects, they can produce the Doppler effect, that is, the relative motion of the object being measured will cause the frequency of the reflected wave to increase or decrease, making ultrasonic sensors very sensitive in detecting moving objects.

The measurement principle of ultrasonic waves is as follows: The ultrasonic transmitter emits ultrasonic pulses, which travel through the medium (air) to the surface of the obstacle and then are reflected before reaching the receiver. By measuring the time required for ultrasonic waves to travel from emission to reception and combining it with the speed of sound in the medium, the distance between the probe and the surface of the obstacle can be calculated.

RCWL-1670 vs IR Sensor vs Radar Sensor: Which to Choose?

RCWL-1670 waterproof Transceiver split Ultrasonic

When selecting a distance/object detection sensor, the RCWL-1670 (ultrasonic) is often compared to IR sensor (infrared) and radar sensor. Each has unique strengths—here’s a detailed comparison to help you pick the right one:

FeatureRCWL-1670IR SensorRadar Sensor
Core PrincipleUltrasonic wave reflection (time-of-flight)Infrared light reflection/obstructionMicrowave signal Doppler effect
Detection RangeTypical 2cm–4m (varies by model)Short (5cm–1m)Long (up to 10m+)
AccuracyHigh (±1cm, stable measurement)Medium (±3cm, affected by light)Low (±5cm, for rough detection)
Environmental AdaptabilityExcellent (waterproof, unaffected by light/temperature)Poor (easily interfered by sunlight/ambient light)Good (penetrates fog/dust, but affected by metal)
Key AdvantageWaterproof, non-contact, high accuracyLow cost, simple circuitLong range, detects moving targets
Suitable ScenariosWater level detection, outdoor distance measurement, rainproof projectsIndoor obstacle detection, low-budget DIYSecurity monitoring, long-distance motion detection

For projects requiring waterproofing, precise distance data, or operation in variable light conditions (like outdoor water tanks or garden irrigation), the RCWL-1670 outperforms IR and radar sensors. If you need a cheap indoor solution, an IR sensor works; for long-distance motion detection (not precise distance), a radar sensor is better.

Core Components of the RCWL-1670

The RCWL-1670’s reliable performance comes from its integrated internal structure—here’s a breakdown of its key components (based on typical datasheet specifications):

  • Ultrasonic Transmitter: Emits40kHzultrasonic waves (the standard frequency for most ultrasonic sensors, balancing range and accuracy).
  • Ultrasonic Receiver: Captures reflected ultrasonic waves and converts them into electrical signals.
  • Control Circuit:Includes a microcontroller unit (MCU) to manage wave transmission/reception and calculate distance using the time-of-flight formula.
  • Signal Processing Chip:Amplifies weak reflected signals, filters out noise, and improves measurement stability.
  • Waterproof Casing:IP67-rated sealed housing with waterproof pins, protecting internal components from water and dust.
  • Power Management Module:Regulates input voltage (5V typical) to ensure stable operation of internal circuits, reducing voltage fluctuation interference.

 Key Hardware Specifications of the RCWL-1670

ParameterNotesMinimum ValueTypical ValueMaximum ValueUnit
Operating Voltage 2.865.5V
Operating Current   8mA
Standby Current (3.3V)  1.53uA
Standby Current (5V)  3.55uA
Maximum Detection Distance (Flat Wall)  400600CM
Operating Frequency  40 KHz
Blind Zone (Intra-Zone Latency) 2 3CM
Detection AccuracySame temperature, ±10M+ 1 %
Resolution (Theoretical)  1 mm
Detection Angle (Max Directional Angle) ±15 ±20°
Measurement Cycle  50 mS
Output Interface Mode  GPIO  
Operating Temperature -10 70 

Performance Parameter

ParameterSpecification
Operating Voltage3–5.5V
Operating Current6mA
Standby Current3.5μA @ 5V; 1.5μA @ 3.3V
Software CompatibilityCompatible with HC-SR04
Blind Zone2CM
Typical Maximum Detection Distance4M
Measurement Cycle50ms

RCWL-1670 Pin Definition & Schematic

The RCWL-1670 has 4 core pins—wiring is straightforward for most microcontrollers:

RCWL-1670 waterproof Transceiver split Ultrasonic
Serial No.LabelPin Description
15V3–5V Power Supply
2TXEcho – Distance Return Signal
3RXTrig – Trigger Signal
4GNDGround

Typical Applications of RCWL-1670

  • Outdoor Robot Obstacle Avoidance:Enables rainproof/waterproof outdoor robots (likelawn mowing robots, delivery drones) to detect obstacles like curbs or puddles within 2cm–4m in real time, adjusting paths to avoid collisions even in wet, rainy conditions.
  • Liquid & Water Level Measurement: Works stably in high-humidity environments to monitor water levels in fish tanks, industrial chemical tanks, or agricultural irrigation reservoirs, triggering alarms or pump controls when levels are too high/low.
  • Garbage Bin Detection:Installed at the top of outdoor bins, it measures the distance to accumulated garbage; when the distance drops below a threshold (like 10cm), it sends signals to management systems for timely collection.
  • Other Ranging Applications:Adapts to scenarios like smart irrigation (detecting crop height to adjust water volume), vehicle parking assistance (alerting to rear obstacles), and public facility water accumulation monitoring (triggering flood warnings in subway entrances).

Practical Example: RCWL-1670 + Arduino Water Level Detector with LED Alarm

Let’s build a simple yet practical project: a water level detector that uses the RCWL-1670 to measure water depth, displays the distance on the serial monitor, and triggers an LED alarm when the water level is too high (or too low).

Required Components

  • RCWL-1670 Waterproof Ultrasonic Sensor ×1
  • Arduino Uno ×1
  • Buzzer×1

Hardware Wiring

ultrasonic sensor for water level detection wiring

Code

				
					#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define Trig 9    // Connect to RX pin of ultrasonic sensor
#define Echo 10   // Connect to TX pin of ultrasonic sensor
#define buzzer 8  // Buzzer connected to digital pin 8

#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

// Water level threshold (unit: percentage)
float lowLevelThreshold = 10.0;  // Alarm when water level is below 10%
int cupHeight = 20;  // Total height of the cup (unit: cm)

// Minimum measurement distance (unit: cm)
float minDistance = 1.0;  // Minimum effective distance to avoid measurement errors when close

// Parameters for average filtering
const int sampleCount = 30;  // Number of sampling times
long durationSum = 0;  // Accumulated echo time
float distance = 0;  // Current distance to water surface

void setup() {
  Serial.begin(9600);
  pinMode(Trig, OUTPUT);
  pinMode(Echo, INPUT);
  pinMode(buzzer, OUTPUT);  // Set buzzer to output mode

  // OLED initialization
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("OLED initialization failed!"));
    while (true);
  }

  display.clearDisplay();
  display.setTextSize(1);          // Font size
  display.setTextColor(SSD1306_WHITE);  // Font color
  display.setCursor(0, 0);        // Set cursor position
  display.println("Water Level Monitoring");
  display.display();
}

void loop() {
  // Accumulate multiple sampling data and calculate average
  durationSum = 0;
  for (int i = 0; i < sampleCount; i++) {
    // Trigger ultrasonic pulse
    digitalWrite(Trig, LOW);
    delayMicroseconds(2);
    digitalWrite(Trig, HIGH);
    delayMicroseconds(10);
    digitalWrite(Trig, LOW);

    // Read echo time
    long duration = pulseIn(Echo, HIGH);
    durationSum += duration;  // Accumulate echo time each time
    delay(10);  // Short delay to avoid reading too fast
  }

  // Calculate average echo time
  long averageDuration = durationSum / sampleCount;
  distance = averageDuration * 0.0343 / 2;  // Calculate distance in cm

  // Ensure distance value is not less than minimum effective distance
  if (distance < minDistance) {
    distance = minDistance;  // Force set to minimum value if distance is too small
  }

  // Output to serial port
  Serial.print("Distance: ");
  Serial.print(distance);
  Serial.println(" cm");

  // Calculate current water level percentage
  float waterLevel = (cupHeight - distance) / cupHeight * 100;
  if (waterLevel < 0) waterLevel = 0;  // Prevent negative values

  // Display water level distance and percentage on OLED
  display.clearDisplay();
  display.setTextSize(2);         // Set larger font size
  display.setCursor(0, 20);
  display.print("Distance: ");
  display.print(distance);
  display.println(" cm");

  display.setTextSize(1);         // Set smaller font size
  display.setCursor(0, 50);
  display.print("Water Level: ");
  display.print(waterLevel, 1);   // Display water level percentage with 1 decimal place
  display.print("%");
  display.display();

  // Alarm if water level is below 10%
  if (waterLevel < lowLevelThreshold) {
    digitalWrite(buzzer, LOW);  // Turn on buzzer
  } else {
    digitalWrite(buzzer, HIGH);   // Turn off buzzer
  }

  delay(200);  // Short delay to avoid too frequent loops
}
				
			

FAQS

Why is the RCWL-1670’s measurement data unstable?

Common reasons include: ① Unstable power supply (add a decoupling capacitor); ② Obstacles/reflective surfaces (avoid measuring soft materials like foam that absorb ultrasonic waves); ③ Water droplets on the sensor surface (wipe clean to ensure smooth wave transmission); ④ Too short/too long distance (operate within the 2cm–4m optimal range).

Can the RCWL-1670 be used underwater for long periods?

It has an IP67 waterproof rating, which means it can withstand temporary submersion (up to 1m deep for 30 minutes). For long-term underwater use (like deep water tanks), additional sealing (like silicone glue around pins) is recommended to prevent water leakage.

How to connect the RCWL-1670 to ESP32 or Raspberry Pi?

For ESP32: Use its hardware UART pins (like GPIO16=RX, GPIO17=TX) and set the baud rate to 9600. For Raspberry Pi: Use the UART (TXD0/RXD0) pins, enable serial communication in raspi-config, and use Python code to read data via the serial port.

What’s the difference between UART and analog output for the RCWL-1670?

UART output provides digital distance data (more accurate, suitable for precise measurement), while analog output offers a voltage signal proportional to distance (simpler, no need for serial parsing—ideal for basic projects like obstacle alarms).

Leave a Reply

Your email address will not be published. Required fields are marked *