An open API service indexing awesome lists of open source software.

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.

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