Spacecontrol

From Whitespace (Hackerspace Gent)
Revision as of 23:39, 28 August 2011 by Steamrunner (Talk | contribs)

Jump to: navigation, search


Spacecontrol
WhitespaceLogo.gif
What:
We automate because we can!
Participants:
Koen, Piet
Locations:
Whitespace
Events:
How to electrocute an elephant 2, How to electrocute an elephant 4
Cornify
Mission-control.jpg

Current Configuration

The spacecontrol project consists of two hardware parts. A small one and a big one. For more documentation on how they were both built look on the subpages. There is also a purely software part to do a remote soft poweroff some servers.

Currently only the small version is active.

  • This first version can control up to 4 220V devices.
  • It can do a soft poweroff of four servers in the space.
  • Software running on the audio server.
  • Currently 4 lamps in the main room are hooked up.

Usage

webinterface (low level)

This a very crude but functional webinterface to control our spacecontrol components. It should be self explanatory. Just visit http://spacecontrol while in the space select one of the tab sheets and click the buttons.

webinterface (graphical)

There is now also a graphical webinterface available. This is based on the opensource project HomeAutomation. For the moment this interface can be tested by visiting http://gatekeeper while in the space. (Username is "Whitespace" the password you should be able to guess)

This setup is being tested, not yet stable but please try and report problems. Known issues:

  • Webinterface will not load when the Audio server is not running. Trying to load anyway will cause a loop that fills the error log (/var/log/lighttpd/error.log) of lighttpd until the drive is full. Without any space mysqld won't come up and possibly other things will fail as well. Just empty the log file to fix things again.
installation

To run this software we will use the low power BeagleBoard we have laying idly by. This board is running Ubuntu 11.04. First step is to install all necessary packets, simply do:

sudo apt-get install lighttpd php5-cgi mysql-client mysql-server php5-mysql php5-cli at

Now we need to enable php support in lighttpd. The module needed to do this is called fastcgi. After that a reload is required so the changes take effect.

sudo lighty-enable-mod fastcgi 
sudo lighty-enable-mod fastcgi-php
sudo service lighttpd force-reload

To test if everything is working so far create a file /var/www/index.php with the following containing "<?php phpinfo(); ?>". Now browse to the device your installing on and you should see a overview page of your php installation.

Some usefull links:
https://wiki.ubuntu.com/Lighttpd%2BPHP
http://www.ubuntugeek.com/lighttpd-webserver-setup-with-php5-and-mysql-support.html

Then download the zip file containing the latest stable release from the website. That's version 2.0.2 in our case. Unzip and copy the entire content to /var/www. The ownership of all files was set to www-data.

sudo chown www-data:www-data -R *

/etc/php5/cgi/php.ini

cp config_smaple config.php

date.timezone = Europe/Brussels /var/www/

grant all privileges on homeautomation.* to 'homeautomation'@'localhost' with grant option;
create user 'homeautomation'@'localhost' identified by 'tellstick';
Android App

The current version of spacecontrol supports the DomoticHome Android app. This application can be found in the Android market (direct link to app). The first time you use the app go to settings and fill in the following:

IP: 172.22.32.21
PORT: 80

Click save and then when you hit Sync the current Spacecontrol configuration should be loaded. A menu structure will then appear in the main application window allowing you to control the connected appliances.

Insanity mode

Use FireBug or the Chromium thing to add ids 'on' and 'off' to the 'all on' and 'all off' buttons. Then run:

function hax( time ){ if (typeof foo != 'undefined') {return 'bar';}; document.getElementById('on').click(); document.getElementById('off').click(); setTimeout( "hax( " + time + " )", time ); } hax( 1000 );