skip to content
Fredesk Studio

Building a Distributed Tank Monitoring System with IoT

/ 5 min read

Introduction

Over the past year, I’ve been working on a fascinating project that combines IoT, embedded systems, and practical problem-solving. The Distributed Tank System is a modular IoT platform I developed for monitoring and controlling multiple fluid tanks, originally designed as a prototype for research and educational purposes, but later applied in practice to manage water tanks for a small museum/house installation.

What makes this project particularly interesting is that it was developed in the countryside of Peru, emphasizing low-cost, low-power components and wireless communication - constraints that shaped many of the design decisions along the way.

The Problem

In many locations, water management is a critical challenge. Traditional water systems often lack monitoring capabilities, making it difficult to:

  • Track water levels across multiple tanks
  • Monitor system health and detect issues early
  • Optimize water distribution and usage
  • Maintain reliable water supply

The solution needed to be modular for easy addition or removal of tank monitoring points, wireless for flexible placement without extensive wiring, low-cost for small installations, reliable enough for outdoor and semi-industrial environments, and scalable to support multiple tanks and future expansion.

System Architecture

System Overview

The system consists of three main components:

1. Sensor/Actuator Nodes

Each node is an independent module equipped with sensors for liquid level, temperature, humidity, and ambient pressure monitoring, along with actuators including pumps, valves, and flow sensors. The nodes feature Wi-Fi connectivity for data transmission and are designed for low-power operation.

The nodes are implemented using Toit, a high-level language specifically designed for IoT devices that runs on ESP32 microcontrollers.

2. Central Controller

Base Controller

The base controller serves as the system’s brain, managing communication with all nodes, implementing control algorithms and decision-making, collecting and processing sensor data, and providing data to the dashboard application.

3. Dashboard Application

A Kotlin-based Android app that provides real-time monitoring with live data visualization from all nodes, system control with manual override capabilities, debugging tools for system diagnostics and troubleshooting, and historical data for trend analysis and reporting.

Technical Implementation

Hardware Design

The project involved designing custom PCBs for both the nodes and the base controller. Key hardware components include ESP32 microcontrollers for processing and Wi-Fi communication, pressure sensors for liquid level measurement, temperature and humidity sensors for environmental monitoring, pumps and valves for water control, flow sensors for usage tracking, and custom PCBs designed for outdoor and semi-industrial environments.

Software Stack

Embedded Software (Toit): A high-level language that simplifies IoT development with built-in support for ESP32 peripherals, easy integration with sensors and actuators, and efficient memory management for resource-constrained devices.

Communication Protocol: Currently using Wi-Fi and HTTP for communication, with MQTT integration planned for improved scalability and RESTful API for dashboard communication.

Dashboard App (Kotlin): Native Android application with real-time data visualization and system configuration and control interface.

Development Challenges

Working in the countryside of Peru for a small museum/house installation presented unique challenges that influenced the design:

Power Constraints

Limited access to reliable power sources required low-power operation and efficient power management.

Environmental Factors

High humidity, temperature variations, dust, and outdoor exposure demanded robust electrical design.

Connectivity

Unreliable internet connectivity necessitated local system operation and offline capabilities.

Cost Optimization

Budget constraints required locally available parts and a DIY-friendly design approach.

Current Status and Features

The system is currently functional with real-time monitoring through the dashboard app, modular node design for easy expansion, controller logic for node coordination, environmental sensing (temperature, humidity, pressure), wireless communication between components, and custom PCB design for reliability.

Control modes (automatic, manual, maintenance), advanced features (alerting, optimization), and MQTT integration for improved scalability are currently in progress.

Lessons Learned

This project taught me several valuable lessons about IoT development in challenging environments:

Simplicity Over Complexity: Starting simple and iterating proved more effective than trying to build everything at once. The modular approach allowed for incremental improvements.

Environmental Considerations: Hardware design must account for real-world conditions. What works in a lab might fail in the field.

Power Management is Critical: In remote settings, power efficiency isn’t just nice-to-have - it’s essential for system viability.

Local Context Matters: Understanding the specific needs and constraints of the deployment environment is crucial for success.

Future Work

The project has significant potential for expansion with additional sensor types for more comprehensive monitoring, AI/ML integration for predictive maintenance, scaling to larger numbers of nodes, enhanced security for distributed IoT systems, and integration with existing water management infrastructure.

Open Source and Community

The project is open-sourced under the Apache License 2.0, and I’m open to suggestions and feedback from others. The repository includes complete source code for all components, PCB design files and schematics, documentation and setup guides, and photos and videos of the implementation. While the system was used in practice, it was primarily intended as something to learn from.

You can find the project at: https://github.com/brueningf/distributed-tank-system

Conclusion

Building the Distributed Tank System has been a rewarding experience that combined technical challenges with real-world problem-solving. The project demonstrates how IoT technology can be applied to solve practical problems in resource-constrained environments.

The modular architecture and open-source nature make it a solid foundation for further development, whether for water management, agricultural monitoring, or other distributed sensing applications.

While the system is functional as a prototype, there’s still work to be done in terms of control modes, optimization, and scaling. I’m excited to continue developing these features and seeing how others might adapt and improve upon this foundation.