Skip to content

A sensor node developed with Python Django for the Raspberry Pi

License

Notifications You must be signed in to change notification settings

Neluxx/enviro-node-pi

Repository files navigation

Enviro Node Pi

A Django-based environmental monitoring system for Raspberry Pi that collects sensor data and submits the data to a central EnviroHub API for analysis and visualization.

Features

Indoor Environmental Monitoring

  • BME680 Sensor Integration: Collects temperature, humidity, and air pressure measurements
  • MH-Z19 Sensor Integration: Monitors CO2 concentration levels
  • Automated Data Collection: Django management commands for scheduled sensor readings

Data Submission & Synchronization

  • EnviroHub Client: Automatic batch submission of sensor data to central API
  • Batch Processing: Configurable batch sizes (default: 1000 records) for efficient data transfer
  • Submission Tracking: Maintains submission status to prevent duplicate uploads
  • Error Handling: Comprehensive logging with rotating file handlers

Prerequisites

  • Git
  • Python 3.11+ (Installed in Pi OS Bookworm)
  • Virtual environment (e.g. virtualenv)
  • Raspberry Pi (Tested on Raspberry Pi 3B+)
    • BME680 Sensor (temperature, humidity, and air pressure)
    • MH-Z19 Sensor (CO2 concentration)

Installation

  1. Clone repository

    git clone https://github.com/Neluxx/enviro-node-pi.git
    cd enviro-node-pi
  2. Setup virtual environment

    python -m venv venv --system-site-packages
    source venv/bin/activate
  3. Install dependencies

    # For development (includes testing tools):
    pip install -r requirements-dev.txt
    
    # For production:
    pip install -r requirements-prod.txt
  4. Configure environment variables

    cd enviro_node
    cp .env.example .env
    
    nano .env # Edit .env with your configuration
  5. Run database migrations

    python manage.py migrate

Management Commands

Collect Sensor Data

python manage.py sensor_data_collector

Submit Sensor Data

python manage.py sensor_data_submitter

Reset Sensor Data

python manage.py sensor_data_resetter

Development

Running Test Suite

python manage.py test

Code Coverage Report

coverage run manage.py test
coverage report # Generates report in terminal
coverage html # Generates HTML report in ./htmlcov/

Code Quality Check

pre-commit install
pre-commit run --all-files

Changelog

See CHANGELOG for version history and updates.

Support

Please open an issue for support.

License

See LICENSE for details.

About

A sensor node developed with Python Django for the Raspberry Pi

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages