Engineering

CQRobot Non-Contact Water Sensor Review | Usecase: Hydroponic System

Motivation

For hydroponic systems, as plants get bigger, they require more water and nutrient. We need an automatic watering system.

 

 

 

Useful Specs

  • Digital Output Voltage = 3.3V or 5V (right Switch)
  • Current Consumption = 5mA

 

Arduino Code Example

init

int ledpin=13;// initialize pin 13

int inpin=7;// initialize pin 7

int val;// define val

setup

Serial.begin(9600);

pinMode(ledpin,OUTPUT);// set LED pin as “output”

pinMode(inpin,INPUT);// set button pin as “input”

 

loop

val=digitalRead(inpin);// read the level value of pin 7 and assign if to val

Serial.println(val); // print the data from the sensor

delay(100);

if(val==LOW)// check if the button is pressed, if yes, turn on the LED

{ digitalWrite(ledpin,LOW);}

else

{ digitalWrite(ledpin,HIGH);}

Demo

 

 

ABOUT ME
green scientist
Love travel, running, engineering, and gardening. Exploring new parks.

Leave a Reply

%d bloggers like this: