Skip to content

jbertelson/AquariumMon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Aquarium Temperature Monitor

A FastAPI service that monitors aquarium temperature readings from IoT devices.

Features

  • Accepts temperature readings in °F from IoT devices
  • Stores readings in SQLite database
  • Alerts when temperatures fall outside configured range
  • RESTful API endpoints for submitting and querying readings

Prerequisites

  • Docker
  • Docker Compose

Quick Start

  1. Clone the repository:

    git clone <repository-url>
    cd aquarium-monitor
  2. Create the data directory:

    mkdir data
  3. Start the service:

    docker-compose up -d

The API will be available at http://localhost:8001

2. ESP32 Setup

Hardware Requirements

  • ESP32 development board
  • DS18B20 waterproof temperature sensor
  • 4.7kΩ pull-up resistor
  • Jumper wires

Wiring

DS18B20 → ESP32
VCC     → 3.3V
GND     → GND
DATA    → GPIO 23 (with 4.7kΩ pull-up to 3.3V)

Firmware Installation

  1. Install MicroPython on your ESP32
  2. Copy these files to the ESP32:
    • boot.py (OTA loader)
    • device_config.json (device configuration)
    • esp_runtime.py (main application - downloaded via OTA)

API Documentation

Once running, visit http://localhost:8001/docs for interactive API documentation.

Endpoints

  • POST /temperature - Submit a new temperature reading

    {
      "device_id": "tank_sensor_1",
      "temperature_f": 78.1,
      "timestamp": "2024-03-14T16:00:00Z"  // Optional
    }
  • GET /temperature?limit=100 - List recent readings

  • GET /temperature/latest?device_id=... - Get latest reading for a device

Configuration

Environment variables can be modified in docker-compose.yml:

  • DATABASE_URL: SQLite database path
  • TEMP_MIN_F: Minimum temperature threshold (°F)
  • TEMP_MAX_F: Maximum temperature threshold (°F)

Development

  1. Build the image:

    docker-compose build
  2. Run with logs:

    docker-compose up
  3. Stop the service:

    docker-compose down

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors