An open API service indexing awesome lists of open source software.

https://github.com/bartekl1/rpi-thermometer

:thermometer: Raspberry Pi Thermometer
https://github.com/bartekl1/rpi-thermometer

dht11 ds18b20 humidity humidity-logger humidity-monitoring humidity-sensor iot raspberry-pi raspberry-pi-projects raspberry-pi-temperature raspberry-pi-thermometer raspberrypi smart-home smarthome temperature temperature-logger temperature-monitoring temperature-sensor thermometer

Last synced: 5 months ago
JSON representation

:thermometer: Raspberry Pi Thermometer

Awesome Lists containing this project

README

          

# 🌡 Raspberry Pi Thermometer

![GitHub release (latest by date)](https://img.shields.io/github/v/release/bartekl1/rpi-thermometer?style=flat-square)
![GitHub Repo stars](https://img.shields.io/github/stars/bartekl1/rpi-thermometer?style=flat-square)
![GitHub watchers](https://img.shields.io/github/watchers/bartekl1/rpi-thermometer?style=flat-square)
![GitHub forks](https://img.shields.io/github/forks/bartekl1/rpi-thermometer?style=flat-square)

[🕑 Changelog](CHANGELOG.md)
[🎁 Acknowledgements](ACKNOWLEDGEMENTS.md)
[đŸ‡ĩ🇱 Polish version of README](README_PL.md)

## â„šī¸ 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

```bash
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.

```json
{
"host": "0.0.0.0",
"mysql_user": "",
"mysql_password": "",
"mysql_database": ""
}
```

Replace ``, `` and `` with correct credentials.

5. Install PIP dependencies.

```bash
pip install -r requirements.txt
```

6. Create `/etc/systemd/system/thermometer.service` file with the following content.

```ini
[Unit]
Description=Thermometer
After=network.target

[Service]
WorkingDirectory=
ExecStart=/usr/bin/python3 /app.py
Restart=always
User=

[Install]
WantedBy=multi-user.target
```

Replace `` with path to the cloned repository and `` with your system username.

7. Start and enable created service.

```bash
sudo systemctl start thermometer
sudo systemctl enable thermometer
```

8. Add following line to crontab (edit using `crontab -e`).

```text
*/10 * * * * cd "" && python3 save_to_database.py
```

Replace `` with path to the cloned repository. You can edit cron expression to change frequency.