Our Lokesh came up with an innovative solution to automate the water payments of his residence.
We love seeing which creative FINN use cases come up from the community. This time it’s our very own Lokesh who came up with an innovative solution to automate the water payments of his residence. Using FINN, there’s no more need to manually check the water meters, and no more need for the residents to manually pay the bills. Lokesh wrote an extensive guide on how he made it all work – let’s dive right in!
As of today, we have water consumption meters installed at our residences by the Water Municipality Board (WMB). On a monthly basis, a person appointed from WMB comes to records the reading from the meter and drops over the bill copy at the residence to pay the water bill within a due date. It’s a dated system with numerous drawbacks, such as:
Time to innovate!
FINN can be used to automate the payment as well as notify the owner about the volume of water consumed on a timely basis. In order to make use of FINN, residences should have smart meters equipped with an ESP-32 board and a Water Flow Sensor to measure the volume of water consumed. Assuming all meters will be replaced by our new and improved ones, the following will be true after programming:
Time to get started.
· Arduino IDE to develop and flash sketch to ESP-32 Dev Kit for measuring water volume consumed and triggering notifications and actions autonomously
· BoT ESP32 SDK used as underlying library in the sketch for BoT Service. Download and install into Arduino IDE, refer to link for setting up the SDK on ESP-32 board
· Flowmeter library used in the sketch to simulate the flow sensor and measure the water volume consumption. Download and install into Arduino IDE.
For using FINN to enable autonomous payments for any use case, the very first step is getting login credentials for the Maker Portal. and define required Actions and Notifications. Below listed are the data points to be noted down from the maker portal:
Following the usage instructions provided at ESP-32 SDK Readme page, we need to provide certain information in the form of configuration and private-public key pair. The required files are available in the data directory of ESP-32 SDK GitHub repository, place them into data directory of the sketch to measure water volume consumption. Also, update the Maker ID and Device ID values accordingly in the configuration.json file. Below snippet shows the contents from configuration.json file:
The ESP-32 Water Meter Sketch mainly contains 3 separate tasks running on 2 ESP32 cores. The main task is responsible for measuring the water consumed using the attached flow sensor, running on Core-1. The other 2 tasks – notificationTask and paymentTask running on Core-0. The main task measures the frequency and flow rate from flow sensor, calculates the threshold notifications for each interval of 25 liters of water consumed and payment for every 100 liters of water consumed. The notificationTask is responsible for any outstanding notification to be triggered when it runs on Core-0. The paymentTask is responsible for checking any payment to be triggered when it runs on Core-0.
Below pasted is the code snippet from the main task on setting the notification flag for different intervals and the payment action flag.
As highlighted in the above code snippet from the main task, we can see that there are 4 intervals and by default, the interval threshold value is 25 liters. When the amount of consumed water reaches INTERVAL_THRESHOLD liters in any of the interval, the notify flag is set and the corresponding notifyID to identify the notification to be triggered by the notificationTask. And the consumed volume crosses the last interval threshold, by default it is 100 liters, then the payment action flag is set and the paymentTask is going to trigger the autonomous payment followed by the payment notification to the customer on FINN Mobile Application. All the 3 tasks are running indefinitely with the fixed amount of delay after each run.
The notificationTask, when it gets chance to run on Core-0, it checks for any outstanding notification pending through notify flag and if so, then it identifies the right notification to be triggered with the help of value stored in notifyID field, followed by triggering the notification with the help of BoT Service instance. The below pasted code snippet is from notificationTask:
Finally, the paymentTask is responsible for autonomous payment of any pending payment. When it gets chance to run on Core-0, it checks for any pending payment with the help of value stored in action flag and then triggers the payment if the payment is pending and the board is connected to Internet, followed by enabling the payment notification to be handled by the notificationTask when it gets next chance to run on Core-0. Below pasted code snippet from paymentTask of the sketch depicts the flow for autonomous payments:
With these 3 concurrent tasks running continuously on ESP-32 board making use of Core-0 and Core-1 with agreed upon delay between each of them are going to help in calculating the water consumed with the help of flow sensor and the regular notifications for every 25 liters of water consumed, autonomous payment for every 100 liters of water consumed.
This section provides the step by step instructions to execute the ESP-32 Water Meter Sketch available on BoT-ESP32-SDK GitHub repository. Refer to above provided Software Packages Section to setup the required Software Components on ESP-32 board. Follow the steps below to ready the sketch and execute on the ESP-32 board:
In this blog, we have briefly described how to use FINN to enable autonomous payments and notifications for amount of water consumed. We have detailed out about the hardware components requirements; software packages need to be used to achieve the solution explained through this blog. We have also explained the sketch flow implemented to autonomously measure the water consumption and perform the required notifications and payments. Finally, we have given the sequence of steps to execute and monitor the result of the explained solution. With the solution described through this blog, the Municipality Water Board and the consumers can make their lives simpler by adopting FINN service for autonomous payments and water consumption notifications at required intervals for water consumption.