Project/LightingTheFacade

From initLab
Revision as of 18:08, 1 February 2016 by Maniax (talk | contribs) (→‎Logic)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Lights on the facade of the lab

Status

  • Plan - to have all the lights on the outside controllable from software
  • github issue
  • The system is ready and operational

Implementation

  • We installed LED lights on the facade
    • 2x30W on the street
    • 2x10W on the internal entryway
  • For each of these we have a small relay
  • All relays are controlled through a neomontana netcontrol via SNMP.

Cabling

  • For each relay, we have a pair going to it though the cabling of the house
  • We push 5V on those pairs
  • All relays go to the patch panel in the work room:
    • Lecture room - pp 15
    • Work room - pp 18
    • Hackvarium - pp 7
  • From that patch panel over pp 5 through cable WR2 they go to the rack in the coridor, to pp 2, and from it to the neomontana netcontrol
  • On the netcontrol we use relays 5-7 to control this, and push 5V from a normal power supply.

Day/night detection

  • patched sunwait
  • It's easily calculable when it's day/night based just on your position and the time of day.
  • ... and I don't care if it's too cloudy outside.

Logic

  • It's all implemented in an extremely hacky php/shell script, stripped code and explanation in Bulgarian
  • It loops every 60 seconds or skips the sleep if it receives a message on an unix domain socket.
  • The force trigger is /tmp/lamptrigger, if it exists, it means that the lights are forced on.
    • The script only checks for that file, it never deletes it or anything else.
  • Fetches the status of the lamps, the door, if it's light or dark outside.
  • If the lights are on:
    • If it's day and the lamps aren't forced on, they're turned off;
    • If it's night, the door is locked and more than 15 minutes have passed since the locking, the lamps are turned off;
  • If the lamps are off:
    • If they're forced, they're turned on;
    • If it's night and the door is unlocked (e.g. there are people in the lab), the lamps are turned on;

photos