Seats Available, Come Study Here!

Tiancheng Zhao, Hongrui Yu, Mingyang Cong, Lijing Tu

Video link:

Introduction

This project is a pilot study of school studying space occupancy management system. It aims to detect the occupancy condition is a confined space. There are 2 parallel sensing systems were applied in this project. First, CO2  sensor is used to detect the indoor CO2 concentration. Because CO2 sensor always affected by time delay, PIR sensor and air pressure were applied as a validation method. The second sensing system (PIR + air pressure) detects the instance occupancy movement. A website were created to display the occupancy condition. If the space is fully occupied, it also allows users to submit their email to receive notification when space is available.

Motivation

School library and department lounges are always packed with students. However, the seats are limited. Everyone has the experience that spend a lot of time in finding seats but still need to study at home. At that time, it would be great to have someone or something to tell us where we can find an available seat. This project is aiming to solve this problem using sensor to detect the occupancy condition and return the result to the user.

Goals

The ultimate goal is to record the number of people studying in the library, and then upload this information to the website. When students visit our website, they can know not only whether there are seats available but also how many seats are available. And if seats are not available, so long as students subscribe our website, they can receive email notifications when seats are available.


For Progress Report

Current Progress

Current Progress

  1. The first sensing system (Carbon Dioxide Concentration)

We purchased MH-Z14A NDIR Infrared Carbon Dioxide Sensor Module from Amazon this Thursday (26th Sep), but there is something wrong during shipping and we have to wait for the purchased sensor come latter. However, we already learned about the physical principles of this sensor which utilizes non-dispersive infrared (NDIR) principle to detect the concentration of CO2 in the air. We also found the python code for this sensor.

  1. The second sensing system (Air Pressure and PIR Motion)

We chose BMP 180 Digital Barometric Pressure Sensor Module to detect the air pressure, which also measures the temperature and altitude. And HC-SR501 Infrared PIR Motion Sensor Module were selected to detect the motion.

By using the BMP180 sensor, the air pressure could be measured via I2C bus.  We first configured the Raspberry Pi to use I2C, then built the circuit and modified the code provided by osoyoo.com to read the sensor outputs. The installed circuit is shown in Figure 1.1(a) and the results of the trial run are shown in Figure 1.1(b).

A close up of a device

Description automatically generated

Figure 1.1 (a) Finished BMP180 circuit

 A screenshot of a social media post

Description automatically generated

Figure 1.1(b) Results for the trial run of BMP180

In terms of the sensing of PIR motion, this sensor is designed to detect the infrared radiation so as to prove the passing by of a warm body like human or animal. We modified the code provided by osoyoo.com to count the number of ‘someone is coming’ and established the circuit. The results are shown in Figure 1.2(a) and 1.2(b).

A close up of a device

Description automatically generated

Figure 1.2 (a) Finished HC-SR501 circuit

A screenshot of a social media post

Description automatically generated

Figure 1.2(b) Results for the trial run of HC-SR501

  1. Algorithm designed

Our simple algorithm design is shown in Figure 1.3. For the time delay occupancy detection, the concentration of carbon dioxide will be used to evaluate the number of people; and for the instance occupancy detection, if the air pressure sensor reacts before the PIR infrared sensor, there is someone coming in, and vice versa. As a result, the combination of two system imply the occupancy condition.

A close up of text on a white background

Description automatically generated

Figure 1.3 Algorithm Design

 

  1. Learned / solved outside of this course

For this project, we need to learn how to modify and debug the code based on our situation, for example, adjusted the GPIO corresponding to the “input” in code. And until now, we solved the configuration of Raspberry Pi to use I2C and learned the physical principles of the sensors which we used.

Problems Encountered

 

1. Coding and errors from given codes

 

1)    Due to deficiency in programming, we focused on understanding and imitating the example codes from sensor manuals instead of composing acquisition code from scratch. However, since the given code were written in python 2 but raspberry pi used python 3, we spent some time in debugging the syntax and type errors in the script.

2)    Nonetheless, when testing the second branch in our parallel circuit, the one with air pressure sensor, we ran into “OSError”. According to several online forum [1] [2] [3], we decided the reason was from hardware and wiring side. Thus, in the next meeting, we will inspect our RPi setup, blinka install and library, and run “ic2 detect”.

Figure 2.1OSError” for barometer code

2. Data input channel:Example code in tutorial used GPIO 17 as input channel and addressed in wiring. However, we only changed output to people counting but ignored input channel definition. After fully understanding the codes, we modified the input to the GPIO 18 to correspond with circuit used.

 

3. Lag of PIR motion sensor and its resolution: As specified in PIR sensor manual [4], PIR could be used to detect both object coming closer and moving away. For now, we could not separate the detection of approaching or departing. In the next step, we will use a Relay in the circuit to differentiate detection motion in two different directions. Also, since the minimum range can be detected is 3 meters, we would need to place the sensor to higher positions and combine the use of air pressure sensor.

4. Preliminary literature research directed us to use the CO2 concentration as metric for number of occupants. When discussing the algorithm design, however, we need to firstly be aware of the ventilation rate in the room and use both real-time concentration and concentration change rate as metric for people to eliminate the accumulation of CO2 within small and unventilated space. In this way, we might need to store certain data. How to reduce storage size yet provide useful information has been discussed but not solved.

5. Sensor delivery uncertainty. After negotiating with customer service, our CO2 sensor, scheduled to be delivered Saturday was postponed to Monday with little confidence from customer service. We will follow this up.

 

Future Plan

1.     Connect all the sensors to Raspberry PI and finish the coding related to all sensors.

2.     Collect some data to test the sensors and calibrate them, so that they can obtain useful and accurate information through measurements.

3.     Modify our model so that it can achieve a decent performance even with some noise. Right now, there is one kind of noise that our model cannot handle.

4.     Collect some data to further calibrate our model so that the output of our model matches our expectations.

5.     Build our website to record and display the information we collected.


Methodology

Phenomena of Interest

      Describe the physical phenomena of interest, e.g. physical principles, static and dynamic behavior, and signal characteristics

Sensor(s) Used

      Describe the sensor(s) you used, e.g. physical principles, static and dynamic behavior, and signal characteristics

Signal Conditioning and Processing

      Describe the signal conditioning and processing procedures


Experiments and Results

      Describe the experiments you did and present the results; Use tables and plots if possible


Discussion

      Discuss the insights from the project

 

 

Reference:

[1] https://github.com/adafruit/Adafruit_CircuitPython_VEML6075/issues/4

[2] https://github.com/PiSupply/PaPiRus/issues/124

[3] https://www.raspberrypi.org/forums/viewtopic.php?t=191300

[4] http://kookye.com/2018/11/06/arduino-lesson-pir-motion-sensor/