Blog

Waterproof Ultrasonic Obstacle Sensor, Sensor with Separate Probe

+

Waterproof Ultrasonic Obstacle Sensor

Distance Measurement with Separate Waterproof Probe

Introduction

The Waterproof Ultrasonic Sensor features a separate waterproof probe connected to a control board, making it ideal for outdoor or wet environment applications. Using ultrasonic waves, it accurately measures distances from 2cm to 4.5m with a resolution of 0.3cm, even in challenging conditions.

Waterproof Ultrasonic SensorKey Features

🌊 Waterproof Design

IP67 rated probe for wet environments

📏 Accurate Measurement

2cm-450cm range with 3mm resolution

🔌 Dual Output

Analog voltage and digital PWM signals

Easy Integration

Works with 3.3V or 5V systems

Technical Specifications

Operating Voltage 3.3V – 5V DC
Measurement Range 2cm – 450cm
Resolution 0.3cm
Frequency 40kHz
Output Signals Analog voltage (0-VCC) and PWM
Probe Protection IP67 waterproof rating
Operating Temperature -10°C to +70°C
Cable Length 1m (standard, customizable)

Pin Configuration

Ultrasonic Sensor Pinout
Pin Label Description Arduino Connection
1 VCC Power (3.3V-5V) 5V
2 GND Ground GND
3 OUT Analog output (0-VCC) A0
4 PWM Digital PWM output D2
5 TRIG Trigger input (optional) D3
Note: The waterproof probe should be mounted with the sensing surface free of obstructions

Wiring with Arduino

// Basic Connections:
// VCC → 5V
// GND → GND
// OUT → A0 (analog input)
// PWM → D2 (digital input)

// Optional trigger:
// TRIG → D3 (digital output)

// Keep the control board in a dry location
// Only the waterproof probe should be exposed
Important: While the probe is waterproof, the control board should be protected from moisture

Basic Distance Measurement Example

// Waterproof Ultrasonic Sensor Basic Example
const int analogPin = A0;
const int pwmPin = 2;

void setup() {
  Serial.begin(9600);
  pinMode(pwmPin, INPUT);
}

void loop() {
  // Read analog output (0-VCC corresponds to 0-max distance)
  int analogValue = analogRead(analogPin);
  float analogDistance = map(analogValue, 0, 1023, 0, 450); // cm
  
  // Read PWM pulse width (pulse duration in μs corresponds to distance)
  float pulseWidth = pulseIn(pwmPin, HIGH);
  float pwmDistance = pulseWidth / 58.0; // Convert to cm
  
  Serial.print("Analog Distance: ");
  Serial.print(analogDistance);
  Serial.print(" cm | PWM Distance: ");
  Serial.print(pwmDistance);
  Serial.println(" cm");
  
  delay(200);
}

Advanced Features

Trigger Mode

// Manual trigger control
void triggerMeasurement() {
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);
}

// More precise timing control than automatic mode

Multiple Sensors

// Manage multiple sensors with trigger pins
void readSensors() {
  triggerSensor1();
  delay(50); // Allow time for measurement
  float dist1 = readDistance(SENSOR1_PIN);
  
  triggerSensor2();
  delay(50);
  float dist2 = readDistance(SENSOR2_PIN);
}

Moving Average

// Smooth readings with moving average
const int numReadings = 5;
float readings[numReadings];
int index = 0;

float smoothDistance(float newDistance) {
  readings[index] = newDistance;
  index = (index + 1) % numReadings;
  
  float total = 0;
  for (int i = 0; i < numReadings; i++) {
    total += readings[i];
  }
  return total / numReadings;
}

Obstacle Detection

// Detect obstacles within threshold
bool checkObstacle(float threshold) {
  float distance = readDistance();
  return distance < threshold;
}

void loop() {
  if (checkObstacle(30.0)) { // 30cm threshold
    activateAlarm();
  }
}

Troubleshooting

No Measurements

  • Check power supply (3.3V-5V)
  • Verify all connections
  • Ensure probe is not obstructed

Inconsistent Readings

  • Clean probe surface from debris
  • Ensure stable mounting
  • Implement software smoothing

Short Range Only

  • Check for sound-absorbing materials
  • Verify power supply is adequate
  • Test in different environmental conditions