Skip to content

drewterry/evacuation-occupation-sensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

evacutation-occupation-sensor

A remote occupancy sensor for the single bathroom stall in a large office.

This solution leverages a battery powered Espruino MDBT42Q and a RaspberryPi 3 loaded with EspruinoHub to broadcast BLE sensor data via MQTT and serve a static dashboard page.

Setup

Follow the installation instructions for EspruinoHub on a Raspberry Pi 3.

Update config.json with the MDBT42Q address and put it in ~/pi/EspruinoHub.

Open the Espruino IDE at http://RASPBERRY_PI_IP:1888/ide. Load MDBT42Q.js to the MDBT42Q and run save().

Navigate to http://RASPBERRY_PI_IP:1888/mqtt to verify MQTT broadcast.

Navigate to http://RASPBERRY_PI_IP:1888/bathroom to view the bathroom status.

Hardware

Espruino MDBT42Q

MDBT42Q Image

Raspberry Pi 3

RPi3

Adafruit 500 mAh LiPo Battery Adafruit LiPo Charger Sparkfun Tilt Sensor Slide Switch

System Design

Whiteboard image of system

Software

An excellent bridging solution to serve BLE advertising data via MQTT. This lives on the Raspberry Pi 3 and serves the following topics:

/ble/advertise/stall-monitor-men/l  // Lock Status
/ble/advertise/stall-monitor-men/d  // Previous State Duration (sec)
/ble/advertise/stall-monitor-men/battery // Battery Status (Percentage based on max voltage of 3.3V and min voltage of 2.5V)
/ble/advertise/stall-monitor-men/rssi // RSSI

Espruino IDE

The BLE sensor itself runs Javascript, with a number of libraries built in for GPIO and BLE control. See the sensor code in MDBT42Q.js.

The code uses setWatch and NRF.setLowPowerConnection to maximize battery life.

Dashboard

Case Design

The case was designed in AutoDesk Fusion 360, and printed on a MakerBot Replicator 2. Design files can be found in /case

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published