Hackerspace Open Switch
|Hackerspace Open Switch|
|Project Owner: Ian Blais|
|Project Location: One A Column By The Door|
|Where to contribute: https://github.com/Hive13/openswitch|
|Start Date: 12/04/2010|
- 1 Overview
- 2 Project Details
- 3 Work Log
This project allows members at the HIVE13 space to indicate when someone is there and when the last person leaves. Ideally this will increase the activity at the HIVE since other members are more likely to drop by when they know stuff is going on in the space.
This project has been suspended until we get one of the smaller LED displays working to a degree that we can interface it with other projects.
- Add yourself here if you have contributed to this project.
Goal of the Project
Since the kickoff of the Hive13 hackerspace we have talked about how cool it would be to have a way to alert other people that the hackerspace was currently populated with people. We tossed around ideas from the absurd to the mundane, but it always stayed at the theoretical level. The more I thought about it I realized I had all the components needed to implement it, and if it was overkill, who the **** cares. We can either keep talking about how cool it is, or someone can get off their arse and do it.
What has been done
- Arduino w/ Ethernet Shield sends "GET" request to PHP web page which enters a 'Door Event' into the database which is polled by another web page to determine if the hackerspace is open or closed.
- It works: http://www.hive13.org/isOpen
- It also logs the current temperature to the database every five minutes.
GitHub for the source code: https://github.com/Hive13/openswitch
The 'Door Switch' or 'Is the Hackerspace Open?' switch has two main software components:
- The microcontroller client code.
- The webserver database and webpages.
The Electrical Components
- A standard light switch
- An Arduino Mega with POE Ethernet Board
The micro remembers the last state of the switch, when the state changes it sends out an HTTP 'GET' request to the webserver to 'isOpen/logger.php?switch=[0|1]'. A switch state of '0' means the hackerspace is closed, a switch state of '1' means the hackerspace is open.
Light Status Codes
- Waiting for response: Both LEDs solid
- Cannot contact the network: Alternating blink of both LEDs
- Cannot reach server: Simultaneous blink of both LEDS
The Web Server
The webserver contains several parts:
- A MySQL database with a 'doorEvents' table.
- The logger.php page which accepts 'get' requests from client.
- The checkStatus.php which polls the database for the current door status.
This is a living log of work that has been completed on the machine.
December 4, 2010 - Started Project
Installed Diavolino & Ethernet shield in the project case (A 2x light switch wall mount w/ one lightswitch). Also did some basic tests with how to configure the Arduino software for the Ethernet Shield. At this point I am planning on having a website poll the arduino for changes to the switch.
December 7, 2010 - Arduino Coding
Followed Craig's suggestion to instead use the Arduino as a web-client and do 'HTTP GET' requests to a php webpage. I was able to get this working, woohoo!
December 11, 2010 - IT WORKS!
Spent several hours working with Craig to get the MySQL database set up along with a series of PHP and HTML webpages that poll the database for changes to the "Hive13 Open Status" in the database. View the live data at: http://www.hive13.org/isOpen
Sometime in 2016 - Re-implemented on ESP8266
Re-wrote the code nearly from scratch. Now works wirelessly and recovers from power loss gracefully.
December 4, 2017 - Updated code finally added to github
Yeah, it took a while. Deal with it.
August 11, 2020 - Rebuilt and rewritten
For reasons best left to the mists of irritation, the switch has now been rebuilt to run on ethernet again, this time powered by POE. The code has been re-written more or less from scratch (admittedly with a bit of copy/paste from the old code). It is now a billion times more responsive, updates the website instantaneously and has several different LED blinking patterns to indicate problems.