Back to Explore
IoT ProjectDocker Compose

Solar Panel Robot Cleaner — IoT System

A full-stack IoT system with 4 Docker containers: React frontend, Python backend, MQTT broker, and PostgreSQL — all orchestrated with Docker Compose.

Project Overview

This IoT project automates the cleaning of solar panels using a physical robot controlled via a web dashboard. The entire server-side infrastructure runs inside 4 Docker containers orchestrated with Docker Compose, ensuring a consistent and portable development and production environment.

ESP8266
Hardware
4
Containers
MQTT
Protocol
WebSocket
Real-time

4 Docker Containers

Each service runs in its own isolated container. They communicate via a shared Docker network defined in docker-compose.yml.

React Frontend
:5173
Dashboard real-time untuk monitoring dan kontrol robot cleaner.
React + Vite + Tailwind
Python Backend
:5000
REST API & WebSocket server yang menjembatani frontend dengan MQTT broker.
Flask + SocketIO + Eventlet
MQTT Broker
:1883
Message broker untuk komunikasi async dengan ESP8266 di robot fisik.
Mosquitto Broker
PostgreSQL
:5432
Database untuk menyimpan log aktivitas, riwayat pembersihan, dan data sensor.
PostgreSQL 15

Docker Compose Configuration

A single docker-compose.yml spins up all 4 services with one command: docker compose up -d.

docker-compose.yml
services:
  frontend:
    build: ./frontend
    ports:
      - "5173:5173"
    depends_on:
      - backend
    networks:
      - solar-net

  backend:
    build: ./backend
    ports:
      - "5000:5000"
    depends_on:
      - mqtt
      - postgres
    environment:
      - DATABASE_URL=postgresql://user:pass@postgres:5432/solardb
      - MQTT_HOST=mqtt
    networks:
      - solar-net

  mqtt:
    image: eclipse-mosquitto:2
    ports:
      - "1883:1883"
      - "9001:9001"
    volumes:
      - ./mosquitto/config:/mosquitto/config
    networks:
      - solar-net

  postgres:
    image: postgres:15
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: pass
      POSTGRES_DB: solardb
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - solar-net

networks:
  solar-net:
    driver: bridge

volumes:
  postgres_data:

Communication Architecture

React DashboardFlask BackendWebSocket (SocketIO)

Real-time bidirectional channel. Frontend sends commands (START, STOP) and receives live progress updates (P:1%...P:100%).

Flask BackendMQTT BrokerMQTT Publish/Subscribe

Backend publishes movement commands to topics like `robot/command`. Robot subscribes and responds via the broker.

MQTT BrokerESP8266 (Robot)MQTT over WiFi

Physical hardware subscribes to command topics and publishes sensor data back through the Mosquitto broker.

Flask BackendPostgreSQLSQLAlchemy ORM

All cleaning sessions, robot states, and timestamps are stored persistently in the PostgreSQL database.

Hardware Components

ESP8266
Microcontroller

WiFi-enabled MCU running the robot firmware and MQTT client.

L298N Driver
Motor Controller

Dual H-bridge for controlling DC motors (forward, backward, stop).

DC Motors
Actuators

High-torque motors for moving the cleaning mechanism across the panel.

Water Pump
Cleaning System

Activated remotely to spray water while the brush cleans the surface.

Limit Switches
Position Sensors

Top and bottom switches to detect panel edges and stop movement.

WiFi Module
Connectivity

Built-in to ESP8266, connects to local network for MQTT communication.

Want the full breakdown?

Explore the full project case study