Skip to content

Arduino sketch for wifi-enabled PIR sensor, with a NodeJS backend and websockets-enabled single-page webapp.

License

Notifications You must be signed in to change notification settings

dalgleish/vacancy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VACANCY

Real-time notification of room occupancy, using a wifi-enabled microcontroller and PIR sensor and a NodeJS-powered websockets-enabled Web Application.

Hardware

Tested with the following:

Wiring diagram

TODO

Firmware

Requires Arduino software app/

You must change the following variables in app/sketch/sketch.ino

// The IP address of the server
// Unfortunately, DNS is not supported
uint8 ip[] = { 192,168,1,3 };

// The port the server is listening on
int port = 8081;

// The local IP assigned tp the device (this may not be needed)
// Unfortunately, DHCP is not supported
unsigned char local_ip[] = { 192,168,1,2 };

// The IP of the router or gateway on the local network
unsigned char gateway_ip[] = { 192,168,1,1 };

// Subnet mask for local network
unsigned char subnet_mask[] = { 255,255,255,0 };

// Wifi network name
// NOTE: Only 802.11b is supported
const prog_char ssid[] PROGMEM = { "YOUR_NETWORK_SSID" };

// Network security
// OPEN: 0 | WEP: 1 | WPA: 2 | WPA2: 3
unsigned char security_type = 3;

// WPA/WPA2 passphrase
const prog_char security_passphrase[] PROGMEM = { "YOUR_NETWORK_KEY" };

// Access point network (usual): 1
// Adhoc network: 2
unsigned char wireless_mode = 1;

Server

server/

Running the server requires NodeJS.

Change to the server directory cd server

Just once, install modules. npm install

Start the server node app.js

Server runs on port 8081. It listens for POST /:room requests from the Arduino. Also, it serves the web application from server/public. Currently this is a single page app: GET localhost:8081 will serve server/public/index.html.

Web Application

server/public

Uses Twitter bootstrap, jQuery & socket.io.

Notes

Andrew's Macbook IP: 10.128.0.224 MAC: 28:cf:e9:20:3c:eb

CuHead Wifi IP: 10.128.0.181 MAC: 00:1e:c0:04:ca:e1

To change OSX MAC
sudo ifconfig en0 ether XX:XX:XX:XX:XX:XX

About

Arduino sketch for wifi-enabled PIR sensor, with a NodeJS backend and websockets-enabled single-page webapp.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published