Skip to content

Building management system with dashboard and hardware for monitoring and controlling

License

Notifications You must be signed in to change notification settings

peterokwara/BuildingManagement

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

Building Management System

This project seeks to demonstrate the use of MQTT protocol and MERN stack for building an IoT Building Management System for commercial usage, where parameters such as building occupancy, energy demand, andenergy consumption are measured and displayed on an online database and dashboard.

A more detailed description of the project can be found here.

Video example

A video of the project working (hardware)

board setup of the building management system

A video of the project working (software)

video of the dashboard

Dashboard

You can access the dashboard after you sign up here

Hardware setup

Esp & Current sensor

Circuit design

Board design and the final look

Esp & Dht sensor

Circuit design

Board design and the final look

Esp & Motion sensor

Circuit design

Board design and the final look

Esp & Relay

Circuit design

Board design and the final look

Installation

Esp

Installing in an ESP8266-01 and NodeMCU involves pushing the python files into the device whether it's via a usb to ttl or just a usb cable. This can be done using the command

sudo ampy --port /dev/ttyUSB0 --baud 115200 put main.py
sudo ampy --port /dev/ttyUSB0 --baud 115200 put config.py
sudo ampy --port /dev/ttyUSB0 --baud 115200 put connectWifi.py

You need to create a config.py file with the following information for each and every esp folder (current-sensor, dht-sensor, motion-sensor, relay-bulb, relay-fan)

MQTT_CONFIG = {
    'SENSOR_ID': '',
    'MQTT_HOST': '',
    'PORT': '',
    'PUB_TOPIC': ''
}

WIFI_CONFIG = {
    'WIFI_ESSID': '',
    'WIFI_PASSWORD': ''
}

Raspberry Pi

To install npm packages used for the Raspberry Pi, you run.

npm install axios mongoose mqtt

You also need to create a config folder and have two files that contain config/broker.js

module.exports = {
  brokerUrl: ""
};

and config/server.js

module.exports = {
  serverUrl: ""
};

Server

To install npm packages used for the server, you run.

npm install axios bcryptjs body-parser concurrently cors express gravatar jsonwebtoken mongoose mqtt passport passport-jwt recharts validator

You also need to have a config/keys_dev.js with the configuration above. The mongoUri and secretOrKey are obtained when you create a mongodb on https://mlab.com the database I used.

module.exports = {
  mongoUri: "",
  secretOrKey: ""
};

Client

To install npm packages used for the client, you run.

npm install jwt-decode axios react-redux redux recharts redux-thunk semantic-ui-css semantic-ui-react

Usage

Raspberry Pi

To run the code for Raspberry Pi just cd into the folder and run

node app.js

To ensure that the Raspberry Pi runs the code whenever it boots, edit the rc.local file

sudo nano /etc/rc.local

and add

node app.js &

Website (server and client)

To run a local development of the website, all you need to do is to do the installation setup then once that is done

cd site && npm run dev

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT