Difference between revisions of "Spacecontrol/Kourou"

From Whitespace (Hackerspace Gent)
Jump to: navigation, search
(Implementation)
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''This installation, the small spacecontrol, is active, we are working on a second version, the [[../Baikonur|big]] spacecontrol.'''
+
'''This installation, the small spacecontrol, is active, we are working on a extended version, the [[../Baikonur|big]] spacecontrol.'''
  
 
== Hardware ==
 
== Hardware ==
Line 15: Line 15:
 
===Implementation===
 
===Implementation===
 
* Junction box
 
* Junction box
** The relay board and the Arduino are build into the junction box.
+
** The relay board and the Arduino are build into a junction box. <br style="clear: both" /> [[File:2011-03-12 00.24.55.jpg|thumb|left|310px|The empty junction box.]][[File:2011-03-13 19.36.29.jpg|thumb|right|310px|The finished box!]][[File:2011-03-12 00.29.17.jpg|thumb|center|310px|Nice sticker looks nice...]]<br style="clear: both" />
** 220V AC is provided directly to this box.
+
** 220V AC is provided directly to this box. The box itself provides 4 AC power outlets. <br style="clear: both" /> [[File:2011-03-12 10.31.43.jpg|thumb|left|450px]]<br style="clear: both" />
 
** A UTP cable is used to provide 12V DC and a serial connection between the Arduino and the control PC.
 
** 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.
 
** 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).
 
** 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.
 
** 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.
+
** Digital ports 2-5 are used to control one relay each. Mapped to relay 0-3 in software.<br style="clear: both" /> [[File:2011-03-12 00.25.31.jpg|thumb|left|310px|Hooking up the control signals to the relays.]][[File:2011-03-12 21.50.57.jpg|thumb|right|310px|Soldering in two RJ45 connectors.]][[File:2011-03-12 01.36.27.jpg|thumb|center|310px|Testing if everything is going to fit.]]<br style="clear: both" /><br style="clear: both" />[[File:2011-03-12 20.46.05.jpg|thumb|left|310px|Hooking up the 12V DV and GND.]][[File:2011-03-12 22.06.47.jpg|thumb|right|310px|Connecting the two Ethernet connectors to the Arduino and allowing for 100MB pass-through.]]<br style="clear: both" />
  
 
* Control PC
 
* Control PC
 
** Software is currently installed on Audio server.
 
** 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) <br style="clear: both" /> [[File:2011-03-13 17.16.09.jpg|thumb|left|450px|Launchpad without chip used as USB-serial convertor for Arduino.]][[File:2011-03-13 19.36.21.jpg|thumb|right|450px|PC communicating with Arduino in finished junction box using a Launchpad and a long UTP cable.]]<br style="clear: both" />  
 
** 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) <br style="clear: both" /> [[File:2011-03-13 17.16.09.jpg|thumb|left|450px|Launchpad without chip used as USB-serial convertor for Arduino.]][[File:2011-03-13 19.36.21.jpg|thumb|right|450px|PC communicating with Arduino in finished junction box using a Launchpad and a long UTP cable.]]<br style="clear: both" />  
** An ATX PSU is used to provide the neccesary 12V DC to the junction box.
+
** An ATX PSU is used to provide the neccesary 12V DC to the junction box. This is the same PSU that currently is used to power the [[Dooropener#Local junction box|remote]] for the gatekeeper.
  
 
== Software ==
 
== Software ==
Line 48: Line 48:
  
 
=== WWW ===
 
=== WWW ===
To make the CGI scripts accessible a webpage was made and stored in the folder /var/www/spacecontrol, it's reachable via http://spacecontrol.
+
To make the CGI scripts accessible a webpage was made and stored in the folder /var/www/spacecontrol, it's reachable while connected to the 0x20 network via http://spacecontrol or http://spacecontrol.0x20.be.
  
 
== Status ==
 
== Status ==

Latest revision as of 17:50, 17 January 2012

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

Hardware[edit]

What we have available[edit]

  • 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[edit]

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

Implementation[edit]

  • Junction box
    • The relay board and the Arduino are build into a junction box.
      The empty junction box.
      The finished box!
      Nice sticker looks nice...

    • 220V AC is provided directly to this box. The box itself provides 4 AC power outlets.
      2011-03-12 10.31.43.jpg

    • 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.
      Hooking up the control signals to the relays.
      Soldering in two RJ45 connectors.
      Testing if everything is going to fit.


      Hooking up the 12V DV and GND.
      Connecting the two Ethernet connectors to the Arduino and allowing for 100MB pass-through.

  • 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. This is the same PSU that currently is used to power the remote for the gatekeeper.

Software[edit]

All code for this project can be found on Github.

Arduino[edit]

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:

%(Relay-nuber)#(state)

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

%2#1

CGI[edit]

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

WWW[edit]

To make the CGI scripts accessible a webpage was made and stored in the folder /var/www/spacecontrol, it's reachable while connected to the 0x20 network via http://spacecontrol or http://spacecontrol.0x20.be.

Status[edit]

The first version is installed

Todo[edit]

  • 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?