From Whitespace (Hackerspace Gent)
Jump to: navigation, search

This installation, the small spacecontrol, is active, we are working on a second version, the big spacecontrol.


What we have available

  • Relay board (Bert)
  • Arduino, Junction box, 220V cables and plugs (Koen)
  • Remote controlled RGB lamp (Impy)
  • Set of wireless power switches (Koen)

Thanks to all who have contributed hardware!

What we need

  • Ordered more powerful 12V IR leds from dealextreme. (Koen)


  • Junction box
    • The relay board and the Arduino are build into the junction box.
    • 220V AC is provided directly to this box.
    • A UTP cable is used to provide 12V DC and a serial connection between the Arduino and the control PC.
    • This 12V DC is used to power both the relay board 12V line (relays) and the Arduino Vin.
    • The 5V out from the Arduino is used to power the 5V line on the relay board (transistors).
    • Arduino digital port 0&1 are used for serial communication.
    • Digital ports 2-5 are used to control one relay each. Mapped to relay 0-3 in software.
  • Control PC
    • Software is currently installed on Audio server.
    • To provide serial communication between the server and the junction box a Launchpad board without chip is used. (So we are just using it as a USB-serial converter)
      Launchpad without chip used as USB-serial convertor for Arduino.
      PC communicating with Arduino in finished junction box using a Launchpad and a long UTP cable.

    • An ATX PSU is used to provide the neccesary 12V DC to the junction box.


All code for this project can be found on Github.


The Arduino is connected directly to relay board. The code on is is a simple state machine that decodes everything that comes in through the serial connection and set the relays accordingly. Format:


For example the sending the following string to the Arduino sets relay 2 to ON:



To allow remote control we use two different scripts that are stored in the servers cgi-bin folder. On Ubuntu 10.10 using Apache2 this folder is located at /usr/lib/cgi-bin. The applications must be made executable before the can be run. (chmod +x) To make sure the CGI scripts can access the serial port the user www-data needs to be added to the dialout group.

sudo usermod -a -G dialout www-data

Every time one of these scripts is executed the serial port is opened and the appropriate commend is send to the Arduino. To get these commands to work smoothly some delays and serial reads needed to be inserted. A lot of effort went into trail and error to find these delays. There is definitely room for improvement here. One idea is to make a daemon that continuously manages the serial connection.

To the play command work you also need to add user www-data to the group pulse-access.

sudo usermod -a -G pulse-access www-data


To make the CGI scripts accessible a webpage was made and stored in the folder /var/www/spacecontrol, it's reachable via http://spacecontrol.


The first version is installed


  • Figure out how to control the wireless switches.
  • Integrate the RGB lamp into the system.
  • Create a warning when trying to power-off audio server.
  • Integrate pizza button?