Water sensor using Arduino based PLC

February 5, 2019 by
Water sensor using Arduino based PLC
Bernat Garcia

Introduction

In this case, we are using a basic water digital sensor. This sensor is very useful to detect if it's raining or if we have liquid water at some point in 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 PLC

Water Sensor

Industrial Shields boards:  How to use the mapping pins of Industrial Shields boards

Connections

Odoo CMS - a big picture

Sensor PinM-Duino Pin
VCC5V
GNDGND
SIGPIN 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);
}

 
 

​Search in our Blog

Water sensor using Arduino based PLC
Bernat Garcia February 5, 2019
Share this post

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>