Hackerspace Open Switch
|Hackerspace Open Switch|
|Project Location: Column 23AB|
|Where to contribute: https://github.com/Hive13/openswitch|
|Start Date: 12/04/2010|
- 1 Overview
- 2 Project Details
- 3 Gallery
- 4 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 needs to be done
- Refactor the code to use a common MySQL connection setup routine.
- Refactor the code to be more consistent.
- Add a 'stale data' warning to the display page at http://www.hive13.org/isOpen if the switch has not changed states in over 6 hours.
- Figure out a way to grab a webcam image of the person who flipped the switch.
- Tweet the status change to our Twitter account
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
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
- ESP8266 WiFi based microcontroller
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.
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.