Skip to content

About

Beehive monotoring project for tomatiki smart solutions test project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

BeeHive Sensor Monitoring System

Low-power ESP32-based environmental monitoring system for beehive health tracking. Collects temperature, humidity, CO2, vibration, and battery data every 15 minutes with deep sleep power management( expermental )

Features

  • Multi-Sensor Data Collection

    • BME680: Temperature, humidity, pressure, CO2 approximation
    • DS3231 RTC: Accurate timestamping with battery backup
    • Piezo sensor: Vibration frequency and amplitude detection
    • Battery monitoring: Voltage level tracking
  • Power Optimized

    • 15-minute wake/sleep cycles
    • Active time: <30 seconds per cycle
  • Reliable Data Storage

    • NVS-based persistent storage (survives power loss)
    • Unlimited reading accumulation until transmission
    • Automatic retry on write failures
    • Batch JSON formatting for efficient transmission -implemented my json formater to enhace memory usage
  • WiFi Transmission (Placeholder)

    • Batch upload when WiFi available
    • Automatic NVS clearing after successful send
    • Graceful degradation when offline

Hardware

  • Board: ESP32 WROVER
  • Sensors:
    • BME680 (I2C: 0x76)
    • DS3231 RTC (I2C: 0x68)
    • Piezo vibration sensor (ADC: GPIO36)
    • Battery monitor (ADC: GPIO35)
  • Power: 3.3V regulated, LiPo battery with voltage divider

Architecture

┌─────────────────────────────────────────────────────┐
│                    Application                      │
│                     (main.c)                        │
└──────────────┬──────────────────────┬───────────────┘
               │                      │
       ┌───────▼────────┐    ┌────────▼────────┐
       │   Services     │    │   Services      │
       │                │    │                 │
       │ • Data Manager │    │ • Comm Manager  │
       │ • Power Manager│    │                 │
       └───────┬────────┘    └─────────────────┘
               │
       ┌───────▼────────────────────────────────┐
       │          Hardware Abstraction          │
       │                                        │
       │ • BME680  • DS3231  • Vibration       │
       │ • Battery                             │
       └───────────────────────────────────────┘

Layer Responsibilities

  • HAL (Hardware Abstraction): Direct sensor communication, I2C/ADC drivers
  • Services: Business logic, data persistence, power management
  • Application: Sequential workflow orchestration

Quick Start

Prerequisites

Build & Flash

cd BeeHiveP
pio run -t upload
pio device monitor

Configuration

Edit include/config.h to customize:

// Timing
#define READING_INTERVAL_MIN        15      // Wake interval
#define TRANSMISSION_INTERVAL       4       // Readings before send

// WiFi (placeholder)
#define WIFI_SSID                   "YOUR_SSID"
#define WIFI_PASSWORD               "YOUR_PASSWORD"
#define SERVER_URL                  "http://your-server/api/sensor-data"

// I2C Addresses
#define BME680_I2C_ADDR             0x76    // or 0x77
#define DS3231_I2C_ADDR             0x68

Operation Flow

  1. Wake from deep sleep (timer-based, 15 min default)
  2. Initialize sensors and services
  3. Read sensors (BME680, RTC, vibration, battery)
  4. Store reading in NVS flash
  5. Attempt transmission (WiFi connect → send JSON → clear NVS)
  6. Enter deep sleep (repeat)

Data Format

JSON payload (minimal keys for bandwidth efficiency):

{
  "id": "esp32_sensor_001",
  "r": [
    {
      "ts": 1737820800,
      "temp": 22.5,
      "hum": 55.2,
      "co2": 450,
      "vib": 0.123,
      "batt": 85
    }
  ]
}

Memory Usage

  • RAM: ~3KB (static buffers, no heap fragmentation)
  • NVS: ~100 bytes per reading
  • JSON Buffer: 2.8KB (temporary, freed after send)

Project Structure

BeeHiveP/
├── include/              # Public headers
│   ├── config.h         # System-wide configuration
│   ├── datatypes.h      # Shared data structures
│   └── *.h              # Component interfaces
├── lib/
│   ├── hal/             # Hardware abstraction layer
│   │   ├── bme680/      # Environmental sensor
│   │   ├── ds3231/      # Real-time clock
│   │   ├── vibration/   # Piezo sensor
│   │   └── battery/     # Battery monitor
│   └── services/        # Business logic layer
│       ├── data_manager/    # NVS storage & JSON
│       ├── comm_manager/    # WiFi & HTTP (placeholder)
│       └── power_manager/   # Deep sleep control
├── src/
│   └── main.c           # Application entry point
└── platformio.ini       # Build configuration

Dependencies

Managed via ESP-IDF Component Registry (src/idf_component.yml):

  • esp-idf-lib/bme680 ^1.0.0
  • esp-idf-lib/ds3231 ^1.0.0

About

Beehive monotoring project for tomatiki smart solutions test project

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages