شحن مجاني للأوردرات فوق
1000 ج
رمضان كريم
Liquid Measurement for Arduino and IoT Projects
The Water Level Depth Detection Sensor is a reliable tool for measuring liquid levels in tanks, wells, and other containers. Using exposed parallel traces, it measures water levels through conductivity with a simple analog output that varies with immersion depth.
Key FeaturesMeasures water level up to 40cm (depending on model)
Analog output proportional to water level
Operates at 3.3V-5V with minimal current draw
Mounts vertically with standard bolts
| Operating Voltage | 3.3V – 5V DC |
|---|---|
| Output Signal | Analog (0-VCC) |
| Measurement Range | Up to 40cm (model dependent) |
| Current Consumption | <20mA |
| Operating Temperature | 10°C – 30°C (for optimal performance) |
| PCB Material | FR4 with gold-plated contacts |
| Dimensions | 60mm × 20mm × 5mm (typical) |

| Pin | Label | Description | Arduino Connection |
|---|---|---|---|
| 1 | VCC | Power (3.3V-5V) | 5V |
| 2 | GND | Ground | GND |
| 3 | OUT | Analog output | A0 |
// Basic Connections: // VCC → 5V // GND → GND // OUT → A0 (analog input) // For best results: // - Keep sensor vertical // - Avoid touching the sensing traces // - Calibrate with known water levels
// Water Level Sensor Basic Example
const int sensorPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(sensorPin);
// Convert analog reading to voltage
float voltage = sensorValue * (5.0 / 1023.0);
Serial.print("Sensor Value: ");
Serial.print(sensorValue);
Serial.print(" | Voltage: ");
Serial.print(voltage);
Serial.println("V");
delay(1000);
}
// Convert readings to depth (cm)
float readDepth() {
int raw = analogRead(sensorPin);
// Calibration values (adjust based on your sensor)
float depth = map(raw, 0, 1023, 0, 40); // 40cm max depth
return constrain(depth, 0, 40);
}
// Check for low water level
bool checkLowLevel() {
int threshold = 200; // Adjust based on your setup
return analogRead(sensorPin) < threshold;
}
void loop() {
if (checkLowLevel()) {
digitalWrite(ALARM_PIN, HIGH);
}
}
// Smooth readings with moving average
const int numReadings = 10;
int readings[numReadings];
int index = 0;
int smoothReading() {
readings[index] = analogRead(sensorPin);
index = (index + 1) % numReadings;
int total = 0;
for (int i = 0; i < numReadings; i++) {
total += readings[i];
}
return total / numReadings;
}
// Calculate tank percentage full
float getPercentage() {
int dryValue = 50; // Sensor value when dry
int wetValue = 800; // Sensor value when fully submerged
int raw = analogRead(sensorPin);
float percent = map(raw, dryValue, wetValue, 0, 100);
return constrain(percent, 0, 100);
}
No account yet?
Create an Account
Recent Comments