Skip to content

bartekl1/rpi-thermometer

Repository files navigation

🌡 Raspberry Pi Thermometer

GitHub release (latest by date) GitHub Repo stars GitHub watchers GitHub forks

🕑 Changelog 🎁 Acknowledgements 🇵🇱 Polish version of README

ℹ️ About

Available sensors

  • DS18B20 (temperature)
  • DHT11 (humidity)

Available functions

  • Measure current temperature and humidity
  • Save temperature and humidity to database
  • Simple website with current readings

👨‍💻 Installation

  1. Connect the DS18B20 and DHT11 sensors to the Raspberry Pi.

  2. Clone repository

    git clone https://github.com/bartekl1/rpi-thermometer
    cd rpi-thermometer
  3. Create database and import structure from thermometer.sql file.

  4. Create configuration file named configs.json with the following content.

    {
        "host": "0.0.0.0",
        "mysql_user": "<mysql_user>",
        "mysql_password": "<mysql_password>",
        "mysql_database": "<mysql_database>"
    }

    Replace <mysql_user>, <mysql_password> and <mysql_database> with correct credentials.

  5. Install PIP dependencies.

    pip install -r requirements.txt
  6. Create /etc/systemd/system/thermometer.service file with the following content.

    [Unit]
    Description=Thermometer
    After=network.target
    
    [Service]
    WorkingDirectory=<PATH>
    ExecStart=/usr/bin/python3 <PATH>/app.py
    Restart=always
    User=<USERNAME>
    
    [Install]
    WantedBy=multi-user.target

    Replace <PATH> with path to the cloned repository and <USERNAME> with your system username.

  7. Start and enable created service.

    sudo systemctl start thermometer
    sudo systemctl enable thermometer
  8. Add following line to crontab (edit using crontab -e).

    */10 * * * * cd "<PATH>" && python3 save_to_database.py
    

    Replace <PATH> with path to the cloned repository. You can edit cron expression to change frequency.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy