Scripts related to Raspberry Pi temperature logger project for reading temperature values from DS18B20 sensor device and reading the data forward to Zabbix monitoring system.
- Scripts work
- Frontend stuff basically works, although there are some work (and ideas) still left.
data/:
- The database location
http/:
- Frontend made with Yii.
scripts/w1-temp:
- reads a value from the sensor and writes it to STDOUT
scripts/w1-store-temp:
- Creates a new SQLite database if it does not already exist
- Inserts the value to the database
README.md:
- This README
Assumption is that you have the Raspberry Pi (naturally) fixed with One Wire temperature sensor (DS18B20) to report temperature values. Read here about my setup.
-
Install required packages:
sudo apt-get install sqlite3 git apache2
. -
Download the project
$ cd /opt $ sudo mkdir RPi-temperature $ sudo chown pi:pi RPi-temperature $ git clone git://github.com/grassroot/RPi-temperature.git
-
Change Apache's default webroot to point into application directory by modifying file
/etc/apache2/sites-available/default
:- Modify
DocumentRoot /var/www
toDocumentRoot /opt/RPi-temperature/http/application
. - Modify
<Directory /var/www>
to<Directory /opt/RPi-temperature/http/application>
. - Reload the apache configuration:
sudo /etc/init.d/apache2 reload
.
- Modify
-
Add a following lines to your crontab to store the temperature values to the database. The script will create the database under data/ at first run.
# Store temperature values to the database every 10 minutes */10 * * * * /opt/RPi-temperature/scripts/w1-store-temp
-
Run the store-script manually to initialize the database and make sure it works.
-
Modify the database file and directory for Apache to be able to access it properly.
$ cd /opt/RPi-temperature $ sudo chgrp -R www-data data $ sudo chmod g+w -R www-data data
-
With your favourite browser, locate to the Pi's IP-address, and you should see a home page listing the latest temperature values.
-
Go to Locations-page and change the current location of the Pi.
Datz it, enjoy :-)