Skip to content

panjanek/RpiDoorSensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RpiDoorSensor

Door sensor web application for Raspberry Pi

Typical setup

Raspberry Pi runs nodejs web application serving a web page with information if the door is open (for example busy office toilet door). Toilet door state is sensed with reed switch or simple switch mounted to the door connected to GPIO. Optionally, RGB LED drived with three GPIO pins shows the current sensor state.

Wiring

alt tag

How it works

Node application monitors state of S1 switch connected to GPIO using shell command 'gpio'. Each change of switch state is broadcasted using websockets to client browsers. "Reserve" button allows to broadcast intention of visiting toilet.

How it looks

After starting nodejs web application this is how the web interface looks like:

free occupied reserved
alt tag alt tag alt tag

Installation

  1. Setup Raspberry Pi with Raspian

  2. Upgrade nodejs to 4.0.0 or later

  3. Perform following commands in raspberry pi home folder (/home/pi/):

git clone https://github.com/panjanek/RpiDoorSensor.git cd RpiDoorSensor npm install


4. Run the application

sudo nodejs app.js


5. In order to start the application at boot: 

chmod +x doorstart.sh sudo contab -e

   Add the following line in editor:

@reboot /home/pi/RpiDoorSensor/doorstart.sh &

   Save and exit. After reboot the nodejs application will run forever.

About

Door sensor web application for Raspberry Pi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published