Sitemap / Advertise

Introduction

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.


Tags

Share

Mobile Water Level Tracker

Advertisement:


read_later

Read Later



read_later

Read Later

Introduction

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.

Tags

Share





Advertisement

Advertisement




    Components :
  • [1]Arduino Nano
  • [1]HC-06 Bluetooth Module
  • [1]Funduino Water Sensor
  • [1]Water Level Switch(Sensor)
  • [1]5mm Green Led
  • [1]10K Resistor
  • [1]221ohm Resistor
  • [2]Mini Breadboard
  • [1]Jumper Wires
  • [1]Hot Glue Gun

Description

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.

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.

project-image
Figure - 21.1

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, WaterModule.

You can download the application from here.

project-image
Figure - 21.2


project-image
Figure - 21.3

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

project-image-slide project-image-slide project-image-slide project-image-slide
Slide


Connections

Arduino pinmapping 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.

project-image-slide project-image-slide project-image-slide
Slide


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.

project-image-slide project-image-slide project-image-slide
Slide


Features

- View the water integrity of a selected area between 0 and 10.

- View the water level as OK and FULL indicators.

- Connect Arduino to Android by using this project Android application.

- See whether the connection is active or not by using the control led.

project-image
Figure - 21.3


project-image
Figure - 21.4


project-image
Figure - 21.5

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.

project-image-slide project-image-slide project-image-slide
Slide


project-image-slide project-image-slide project-image-slide
Slide


Demonstration

Mobile Water Level Tracker | Rain Demonstration

Mobile Water Level Tracker | Android App Demonstration

Source Code

Source Code

Download



      /////////////////////////////////////////////  
     //      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.
}


Schematics

project-image
Schematic - 21.1

Downloads

Android Application

Download

Fritzing File

Download