Skip to content

AdrianBowyer/WiControl

Repository files navigation

WiControl
=========

Wireless Control with Panstamp and Raspberry Pi.


Installation:
-------------

On the Pi:

This assumes you have an out-of-the-box Raspberry Pi SD card with no extra software installed.

First set your local timezone:

$ sudo dpkg-reconfigure tzdata

You may want to change the default name of the Pi ("raspberrypi") to something more appropriate 
like "heatingcontrol".  To do that:

$ sudo nano /etc/hostname

That file contains a single name - the name of the Pi.  Change it to what you want, save the file, then reboot.

Change you password:

$ passwd

And enable ssh:

$ sudo raspi-config

Next install Apache and PHP:

$ sudo apt-get update
$ sudo apt-get install apache2 -y
$ sudo apt-get install php5 libapache2-mod-php5 -y

At this point it is a good idea to check that the webserver is now running.  In the URL address bar of a web browser on a PC or phone type

  myname.home/

where myname is the Pi's name that you created above (some networks need myname.local instead).  If you don't get anything type 

$ ifconfig

on the Pi.  This will tell you the Pi's IP address (something like 192.168.1.163).  Type that IP address into the web browser's URL bar.  You should see the default Apache/Debian server homepage.

Next install ftp:

$ sudo apt-get install ftp

And the ftp demon:

$ sudo apt-get install pure-ftpd

Create an ftp user (see https://www.raspberrypi.org/documentation/remote-access/ftp.md) called "upload" with access to the html directory:

$ sudo groupadd ftpgroup
$ sudo useradd ftpuser -g ftpgroup -s /sbin/nologin -d /dev/null
$ pushd /var/www/html/
$ sudo chown -R ftpuser:ftpgroup .
$ sudo pure-pw useradd upload -u ftpuser -g ftpgroup -d /var/www/html -m
[** You will be asked to create a password for the user upload at this point**]
$ sudo pure-pw mkdb
$ sudo ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/60puredb
$ sudo service pure-ftpd restart
$ popd

You next need to install the heating software:

$ git clone https://github.com/AdrianBowyer/WiControl.git
$ cd WiControl

Copy the control file:

$ cp run-heat-control.sample run-heat-control

and edit the file run-heat-control and replace the "zone-1"s with the name of the zone you want.

Copy the sending file:

$ cp sendtemps.sample sendtemps

and edit the sendtemps file to include the ftp password you set above and to change zone-1 to the name of your zone.

Backup the webserver's index file, and copy all the heating web files there and set permissions:

$ sudo mv /var/www/html/index.html /var/www/html/index.html.old
$ cd Web
$ sudo cp -r * /var/www/html
$ sudo chown -R ftpuser:ftpgroup /var/www/html
$ sudo chmod 666 /var/www/html/*.dat
$ sudo chmod 777 /var/www/html/zone-1-Profiles

Finally

$ sudo crontab -e

and add lines at the end like this:

* * * * * /home/pi/WiControl/run-heat-control
0 4   *   *   *    /sbin/shutdown -r +5

That will cause the shell script run-heat-control to be run once a minute, and cause a
system reboot at 04:05 in the morning to keep everything clean and tidy.  The sudo is
needed because shutdown needs root privilege.


On the PanStamps:

You can just about run the Arduino IDE on the Raspberry Pi, but it's probably better to
use a big serious computer to do this bit.  Install the Arduino IDE on your computer if
you haven't already got it:

https://www.arduino.cc/en/Main/Software

And clone the repository https://github.com/AdrianBowyer/WiControl.git as you did on the Pi.

Load the arduino program in the folder Panstamp-control into the IDE.

At the head of the file Control.h set up your heating zones and device names and numbers.  Load 
this program into each device (e.g. boiler, radiator) on your heating system.


Running
-------



When it runs it creates a status file called Status.

$ cat Status

will tell you what your system last did.  If you

$ touch Log

then each time run-heat-control runs it will append the status
report to the end of itself, which keeps a history and is therefore
useful for debugging.

When you have finished debugging don't forget to

$ rm Log

otherwise it will eventually fill up the SD/disc...


Adrian Bowyer

About

Wireless Control with Panstamp - This is frozen. Latest is here: https://github.com/RepRapLtd/WiControl

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published