Automated Room Occupancy Counter

This is a github repository for Hack Illinois 2016.
The site for this project is live at Total time spent: 18 Hours


The goal of this project is to provide an automated occupancy count of a building or room that can be accessed wirelessly through a website.

Real World Application

The principle idea is to be able to detect and track the number of people entering and leaving a room in a given building (for now, the building of choice is ECEB). This tracker device would be placed in all rooms in the building. The number of people present in each given room would be sent to a website and displayed for everyone to see. The website will eventually include floor maps for the building with the number of people within the room. For the future, all buildings on the University of Illinois campus would be included on the website, giving a bigger scope for the student. This would allow students to have a live feed for any available study rooms in the buildings of their choice. Something similar is present for EWS stations but those are very limited.
If this device was installed in each room of every building on campus, the data of the device could be used to visualize the occupancy patterns of buildings on campus...down to a single room. Architects could use this data to improve the efficiency and designs of their buildings, Now that is awesome!

Materials Used

  1. Intel Edison Board
  2. Grove Base Shield v2
  3. Flex Sensor
  4. Touch Sensor
  5. LEDs for Debugging
  6. Website with cPanel
  7. We used PhP, jQuery, and MySQL

How it Works

It uses the flex sensor and touch sensor to signal an HTTP request to the server. The flex sensor would be placed at the hinge of the door and the touch sensor would be placed on the inside handle of the door. Using this simple if statement we determine whether or not a person leaves or enters the room:

  if(flexSensor > 300){
      currentOccupancy += -1;
    } else {
      currentOccupancy += 1;

The website then refreshes on user input to display the updated value of occupancies.

Problems Encountered During Development (It was a frustrating hack)

Everything... jk. But really... we were not familiar with the Edison board and Grove Base Shield v2 so that slowed us down at the beginning of development. After we got basic functionalities like shining an LED using a touch sensor to work, we moved on to sending a POST request to the website that we made. Implementing the POST request was by far the most difficult part of the project because we were not familiar with HTTP requests using Arduino software. We spent 11 hours getting the Edison board to send an HTTP request to our database that would update the occupancy of the respective building/room. Some underlying issues turned out to be stating "Content-Type: " of POST request, figuring out the process of Arduino HTTP requests, and debugging the website POST .php file. After we got the HTTP requests to work, moving forward was much easier as the last things to do were to hook up the sensors, code them accordingly and make the refresh button function. One issue that we ran into in the last portion of the development was finding out that two touch sensor readings in the same void loop() broke the Arduino code.


Future Development

  1. Interactive map
  2. Motion Sensors for more data reading to determine change of occupancy
  3. Compensating for inaccurate readings
  4. Example: Someone inside a room opens the door for someone outside the room should increase occupancy but the current code will decrease the occupancy count.


  • Harsh Modhera (hmodhe2)
  • Daniel Zhang (dzhang54)
  • Dylan Huang (dphuang2)
Share this project: