Introduction: IOT Final Project- Smart Office

IoT project that will manage (logistically) your office!

there is a lot to take care of when it comes to office management!

someone need to keep track of employees working hours, make sure the lights and all the electric product turned off when no one in the office, make sure that the office secure, etc...

in this project, we tried to solve some of these problems.

this Smart Office IoT project will be able to:

1. monitor employees that entering and leaving the shift

2. Send to the manager salary table

3. Lock the office and notify the manager if something happened outside the working hours.

4. notify if the manager in a meeting currently to avoid interrupt.

5.turn on/off TV/Lights.

Supplies

  • circuit playground express
  • Arduino editor
  • integromat account
  • Remote
  • TV and Lights that turn on/off via IR
  • QR Scan App

Step 1: Workers Working Hours & Mamager's Controll

The main idea at thisstep is to log every entrance and exit of employees for some puproses:

1. workers timeClock - tracking entrance & exit time of workers

2. salary table - the presence log for monthly payment.

how to do it:

first of all you can use the attachment file. but of course we will show the steps.

secondly, you can see the the trigger feature is webhook - as worker get in the office he will enter his i.d to the cpx using control remote.

you can see the full - detail and documented code but the main idea is using cpx to decode the ir remote controll. each digit has different frequency. the worker enter hid id using the remote control and when he's done, the cpx send the id to integromat using blynk to integromat webhook.

1.the excel:

1.1. design the table as follows: date, id, entrance time, exit time for the first table

1.2. for the second table; workers total working hours and salary: id, total working hours, total salary, hour payment per worker.

1.3. third table for indicator (is the office empty or not?).

2. the formulas:

2.1 the presence table is filled automatically (we will see this next)

2.2 the salary table: you need to fill manualy the worker's ids and the per-hour-payment . once you do it, by the formula which we introduce imidiatly, it will done by itself.

2.3 for summing up the total workers' hour we will use these functions: sumif, vlookup and mod. our specific formula is: =(MOD(SUMIF(*the id column*, VLOOKUP(*the worker's id* ,*id column*,1,FALSE),*exit hour*)-SUMIF(*id column*, VLOOKUP(*worker's id*,*id column*,1,FALSE),*entrance hour*),1)*24). i.e we will search the worker at the main table and we will decrease the exit hour from the entrance hour and sum it up. then we will double it by the worker's per-hour payment.

3. integromat:

3.1 the cpx send the id to integromat using webook. and then we have 2 scenarios: the first one it is recognise that the number is worker's id. if it is a new entrance - it will add a new row to the excell. otherwise, if the worker already entered, it will add exit time to exist row. second scenario is that the manager enter a password (like admin password) and then the integromat send the salary table to the manager's email. you need to select the specific rows.

in next steps we will see another uses, like turning on & off the lights.

Step 2: Thieves & Fire Alerts

as we show, after the last worker lock the office using QR code, the office enter "lock" status, that means that the lights & screens turn off and the alert sensors get in work. this is what we are going to show now.

the general idea is to make alert sensor used for two main purposes: theives alert and fire alert.

we divided the scenrios to three different reasons. reason one is when someone turned the light on when the office is locked. reason two is when someone make noise when the office is locked and reason three is when the temperature in the office go above 50 celcius degree (or 130 f. degree) what indices for a fire. if some of these events happen, the manager get an email. ofcourse if you have automatic Fire extinguisher at office you can turn it on.If some of the reasons accure, the cpx send http request using blink using uniqe url, as the attached photo.

we discuss the reasons right now.

1. pure code and cpx

1.1. reason one is when someone turned the light on when the office is locked. if the cpx get light above 20 threshold, it will triger it.

1.2. reason two is when someone make noise when the office is locked. we checked "normal" noises at the office and we find the optimal threshold to be 8, so if someone make louder noise, it will triger the alert.

1.3. as described above, if the temperature at the office going above 50 degrees, it indices that fire accure and alert the boss.

2. integromat

2.1 if one or more of the described scenrios accured, the cpx will send a relevant http request to integromat, using blink. the webhook get from the http request the relevant reason as a unique number as described before. each scenrio trigger the relevant alert to the manager phone using "android - send

Step 3: Lock Office

This feature uses 3 different sensors in order to detect suspicious activity after working hours.

the sensors:

1. light sensor - notifies the manager if the lights turned on after the office was locked.

2. sound sensor - notifies the manager if some noise was made after the office was locked.

3. temperature sensor - if the temperature in the office is high (50 and above- you can change it if you want) the manager gets a notification.

this part built from:

1. CPX code - attached (in the code "main.ino"- read the request that came to virtual pin number 0 lines 65-75).

2. integromat scenario: as you can see in the pictures (attached), the scenario built from webhook and HTTP request maker.

In order to lock the office and activate these scenarios, you will need to scan a QR code.

QR code: go to https://www.the-qrcode-generator.com/ > click URL > insert the webhook URL that you got from integromat > a QR code will be generated > save it, print it, and attach it to your wallet/phone/keys.

Step 4: Unlock Office

Great you did it, another day at the Office!

now you need to unlock the office, don't worry the device will know if you are at the door,

if your phone connected to the office wifi the office will unlock. (you can easily change it to be a location-based service)

this part required:

1. CPX code- attached (in the code "main.ino" - read the requests on virtual pin number 9 lines 78-88).

2. integromat scenario- built from an android component that connected to your phone and HTTP request maker that will send the request to virtual pin number 9

Step 5: Check Manager Availability

This step main to check the manager's availability.

Using integromat, we use ten thousand request and delay every request for one minute, what enable us to verify through whole week if the manager available. It is done by check the manager google calendar if there is any meeting at the moment. If there is any meeting, we use http request to cpx using blink for enlight the cpx lights to be red, what indices the workers do not disturb. Otherwise, the lights enlight green.

Step 6: Turn On&off Lights and Screens

Now it's time to go home, and we want to make sure we save earth (and

money), so we want to turn off screens and office's lights.

First of all we decode the screen remote control and lights IR frequenct code. After we have these codes, we use integromat to check the "office is empty" indicator. As shown at step one, we have this indicator that shows 1 if one or more workers entered the office and havn't exit yet. Else, if all workers went home and exit the office, we make the cpx send the electronics devices IR for turning off them.

Of course we can do it at morning. When the first employee come to office, the cpx turn all lights and screens on.

Step 7: Code Resources and Video