Grove water sensor

Grove is a modulated, ready-to-use tool set.
Much like Lego, it takes a building block approach to assembling electronics.

Moderators: lily.li, violet, jeremy882, crail.lyu969

Post Reply
cfchong
Pre-kindergarten
Pre-kindergarten
Posts: 2
Joined: Fri Apr 15, 2016 10:01 am

Grove water sensor

Post by cfchong » Fri Apr 15, 2016 10:04 am

Hi,

I'm using this type of sensor for my fyp demo project:
http://www.seeedstudio.com/wiki/index.p ... ter_Sensor

I'm using it with PIC16F887 to give output to LEDs when it detects water, the concept is simple:

When sensor 1 detects water, led green blinking;
When sensor 2 detects water, led yellow blinking;
When sensor 3 detects water, led red blinking with buzzer switch on.

I have my hardware done, but stucked on PIC programming because i'm not familiar on water sensor coding,
Can anyone please help to give advice or check my coding?

TQVM

shivamgautam1
Pre-kindergarten
Pre-kindergarten
Posts: 3
Joined: Sat Apr 16, 2016 11:32 pm

Re: Grove water sensor

Post by shivamgautam1 » Sun Apr 17, 2016 12:34 am

Hello! I am not very familiar with PIC16F887. But I can explain how the water sensor (One you are using) works. The sensor have the copper contacts (Those 11 vertical lines). When dipped in water, The copper contacts start to conduct with each other. The more it is exposed to the water, more it will conduct. In short: the SIG pin will go LOW when the sensor is exposed to the water otherwise it will remain HIGH. So, you can write the code accordingly.
Why don't you use an Arduino instead? I can write you a code for it. :D :geek:

cfchong
Pre-kindergarten
Pre-kindergarten
Posts: 2
Joined: Fri Apr 15, 2016 10:01 am

Re: Grove water sensor

Post by cfchong » Mon Apr 18, 2016 8:43 am

Hi! Thanks for your reply.

If that's the case, can this sensor total immersed in water? Or only can use water drop to test it?

TQ

kavi
Staff
Staff
Posts: 305
Joined: Tue Dec 09, 2014 12:06 pm

Re: Grove water sensor

Post by kavi » Tue Apr 19, 2016 8:00 pm

Hi,

We wrote a small example program for PIC

Code: Select all

void main()
{
PORTC=0;  //initialize portc
TRISC=0x07; //configure portc (RC7 to RC3) as output and (RC2 to RC0 as input)
ANSELH=0;    //configure an pin as digital I/O
ANSEL=0;

while(1){

//connect the grove water sensor sig to PIN RC0,RC1 and RC2( you need a 3 grove water sensor)
//connect the green led to PIN RC3,yellow led to PIN RC4,red lec to RC5 and Buzzer to RC6
if((RC0==1)&&(RC1==1)&&(RC2==1)){
//All Leds and Buuzzer off states
PORTC=0x00;

}
if((RC0==0)&&(RC1==1)&&(RC2==1))
{
//This states LED green  blinking
PORTC=0x04; 
delay(200);
PORTC=0x00;
delay(200);
}
if((RC0==0)&&(RC1==0)&&(RC2==1))
{

//This states LED yellow  blinking
PORTC=0x08; 
delay(200);
PORTC=0x00;
delay(200);
}

if((RC0==0)&&(RC1==0)&&(RC2==0))
{

//This states LED red blinking and buzzer on
PORTC=0x60; 
delay(200);
PORTC=0x40;
delay(200);
}

}
Let us know if it helps you.

Thanks and Regards

Post Reply