https://github.com/arvinnotdev/smart_water_meter
This is a field-ready water usage monitor that combines low-level hardware efficiency with user-friendly remote control.
https://github.com/arvinnotdev/smart_water_meter
arduino esp32 esp32-arduino live smart smart-home smarthome water watermeter websocket
Last synced: 10 months ago
JSON representation
This is a field-ready water usage monitor that combines low-level hardware efficiency with user-friendly remote control.
- Host: GitHub
- URL: https://github.com/arvinnotdev/smart_water_meter
- Owner: ArvinNotDev
- Created: 2025-09-01T07:03:01.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-09-01T14:43:00.000Z (10 months ago)
- Last Synced: 2025-09-01T16:37:17.541Z (10 months ago)
- Topics: arduino, esp32, esp32-arduino, live, smart, smart-home, smarthome, water, watermeter, websocket
- Language: Python
- Homepage:
- Size: 49.8 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π° Water Flow Meter with SMS Alerts & EEPROM Logging
This project measures water flow, counts liters, and provides remote monitoring via SMS commands.
It uses an **Arduino + flow sensor + GSM module + 24C256 IΒ²C EEPROM** to create a robust, low-power, field-ready solution.
---
## β¨ Features
### Accurate Water Flow Measurement
- Interrupt-driven pulse counter for precise flow tracking.
### SMS Control & Monitoring
- Send **`GET`** β receive the total liters used.
- Send **`RESET`** β reset the counter.
### Persistent Storage (24C256 EEPROM)
- Stores the water usage counter even after power loss.
- Sequence-numbered entries ensure the latest record is always found.
- Optimized page writes for endurance.
### Non-blocking SMS Sending
- No more 5-second freezes when sending SMS.
### Robust SMS Parsing & Deletion
- Reads only new messages.
- Deletes them after processing.
### Data Safety
- Wraps counter updates in `noInterrupts()` for atomic operations.
---
## π οΈ Hardware Requirements
- Arduino Uno / Nano / Mega
- Water Flow Sensor (Hall-effect type, e.g., **YF-S201**)
- SIM800L / SIM900 GSM module
- 24C256 IΒ²C EEPROM (**AT24C256N** or equivalent)
- Jumper wires, breadboard, stable power supply
---
## β‘ Wiring
### EEPROM (AT24C256N, IΒ²C)
| Pin (EEPROM) | Arduino |
|--------------|---------|
| VCC | 5V |
| GND | GND |
| SDA | A4 |
| SCL | A5 |
| WP | GND |
### Flow Sensor
| Pin | Arduino |
|-------|---------|
| VCC | 5V |
| GND | GND |
| Signal| D2 (INT0)|
### GSM Module (SIM800L/SIM900)
| Pin | Arduino |
|-----|----------------------|
| VCC | 4Vβ5V (separate PSU recommended) |
| GND | GND |
| TX | D8 (SoftwareSerial RX) |
| RX | D9 (SoftwareSerial TX) |
---
## π EEPROM Data Layout
Each record = **6 bytes**:
- `sequence` (4 bytes, uint32_t)
- `liters` (2 bytes, uint16_t)
With 32 KB total:
Thatβs **~5,461 saves** β with one save per liter, you get **years of retention**.
---
## π² SMS Commands
- **GET** β returns the current water usage in liters.
- **RESET** β resets the counter to zero and saves it.
---
## π¦ How It Works
1. Flow sensor pulses are counted in an interrupt.
2. Every time the counter updates, itβs stored in EEPROM with a sequence number.
3. On startup β only the **latest EEPROM entry** is loaded.
4. GSM module listens for incoming SMS:
- Parses and executes commands.
- Sends back results using **non-blocking SMS sending**.
- Deletes messages after processing.
---
## βοΈ Software Highlights
- **EEPROM_Manager** β handles sequence tracking, page writes, safe loads.
- **FlowCounter ISR** β atomic counting with `noInterrupts()`.
- **SMSHandler** β parses messages, deletes after processing.
- **NonBlockingSMS** β allows loop to run while SMS is sending.
---
## π Getting Started
1. Clone this repo:
```bash
git clone https://github.com/yourname/water-flow-sms-meter.git
cd water-flow-sms-meter