User Tools

Site Tools


how_to_setup_one_wire_projects_on_raspberry_pi

This is an old revision of the document!


These are some notes on how to setup various of my developments regarding OWFS on a Raspberry Pi.

I am not going to use the X server on my system, therefore let's clean it up, so future updates will consume less time and resources. See also How to uninstall X Server and Desktop Manager when running as headless server?

apt-get install deborphan
apt-get remove  --auto-remove --purge libx11-.\*
apt-get autoremove --purge libx11-.* lxde-.* raspberrypi-artwork xkb-data omxplayer penguinspuzzle sgml-base xml-core alsa-.* cifs-.* samba-.* fonts-.* desktop-* gnome-.*
sudo apt-get remove --purge $(deborphan)
sudo apt-get autoremove

Install required packages

apt-get install at libow-perl librrdtool-oo-perl libtie-ixhash-perl nginx-light owfs ow-shell php5-cgi php5-cli php5-sqlite libow-php5 rrdtool fcgiwrap
apt-get install ferm lzma nullmailer vim #for convenience

* remove 'n' in /usr/lib/perl5/OW.pm at line 68

OWST

  • Download phpliteadmin from https://code.google.com/p/phpliteadmin/
    • In phplieadmin's configuration file set $directory = '/var/lib/owst/'
  • Create sqlite3 database
      mkdir /var/lib/owst
      chown pi.www-data /var/lib/owst
      chmod 750 /var/lib/owst
      sqlite3 /var/lib/owst/owst.sq3 < config/database.sql
      chown pi.www-data /var/lib/owst/owst.sq3
    chmod 660 /var/lib/owst/owst.sq3
  • Insert into the databases' table switch the One-Write Switch you want to control
    • ow_type e.g. DS2413
    • ow_address e.g. 3A.B36249000000
    • ow_pio e.g. PIO.B
  • Set option “enable_dl” to “on” in /etc/php5/cli/php.ini
  • Dynamic loading doesn't work in my setup (using nginx and php-fastcgi, therefore libowphp.so must be loaded in the php5 configuration:
    • Create /etc/php5/mods-available/owphp.ini, write the following content in it
; configuration for owphp module
; priority=20
extension=libowphp.so
  • run php5enmod owphp
  • reload php-fastcgi
  • Copy cron and sudo config files
cp config/etc.cron.d.owst /etc/cron.d/owst
cp config/etc.sudoers.d.owst /etc/sudoers.d/owst
  • Create log file and set permissions
touch /var/log/owst.log
chown pi.www-data /var/log/owst.log
chmod 660 /var/log/owst.log

1w Monitoring

  • test with 1wgetValues.pl
  • run 1wSensorMon.pl, you get an error that the rrd-file cannot be opened, but that's OK, check /srv/1wMonitoring/sensors.txt
  • execute libexec/gen_rrd_create.pl - run the output as a command
  • execute 1wSensorMon.pl - no error this time

activate cron job

  • /5 * * * * root 1wSensorMon.pl 2> /dev/null
how_to_setup_one_wire_projects_on_raspberry_pi.1426864453.txt.gz · Last modified: 2015/03/20 16:14 by admin