Project tutorial
Mobile Water Level Tracker

Mobile Water Level Tracker © CC BY

View the water integrity and level of selected areas on your Android phone by using an HC-06 Bluetooth module to make an irrigation system.

  • 2,243 views
  • 0 comments
  • 6 respects

Components and supplies

Necessary tools and machines

Hy gluegun
Hot glue gun (generic)

Apps and online services

About this project

I had been working on a garden irrigation system for the plants although all my plants are in my balcony. While I was working on it, I realized that I needed to track the water integrity and the water level depending on the rain to adjust my irrigation system properly. And therefore, I designed a water level tracker by using an old bottle. I used a Funduino Water Sensor to measure the water integrity in the area where the sensor is placed. Also, I added a water level switch to detect whether the water level is below the threshold or exceeds it.When I finished this project, I thought that monitoring the water integrity and the water level on my Android phone by using an application is a beneficial idea hence I programmed a simple Android app named Mobile Water Level Tracker via MIT App Inventor. To send these data over the Bluetooth, I used an HC-06 Bluetooth module because the short-range data transferring method is enough for me in this case.

.To support my projects, you can visit my visit website here :)

Change HC-06 Bluetooth Module Default Variables

It is simple to use HC-06 Bluetooth modules to communicate an Android application; you just need to include the SoftwareSerial Library which is embedded on Arduino IDE Libraries. To change its default variables - name, password and baud rate - you can use the Change_BluetoothModule_Defaults() function at the source code.

Mobile Water Level Tracker Android Application

I programmed this application by using the MIT App Inventor in a simple design. It can display the data send by Arduino directly, so it allows you to change string names and variables, except the application and buttons name, in the source code if you want to use this application for another project. Just click the connect button to view Bluetooth devices you want to pair your phone - in this case, water module.

You can download the application from here.

After downloading the application, pair your phone and the water module to communicate with Arduino.

Connections

Arduino pin mapping and components connections are well-explained at the source code down below. Do not forget to attach a 10K resistor between GND and the digital signal pin while connecting the water switch to Arduino.

I decided to use an old bottle to detect the water integrity and the water level; I placed the Funduino Water Sensor on the top of it to measure the water integrity between 0 and 10 by mapping the analog signal pin value, as explained in the source code below. And, to detect whether the water level is below or above the threshold, I attach the water level switch in the bottle with a hot glue gun as depicted below.

Features

View the Water Integrity and Level on Android

Now, you are able to see the water integrity and level send by the HC-06 Bluetooth module on Android by downloading the Mobile Water Level Tracker Application.

Demonstration

Mobile Water Level Tracker | Rain Demonstration

Mobile Water Level Tracker | Android App Demonstration

Code

Source CodeArduino
      /////////////////////////////////////////////  
     //      Mobile Water Level Tracker         //
    //              via HC-06                  //
   //               (Android)                 //           
  //             by Kutluhan Aktar           // 
 //                                         //
/////////////////////////////////////////////


// Measure the water integrity and level around the area where you want to get data from by using a water level sensor and a Funduino water sensor. 
// View the water integrity and level variables send by a HC-06 Bluetooth Module on your Android phone by downloading the Mobile Water Level Tracker.
//
// Connections
// Arduino Nano :           
//                                 HC-06 Bluetooth Module
// 5V  --------------------------- 5V
// GND --------------------------- GND
// D5  --------------------------- RX
// D4  --------------------------- TX
//                                 Funduino Water Sensor
// 5V  --------------------------- 5V
// A0  --------------------------- S
// GND --------------------------- GND
//                                 Water Level Sensor
// 5V  --------------------------- Leg(1)
// GND + D2 ---------------------- Leg(2)
//                                 Control Led
// D3  --------------------------- 


// Include SoftwareSerial to control HC-06 Bluetooth Module
#include <SoftwareSerial.h>

// Define HC-06 Bluetooth Module RX and TX pins.
#define Water_RX 4
#define Water_TX 5

// Define bluetooth control pin.
#define control 3

// Define the Water Level Sensor digital pin.
#define Level 2

// Define Funduino Water Sensor pins.
#define Water A0

// Data holders.
int WaterLevel, WaterIntegrity;

// Initiate the bluetooth module.
SoftwareSerial WaterModule(Water_RX, Water_TX);

// Change the HC-06 Bluetooth Module default variables.
String Name = "WaterModule";
int Password = 1111;
String Uart = "9600,0,0";

void setup() {
Serial.begin(9600);
WaterModule.begin(9600);

pinMode(control, OUTPUT);

// If you want to change the HC-06 Bluetooth Module default variables, just uncomment this function below.
//Change_BluetoothModule_Defaults();

}

void loop() {
gatherWater();

sendWaterLevel();

}

// Send water level and integrity to Mobile Water Level Tracker App through the HC-06 Bluetooth Module.
void sendWaterLevel(){
  if(WaterModule.isListening()){
    // Turn the control led on.
    digitalWrite(control, HIGH);
  }else{
    // Turn the control led off.
    digitalWrite(control, LOW);
   }
   
    WaterModule.print("Water Level : \n");
    if(WaterLevel == 1){ WaterModule.print("OK \n"); }else if(WaterLevel == 0){ WaterModule.print("FULL \n"); }
    WaterModule.print("Water Integrity : \n");
    WaterModule.print(WaterIntegrity);

    delay(1000);
}


// Gather water level and water integrity from water sensors.
void gatherWater(){
  WaterLevel = digitalRead(Level);

  // Map the water sensor values between 0 and 10 to better measure the water integrity.
  WaterIntegrity = map(analogRead(Water), 0, 1073, 0, 10);
}
  
// Change the default variables embedded in the HC-06 Bluetooth Module.
void Change_BluetoothModule_Defaults(){ 
 
  WaterModule.print("AT+NAME"); // Change the name.
  WaterModule.println(Name); 
  Serial.print("Name is changed: ");
  Serial.println(Name);
  delay(2000);
  WaterModule.print("AT+PSWD"); // Change the password.
  WaterModule.println(Password);
  Serial.print("Password is changed: ");
  Serial.println(Password);
  delay(2000);
  WaterModule.print("AT+UART"); // Change the baud rate. If the bluetooth module is a HC-05, the default value of baud rate is 38400.
  WaterModule.println(Uart);
  Serial.print("Baud rate is set: ");
  Serial.println(Uart);
  delay(2000);
  Serial.println("Task is completed."); // You can see in the terminal whether the task is completed correctly or not.
}

Custom parts and enclosures

Fritzing File
mobile_water_level_tracker_43hSdPNFJl.fzz

Schematics

Schematic
Mobile water level tracker skzji5zm1a

Comments

Similar projects you might like

Mobile Weather Station Being Powered by Solar Energy

Project tutorial by Kutluhan Aktar

  • 2,630 views
  • 0 comments
  • 13 respects

Doggo Water Bowl Refill Monitor/Indicator - Part 2

Project tutorial by Heathen_Hacks-v2

  • 1,608 views
  • 0 comments
  • 3 respects

RFID Desk Lamp

Project tutorial by Kutluhan Aktar

  • 1,380 views
  • 0 comments
  • 3 respects

The Vibrating Pressure Temperature Altitude Tilt Detector

Project tutorial by Kutluhan Aktar

  • 1,651 views
  • 0 comments
  • 4 respects

Doggo Water Bowl Refill Monitor/Indicator - Part 1

Project tutorial by Heathen_Hacks-v2

  • 681 views
  • 2 comments
  • 3 respects

Jar Temperature Detector and Cooling Fan

Project tutorial by Kutluhan Aktar

  • 279 views
  • 0 comments
  • 5 respects
Add projectSign up / Login