Skip to content

Hive13/openswitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 

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. An Arduino Mega with Ethernet Board
             
~~ The Code ~~
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

######### 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

No packages published