Smart Wireless Water Meter With Web DB iot projects(Hindi & English)

By Ashwini Kumar Sinha

7730
Advertisement
Change Video Language

 

As water consumption and wastage increases day by day, water scarcity has become a growing concern around the globe. While some irresponsible people are overusing water and wasting it daily, a large population remain deprived of safe drinking water. This problem is caused by the irregular distribution of water.

To deal with this, we need a solution that gives data about daily and monthly water consumption of each area and home to the government to enable proper water distribution. Good news is we have the solution now.

In this project, we are going to make a smart water meter that measures our daily water usage and provides live data on our phone that is connected to a database, which can be accessed by the government.

Advertisement

To start the project, we would require some components.

Components Required:

  • Water flow meter(Recommended FS400).
  • Arduino pro mini(5V and 16 MHz)
  • Bluetooth HC 05
  • Programmer (Arduino UNO/FTDI programmer )
  • OLED SSD 1306
  • Water Pipe(according to your sensor inlet diameter)
  • Water to tap connector

Once we have collected these components, we can start our project.

Setting Arduino IDE

Download the flow meter library and paste it in libraries folder of Arduino

After that open Arduino and click on manage library and search Oak SSD 1306 OLED library as in the pic below (Fig.1).

Fig. 1 Installing library

Now our Arduino IDE is ready. Let us start coding part.

Coding:

Open flow meter multi example code and add some of these parts.

First, we include libraries of flow meter and OLED display as in (Fig. 2).

Fig 2. Arduino code Including library

After this, we create the interrupt handler for the sensor as in (Fig. 3).

Fig 3. Setting Interrupt

Here, we set up the Bluetooth with Baudrate 9600. If it doesn’t work, try default Baudrate 34800.

Fig 4. Setting Bluetooth

Finally, we set the data output that will send to Bluetooth with Serial.print(data to send).

Then set OLED display function to display data on OLED screen with oled.println(data to send) refer (Fig 5)

Fig 5. Display data to OLED

As we are now done with the coding part, next is app making:

App Making

Open MIT App Inventor, make a layout and add the components as in Fig 6.

Main Components we added in the layout are:

  • 1 Buttons one for DB.
  • 5 Text view for Bluetooth connection status, Water flow rate of inlet, Total volume of water consumed, the flow rate of wastewater and total volume of water waste.
  • Tiny web DB
  • List picker for Bluetooth
  • Bluetooth client
  • Timer clock
Fig 6. App layout
App Layout

Now go to MIT Code block and set the code as in Fig 7.

You can download the whole code and app from link below with .aia file.

Code Water Meter

FIG 7. MIT APP Inventor Coding

We have made APP and we have finished the code. What we need now is to upload the code to Arduino.

NOTE: I have used Arduino pro mini to make the project small and easy, you can also use Arduino UNO for this project. Code and connection remain same for both, it’s all about your choice.

Uploading Code To Arduino Pro Mini:

First remove Arduino UNO IC as in (Fig. 8).

Fig 8. Removing Arduino I.C

Now connect Arduino Pro Mini as follow:-

Arduino Uno
Arduino Pro Mini
Rx Rx1
Tx Tx0
Gnd Gnd
5V VCC
Reset Reset

 

Now go to Tools and select Board Arduino pro mini and upload the code to Arduino pro mini refer Fig 9.

Fig 9. Setting board

Now we need to connect the components

Connections

Arduino Pro Mini Pins Components Pins
5V VCC of Bluetooth
GND GND of Bluetooth
RXI TX of Bluetooth
TX0 RX of Bluetooth
VCC OLED VCC
GND OLED GND
A4(SDA) OLED SDA
A5(SCL) OLED SCL

 

Refer Fig. 10 for connections

Fig 10. Connections

Do cross check all the connections, if you don’t want to end up frying your Arduino with wrong connection.

First make sure each of the connections are ok and then power the Arduino with 5V DC power supply.

Connect the water sensor pipe to the tap or water inlet of your water tank. By doing so, you can see the total volume of water and water flow rate on OLED display. Now, open Android app and press the Bluetooth icon where you will see a list of Bluetooth devices available. Pair with Bluetooth HC 05. After connecting you will get the water flow rate and water volume consumed in the app as in Fig 11.

Fig 11. Working model

You can tap on DB icon to upload our water usage data to the web server that can be seen from anywhere using the internet.

NOTE: Your internet connectivity must be turned on to upload data to the server.

To fetch data, click on the link given below and type your house name, that you have given in the app. I have used home 1. Click on search, You will get the details of water usage data. Refer Fig. 12.

Link for DB

Fig 12. Getting data from Web DB

Cheers! We have made an amazing solution that can help manage water consumption at home.

NOTE: You can also add the extra sensor to pin 2 for water wastage data. I have included code and app compatible with that.  Only add a sensor to it and enjoy your project.

Troubleshooting:-

Prob. (Problem): I don’t find the accurate data from the sensor.

Sol. (Solution): Follow the library link for calibration tutorial.

Prob:-  I get the “too  large index”, “end app” during running.

Sol:-  This happens because some data might be missed by Bluetooth during reading, tap out on screen or reconnect the Bluetooth of the phone.

Prob:-  Can I set it up and supply power through a socket?

Sol:- Use adaptor with 5V D.C for it.

Prob:- I can’t find enough VCC pin to connect  OLED, Bluetooth and sensor and as well as to power Arduino.

Sol:-   Solder the extra wire to VCC and ground pins and make connections.

Prob:- I can’t see Bluetooth HC 05 in the list.

Sol:- First pair the Bluetooth HC 05 with android, go on Bluetooth setting and tap on HC 05 to pair, and it will ask for the pairing code, default code for paring is 1234 0r might be 0000 or 1111.

Prob:- Error in Bluetooth communication and program uploading to Arduino.

Sol:-   Try interchanging the connections between Rx and Tx.


 

Advertisement


5 COMMENTS

  1. Hi, I get this:
    Sketch uses 14,992 bytes (48%) of program storage space. Maximum is 30,720 bytes.
    Global variables use 1,750 bytes (85%) of dynamic memory, leaving 298 bytes for local variables. Maximum is 2,048 bytes.
    Low memory available, stability problems may occur.
    An error occurred while uploading the sketch

  2. Hello sir/madam,
    This project to great. I hope this gets implemented. I would like to know where this idea is implemented / going to be implemented. My students will be amazed to see this in action. Do keep me posted.

    • This project is open to use and share. You need not to pay and you are free to make and use this project. This project is fully open and give you permission to use share , modify and improve.

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here