Arduino Based Water Level indicator for underground tank

Hello, Can any one help me with the code for my project.

Project :

I want to place a water level float sensor in my water underground tank. When the water reach to a certain low level it will trigger a float and send message to my mobile. In this way I will get the notification and call the water company to send a water tanker pay load to refill my under ground tank.

Can some one help me with the code. Please note that I am interested in wifi based solution for messaging not GSM based.


WiFi based - so that message will be by e-mail?

Do you have any code already you need help with, or do you want to hire someone to write it for you from scratch?


I do not have specific code for this but I think this will work except the GSM need to be replaced with some thing internet based.

int PIN = 7;// attach sensor to pin 7
int sensor = 0;

void setup()
pinMode (PIN,INPUT);
Serial.begin(9600); // gsm baud rate
void loop()
sensor = digitalRead (PIN); // read whether water is presented or not
if (sensor == LOW){   // if water is not presented send a message
Serial.println("AT+CMGF=1"); // send SMS in text mode
Serial.println("AT+CMGS=\"+01XXXX\""); //CHANGE TO Number , you'd like to receive message
Serial.print("Water level is low in underground tank (attention required)"); // content of the message
Serial.write(26); // ctrl+z ASCII code
delay(18000000); // Wait for 5 hrs before next reading

I would use an ultrasonic and get an actual level measurement. then you can send an alert every Monday of the tank level.
It would be a pain to hit the low level on Friday, before a holiday.

I would agree with dave-in-nj there are water proof ultrasonic sensors available, also it has no moving parts so it is less likely to fail.... as far as getting a notification via email or what not, I can not help with that, it is beyond my coding ability.


Problem is i am not good with the code at all, anyone can write a code for me using ultrasonic sensor. Also I have GSM device but I do not know why it is not getting connected with the GSM service provider.
That is the reason i am looking for alternative way to communicate.

code for ultra sonic sensors can easily be found on google, you just need the model of sensor you're using.

this is for HC-SR04

  digitalWrite(trig,LOW);      // activate Ping sensor 
  duration = pulseIn(echo,HIGH); //read trig

  cm = (duration / 2) / 29.1; // distance calculation


How to send alerts with this code.

if (cm > 200) sendAlert();

Change this to your desired water level (i.e. the distance between the sensor and the water level - the higher the number the lower the water level), and in the sendAlert function you send out the alert in whatever way you like to.

You will want some way to prevent alerts being sent time and again - your 5-hour delay() is a very crude (but in this application effective) way of doing this.