Low Power, City-Wide Occupancy Sensing


This project will use a small doorframe-mounted sensor to count the number of people entering or exiting a room threshold with a high degree of accuracy. The device will operate on battery power for more than a year, processing data from a grid-array of infrared sensors and transmitting it for display to our cloud service through the LoRa low-power wide area network.


Most modern occupancy sensing systems require expensive infrastructure such as connected power or local WiFi. It is prohibitively expensive to route power to arbitrary points in a building, so battery-powered solutions are desirable.

With our device, occupancy in a building or room could be monitored for more than a year on a D-cell batteries. Additionally, no local WiFi infrastructure will be necessary as the sensor system transmits data to a user-facing website interface using the LoRaWAN protocol.

Competitive Analysis


CountWise systems uses video and image processing technology to count people moving through a space. While this is more general than our approach and can be applied in a greater variety of locations, it is much more power-intensive.


Irisys has sophisticated people-counting products, capable of covering large door spaces. Unlike our product, though, it requires both power and ethernet connectivity.


Rita was another capstone project built last year. They used accelerometers placed in chairs that took readings and transmitted data every 30 minutes to detect whether seats were occupied. We intend our system to provide updates at a faster rate as well as use a much smaller number of devices to monitor a space.



  • perm_identity Build a device that is capable of sensing the occupancy of a room by placing it at its entrance.
  • power_settings_new The device should be battery-powered, running on D-cell or AA size batteries.
  • settings_input_antenna The device should be able to transmit that information over a network and communicate the occupancy of the room to a central server.
  • web The occupancy information should be displayed through a front-end service such as a web interface.


  • repeat The device needs to be able to run without battery replacement for at least 1 year, preferably 2.
  • assessment The device should be at least 80% accurate in determining the occupancy of a room.
  • shopping_cart The device should have a manufacturing cost of no more than $90 at scale.
  • search The user interface should allow users to easily add/remove devices and identify the device's approximate location.

Technical Specifications

Hardware Components

Part Name Details Vendor Cost
Atmel SAM L21E Ultra low-power 32-bit microcontroller. 256KB Flash, 30KB SRAM, 48 MHz clock speed. Digikey $4.64
Microchip RN2903 LoRaWAN module, controllable over UART. Contains its own small MCU. Digikey $14.70
916MHZ Antennae Antenna for use with the LoRaWAN module. Digikey $10.39
Grid-Eye Infrared Sensor Low-power grid of sensors that generates an 8x8 IR image. Capable of sampling up to 10 Hz Digikey $22.16
Panasonic IR sensor Low-power passive IR motion detector Mouser $19.79
Switching Transistor Low resistance transistor to switch power to sensors Mouser $0.61
Assorted SMD resistors & capacitors Various filtering caps and pull-up resistors Mouser/ Digikey ~$2.00

Software Components

Component Name Description Vendor
Django Web Framework The Django framework will be used to implement the cloud service API that will receive data from the LoRaWAN network and serve it to our front-end interface. We will be using Python 3.6 and Django 1.10 Django Software Foundation
React The React library will be used to create a dynamic front-end user interface. Facebook Open Source
Let's Encrypt Let's Encrypt's certificate authority and software tools will be used to securely transmit data over SSL/TLS. Internet Security Research Group
Custom Atmel SAM Firmware We will utilize Atmel software libraries and write C code to implement custom firmware on our device. Microchip


Protocol Name Usage
LoRaWAN Our device will transmit data through the LoRaWAN backbone to our internet service.
UART Our SAM microcontroller will send commands to the LoRa module over UART.
I2C Our SAM microcontroller will send commands to and read data from the Grid-EYE sensor using I2C

Use Cases

Environmental control

If an organization can better understand where people are in a building, it can more effectively control the HVAC systems in order to manage energy consumption.

Real-time occupancy

If we know how many people are in a room/building, we can present that data to the public through a web interface. This could be used to determine whether a shared space like a library or workout space is too crowded.


This diagram gives a high level overview of the architecture of our sensor system. The "brain" is the Atmel SAM L21E microcontroller, a low-power chip that can drive each of our other components. When motion is detected by the PIR sensor, it will send an interrupt to the SAM chip in order to wake it up from deep sleep. The GridEye infrared camera generates an 8x8 grid of IR pixels at 10 frames per second, sent over I2C back to the microcontroller. All processing is done on-chip, so the only data transmitted through the RN2903 LoRa transceiver are the changes in occupancy.


Sensor Wakeup

This interaction diagram details the process of waking up the chip to detect a person entering/exiting a room. Most of the time, our MCU will be in a deep sleep running only the PIR sensor. Upon detecting motion in the area, the PIR device will trigger a wakeup for the MCU and then the Grideye. The microcontroller will then begin to sample the Grideye data at 10 FPS, interpreting the 8x8 heatmap as a number of people entering-exiting. Once motion has subsided, the chip will return to the deep sleep state.

Data Flow

The data flow interaction diagram is fairly self-explanatory. The MCU will wakeup on a configurable interval and transmit the change in occupancy it has seen since the last transmission. Sending essentially 1 byte allows us to minimize the transmission time and reduce power consumption.

The LoRaWAN infrastructure set up by the CMU WiSE Lab exposes data sent by clients through an MQTT service. We run a daemon client on our webserver that will automatically subscribe to the data queues of each device setup with our service. Upon receipt of a sensor update, the server persists the change to the database and updates related values.

About Us

Terence Sun

Terence is in charge of implementing the core firmware and sensor manager platform.

Jacob Brooks

Jacob is the PCB hardware engineer as well as the cloud service lead.

Udaya Malik

Udaya is responsible for implementing the people-counting algorithm and the Grideye driver.

Preetam Amancharla

Preetam is managing the implementation of the LoRa firmware driver as well as providing assistance and QA for the sensor analysis.