Your cart is empty!
Browse our Blog. You will find multiple applications, solutions, code examples. Navigate using the tag cloud or search using specific criteria
Water sensor using Arduino based PLC
Introduction
In this case we are using a basic water digital sensor. This sensor is very useful to detect if its raining or if we have liquid water in some point of our installation. The sensor is digital and will provide us a logic 1 when it's dry and a logic 0 when the sensor detects liquid water.
Requirements
Ethernet PLC or 20 I/Os PLC: Ethernet PLC 20 I/Os PLCWater Sensor
Industrial Shields boards: How to use the mapping pins of Industrial Shields boards
Connections

Sensor Pin | M-Duino Pin |
VCC | 5V |
GND | GND |
SIG | PIN 2 |
Software
This software is very simple. We are just reading the value in our Pin 2 and displaying it in the serial monitor through the Serial functions.
////////////////////////////////////////////////////////////////////////////////////////////////////
void setup(){
Serial.begin(9600L);
pinMode(2, INPUT);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void loop(){
int water_level = digitalRead(2);
Serial.print("Water level: ");
Serial.println(water_level);
delay(1000);
}
void setup(){
Serial.begin(9600L);
pinMode(2, INPUT);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
void loop(){
int water_level = digitalRead(2);
Serial.print("Water level: ");
Serial.println(water_level);
delay(1000);
}