forked from Hive13/openswitch
Code for the Hackerspace Open // Closed switch.
MxBlinkPx/openswitch
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The 'Door Switch' or 'Is the Hackerspace Open?' switch has two main software components: 1. The microcontroller client code. 2. The webserver database and webpages. ######### 1. The Microcontroller ######## ~~ The electrical components ~~ 1. A standard lightswitch 2. Diavolino, an Arduino clone -( http://www.evilmadscientist.com/article.php/diavolino ) 3. An Arduino Ethernet Shield -( http://www.arduino.cc/en/Main/ArduinoEthernetShield ) - *note* The linked version is lightly newer, current version does not have the Micro-SD card adaptor. ~~ The Code ~~ The code is based off of the Arduino Ethernet Shield example code for a web client. 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. ~~ Known Issues ~~ ----- Issue 1 ------ After power cycling the switch (aka, the arduino w/ Ethernet shield) the ethernet shield will fail to connect to the network. This is apparently a known issue with the ethernet shield and is related to it not getting enough juice on startup. A couple suggested fixes are as follows: 1. Add a 200 ms sleep into the "setup()" function to reduice initial power requirements of the 3.3v line. I am not sure how well this would work. 2. Add a resistor & capacitor to the "reset" pin of the ethernet shield, this also seems to work by disabling the shield until enough power is available to charge the capacitor and it then provides a bit more stability on the 3.3v line. *. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225354009/15 - TODO: Make a GitHub issue related to this issue ----- Issue 2 ------ We should add a feature to somehow alert a user if the "http get" connection fails repeatedly. Maybe we should also attempt to ping an address that absolutely should exist, aka 192.168.1.1 or 8.8.8.8. If we can contact 192.x then the internal network is good, if we can hit 8.8.8.8 then the internet connection is good. ######### 2. The Webserver ######## The webserver contains several parts: 1. A MySQL database with a 'doorEvents' table. 2. The logger.php page which accepts 'get' requests from client. 3. The checkStatus.php which polls the database for the current door status. 4. An index.html which uses javascript to refresh the icon when the status changes.
About
Code for the Hackerspace Open // Closed switch.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Other 39.6%
- C 28.2%
- PHP 20.1%
- C++ 12.1%