Skip to content

thetangstr/dryager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dry Aging Refrigerator Control System

A Raspberry Pi-based application for precisely controlling temperature and humidity in a dry aging refrigerator.

Overview

This system maintains optimal conditions for dry aging meat by controlling refrigeration components and monitoring environmental conditions through redundant sensors. It provides reliable operation with failover capabilities, automatic defrosting, and remote monitoring through Google Sheets integration.

Features

  • Precise Temperature Control: Maintains temperature between configurable limits (default: 1-4°C)
  • Humidity Monitoring: Tracks and manages humidity levels for optimal dry aging
  • Redundant Sensor Setup: Uses dual BME280 sensors (I2C and SPI interfaces) for reliability
  • Automatic Defrost Cycles: Scheduled defrost cycles to prevent ice buildup
  • Data Logging: Records all sensor readings and system states to Google Sheets
  • Email Notifications: Sends alerts for critical events and sensor issues
  • Graceful Shutdown: Properly handles termination signals to safely shut down components

Hardware Requirements

  • Raspberry Pi (3B+ or newer recommended)
  • Two BME280 temperature/humidity sensors:
    • One connected via I2C
    • One connected via SPI (for redundancy)
  • Relay module for controlling:
    • Refrigeration compressor
    • Evaporator fan
  • Appropriate power supply
  • Jumper wires and connectors

Wiring Diagram

Raspberry Pi GPIO Pin Layout:

                    +-----+
                    | USB |
                    +-----+
                    |     |
+-----+      +------+-----+------+      +-----+
|     |      |                   |      |     |
| USB |      |      Pi  GPIO     |      | PWR |
|     |      |                   |      |     |
+-----+      +-+---------------+-+      +-----+
             3V|               |5V
             5V|               |GND
     SDA/GPIO2-|               |TXD/GPIO14
     SCL/GPIO3-|               |RXD/GPIO15
     GPIO4  ___|               |___  GPIO18
               |   Raspberry   |
     GPIO17-___|      Pi      |___-GPIO27
    (BME280)   |               |    (Compressor Relay)
     GPIO22-___|               |___-GPIO23
               |               |
    3.3V ______|               |______ GND
     MOSI/GPIO10               | MISO/GPIO9
     SCLK/GPIO11               | CS/GPIO8
               |               |
    (BME280 CS)GPIO5-----------|GPIO6
               |               |
               |               |
    GPIO19-----|               |-----GPIO16
               |               |
    GPIO26-----|               |-----GPIO20
               |               |
    GND--------|               |-----GPIO21
               |               |    (Evaporator Fan Relay)
    GPIO12-----|               |-----GND
               +-+-------------+-+
                 |             |
                 |    HDMI     |
                 |             |
                 +-------------+

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/dry-ager.git
    cd dry-ager
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Create a Google Service Account and download the credentials:

    • Go to Google Cloud Console
    • Create a new project or select an existing one
    • Enable the Google Sheets API
    • Create a service account and download the JSON key file
    • Place the key file in the project directory as credentials.json
    • Share your Google Sheet with the service account email
  4. Set up environment variables:

    export DRY_AGER_EMAIL_PASSWORD="your_email_password"
    
  5. Configure the system:

    • Edit config.py to match your hardware setup and preferences
    • Update email settings in config.py

Usage

Basic Operation

Run the application:

python main.py

Command Line Arguments

  • --test: Run in test mode with shorter intervals (for development)
  • --debug: Enable detailed debug logging
  • --no-email: Disable email notifications
  • --no-sheets: Disable Google Sheets logging

Running as a Service

To run as a system service on Raspberry Pi:

  1. Create a systemd service file:

    sudo nano /etc/systemd/system/dry-ager.service
    
  2. Add the following content:

    [Unit]
    Description=Dry Aging Refrigerator Control System
    After=network.target
    
    [Service]
    ExecStart=/usr/bin/python3 /path/to/dry-ager/main.py
    WorkingDirectory=/path/to/dry-ager
    StandardOutput=inherit
    StandardError=inherit
    Restart=always
    User=pi
    Environment="DRY_AGER_EMAIL_PASSWORD=your_email_password"
    
    [Install]
    WantedBy=multi-user.target
    
  3. Enable and start the service:

    sudo systemctl enable dry-ager.service
    sudo systemctl start dry-ager.service
    
  4. Check service status:

    sudo systemctl status dry-ager.service
    

Monitoring

  • Google Sheets: All data is logged to the configured Google Sheet
  • Local Logs: Check the logs directory for detailed application logs
  • Email Alerts: Critical events trigger email notifications

System Architecture

The system is designed with modularity and reliability in mind, following SOLID principles:

  • main.py: Application entry point and main control loop
  • sensors.py: Manages sensor initialization and readings
  • controller.py: Controls refrigeration components
  • utils.py: Provides utility functions for logging and notifications
  • config.py: Centralized configuration settings

Troubleshooting

Common Issues

  1. Sensor Initialization Failures

    • Check wiring and connections
    • Verify I2C/SPI is enabled in raspi-config
  2. Email Notification Failures

    • Check internet connectivity
    • Verify email password environment variable
    • For Gmail, enable "Less secure app access"
  3. Relay Control Issues

    • Check relay wiring and GPIO pins
    • Verify GPIO permissions
  4. Google Sheets Connection Issues

    • Check internet connectivity
    • Verify credentials file location and permissions
    • Ensure sheet is shared with service account email

License

MIT License

Contributing

Contributions welcome! Please feel free to submit pull requests.

Safety Notice

This system controls refrigeration equipment. Always ensure proper electrical safety and consult with a professional for installation involving high-voltage equipment.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages