Help in a part of project

I am making a automation program and one of its part is automatic water motor. I want the motor to run until the tank is full then the motor stops until the tank gets empty and then run again.But i cant figure out how to do that please if anybody can help me out i will be Thankful.

What sensors do you have to determine the water level in the tank?

...R

iam just giving 5V supply into the water as a refrence for the arduino. when the others pins which i have set on the water levels touch the water they give arduino a 5V supply signal which tells the arduino where the water is

Post the program you are working with and tell us exactly what it does, and what you want it to do that is different.

A diagram of the tank and the sensors would also be useful.

And when posting code please use the code button </>so your code looks like thisand is easy to copy to a text editor See How to use the Forum

...R

Putting a DC voltage on anything that is in direct contact with the water is a bad idea. It'll cause your contacts to corrode very, very fast - you can lose your contacts in a matter of days. There are much better ways of determining water levels.

#define l1 8 //down level underground
#define l2 9 //uper wali level underground 
#define ugmotor 6
#define check 7
#define ohmotor 5
#define ohl1 4 //down wali level over head
#define ohl2 3//uper wali level over head
//#define ugna 10
//#define ohna 11
void setup()
{
  //pinMode(ugna,INPUT);
  //pinMode(ohna,INPUT);
  pinMode(l1, INPUT);
  pinMode(l2, INPUT);
  pinMode(ohl1, INPUT);
  pinMode(ohl2, INPUT);
  pinMode(ugmotor, OUTPUT);
  pinMode(ohmotor, OUTPUT);
}

void    ugmotoron()
{


  digitalWrite(ugmotor, 1);
  delay(2000);
  digitalWrite(ugmotor, 0);
  delay(2000);
}

void  ugmotoroff()
{

  digitalWrite(ugmotor, 0);
}
void checked()
{
  digitalWrite(ugmotor, 1);
}
void ohmotoron()
{
  digitalWrite(ohmotor, 1);
}
void ohmotoroff()
{
  digitalWrite(ohmotor, 0);
}
void loop()
{
  int a, b, c, d, e,f,g;
  a = digitalRead(l1); //undergroud motor empty
  b = digitalRead(l2); //undergroud motor full
  c = digitalRead(check);// confirming that water is coming from the ground then start the motor.
  d = digitalRead(ohl1);//overhhead motor empity
  e = digitalRead(ohl2); //overhhead motor full
  //f = digitalRead(ugna);
  //g = digitalRead(ohna);
  if (a == 0 && b == 0 && c == 0)
    checked();
  else if (b==1 && a==1)
    ugmotoroff();
  else if (c == 1 && a == 0 && b==0)
    ugmotoron();
  else if (e==0&&d == 0 && a==1)
    ohmotoron();
  else if (e==1&&d==1)
    ohmotoroff();


}

It is not helpful to post code without an explanation of how it actually works and what you want it to do that is different.

I notice that you don't have an Serial.print() statements in your program so you can see if the values of the sensors are what you expect of whether the IF statements respond as you expect.

...R

Well there is no serialprint and iam not using a sensor.
iam making a program which starts the motor automatically when the tank is empty ans also start the overhead motor if that is empty too.
Iam giving DC supply in water and two wires one on the low level and other on the higher.
so when the water touch the lower wore it tells arduino that lower level is high and when it reach the up-er wire it tells the arduino the uper level is full and stops the motor(sorry for bad english).

IjunaidI:
Well there is no serialprint

That's what I said. So add some to the program!

and iam not using a sensor.

The things that sense the water level are sensors.

...R

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Use serial prints to monitor your code, it won't upset how it runs and you can debug what your variables are doing.

Is this for a permanent installation, or just an experiment or proof of concept.

If it is for permanent installation, you would be better to use float switches.

Using conductivity will cause corrosion and failure of the sensor, it will also be susceptible to noise.

Tom... :slight_smile:

but float switch wont run the motor again when the tank is empty. can you guys give me your skype id so i can explain you better.

Hi,

but float switch wont run the motor again when the tank is empty

You use two float switches?

High Water Level Switch
Low Water Level Switch

Can you tell us your electronics, programming, Arduino, hardware experience?

Please answer ALL the questions in post #9.

Thanks.. Tom... :slight_smile:

Two float sensors will do the job and are probably the cheapest solution;

Top Switch Bottom Switch State
0 0 Tank Empty
0 1 Tank filling
1 1 Tank Full
1 0 Fault

You have not said how deep your tank is.
For a small tank etape is a very interesting, though more expensive, solution that I had not seen before;