Look for in 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 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);
}

 
 

Do you want more information?

Open Source technology allows you to develop your installations.

Just fill the form and we will contact you as soon as we can.

Send