


SeatTrack
Seat Occupancy Tracker
Project
For the 2023 IoT group assignement, we were asked to develop an IoT system that tracks whether someone sits on or gets up from a chair.
The system is very flexible and can therefore serve numerous purposes. One of these purposes is a presence tracker within a classroom.
As the number of students joining classrooms increases every year, it has become more and more difficult and time consuming for teachers to take roll in younger classrooms. This prototype helps ease this issue by giving the teacher a simple and quick way to identify the number of students in the classroom.

How it Works
This system operates by incorporating pressure mats (simulated by push buttons for the purpose of this assignment) on each chair, connected to a sensing node. It manages pressure values and sends them to the bridge node, responsible for overseeing all sensing nodes in the system through ESP-Now communication. The bridge node transmits real-time occupancy data for each chair to a gateway, and then, via MQTT, to an MQTT Client. These data are then visualised on a Node-RED Dashboard.
The main problem being addressed is the demand for a non-intrusive and energy-efficient solution for monitoring chair occupancy. This technology and system can have versatile applications across different scenarios:

Smart Meeting Rooms and Classrooms for Automated Attendance
In modern educational and corporate settings, the task of attendance-taking has become increasingly cumbersome for educators and managers, especially in classrooms with younger students and companies that allow remote work. Our prototype addresses this challenge by streamlining the process. It provides a quick and efficient method for teachers or managers to ascertain the precise number of students or employees present in the classroom or at the meeting. This system automates roll call, saving valuable teaching time and reducing administrative overhead.

Smart Seat Monitoring for Efficient Maintenance Scheduling
Libraries and classrooms are communal spaces that require regular maintenance to ensure a clean and conducive environment for learning. The smart seat monitoring system serves as a tool to inform maintenance staff about the optimal times for cleaning based on actual usage patterns. By tracking occupancy, the system can trigger notifications to maintenance agents when the space has been vacated, enabling timely and efficient cleaning operations that align with the ebb and flow of student occupancy, thereby maintaining the cleanliness and readiness of learning spaces.

Event Occupancy Tracking for Enhanced Venue Management
For match events, there is often a disparity between the number of tickets sold and the actual attendance. This smart seat monitoring system is designed to bridge this information gap by providing real-time data on the actual occupancy of the event. This allows for more accurate crowd management and resource allocation, ensuring that services such as security, concessions, and facilities are appropriately scaled to the audience size. This data can also offer insights for future event planning, such as optimizing ticket sales and pricing strategies to reflect true attendance trends.
Hardware
Multiple components were used for this project...

3 different ESP8266 microcontrollers to act as both bridge node and sensing nodes. ESP8266 offers a highly integrated Wi-Fi System on Chip (SoC) solution, suitable for the ever-evolving demands of the Internet of Things (IoT) industry. It features efficient power management, sleek and compact design, and unwavering performance, ensuring reliable IoT applications.

For this prototype, the pressure mats are replaced by simple buttons to simulate the binary signal of sitting down and stand uo from a chair.


We also use 10kΩ resistors alongside the buttons.
Overall Design and Wiring

Sensing Node

Bridge Node


Battery
You may want to consider getting your hands on our most recommended battery:
LiFePO4
-
Direct voltage compatibility:
-
LiFePO4: 3.0V - 3.2V
-
ESP8266: 2.58V - 3.6V
-
allowing direct connection without needing
an extra voltage regulator and ensuring safe operation
-
High capacity and longevity:
Up to 6 000 mAh capacity ensuring longer runtime, especially for power-saving modes
-
Output:
Their flat discharge curve provides consistent voltage (critical for the stable operation of the ESP8266)
-
Safety and durability:
LiFePO4 batteries are safer and more durable than other lithium-ion batteries, with up to 5000 charge/discharge cycles and less risk of thermal issues.
-
Simplified design:
No need for a separate voltage regulator with the NodeMCU, simplifying the setup.
For more information, and purchases: https://www.evlithium.com/hot-lithium-battery/32650-32700-lifepo4-battery-cell.html
In contrast, alternatives like LiPo, Li-ion, NiMH, or alkaline batteries may require additional voltage regulation or may not match the ESP8266's voltage needs as effectively.

Future Additions

An enclosure design can be quite handy for installaton and ease of hanling when installing onto chairs.

Sofware
The Arduino code can be found here.
Software Architecture
Sensing Nodes:
- Code handling button press/release events and ESP-Now communication
- Implementation of sleeping modes to maximize battery life
- Third-party libraries: ESP8266 Arduino Core, ESP-Now library
Bridge Node:
- Serial communication with the gateway and ESP-Now communication with sensing nodes
- Power management logic
- Third-party libraries: ESP8266 Arduino Core, ESP-Now, JSON, MQTT messaging
Gateway:
- MQTT client code to interact with the sensor network (Node-RED flow)
- Serial communication interface for communication with the bridge node.
- Third-party libraries: MQTT and Node-RED (node-red, node-red-dashboard)
Setting everything up...
1. Sensing nodes
-
Connect the push button to the ESP8266
-
Upload sensing node code to the microcontroller and update the configuration to match your environment
-
Connect the necessary battery the ESP8266
2. Bridge node
-
Upload bridge node code to ESP8266 and update the configuration to match your environment
-
Connect the bridge node to the laptop via USB for the serial communication
3. Gateway
-
Install Node-RED software on the laptop
-
Install MQTT client software on the laptop (not necessary in our case but could be better for security purpose)
4. Using the system
-
Receive MQTT notifications for chair occupancy from Node-RED dashboard
-
From the dashboard, possibility to enable/disable the sensor network, change the interval and deep sleep rate and check the occupancy of the room
Tests
Various tests of the system's operating conditions were carried out to test the overall performances of the system. The video at the end shows that the standard functionalities of the system worked as expected.
Unit tests
Each component (sensing nodes, bridge node and gateway) was successful in individual testing
Button press/release events, ESP-Now communication and MQTT messaging were also verified
Integration tests
Communication between sensing nodes and the bridge was checked
Proper interaction between the bridge and the gateway was ensured
Reflection
Two major problems were faced...
Power Consumption
Solution: Implemented various sleeping modes for ESP8266 to conserve battery and adapt them to the environment (change the deep sleep interval, possibility to disabled the whole network).
Communication Reliability
Solution: Fine-tuned ESP-Now parameters and ensured error handling in the code.
Future Work
This project has resulted in a very early prototype with some basic but interesting functionalities. Its overall robustness give it enormous development potential.
Improvements
Developping a complete and user-friendly mobile application for easier system control could prove easier to use and access than a Node Red Dashboard.
One more important feature that can be added is the additional integration with other IoT devices such as smart devices like lights and even speakers or smart systems. This functionnality, if implemented, can widen the use cases of the device with the added bonus of saving money.
System performance
Some tests still need to be carried out. These include measuring the battery life expectancy of the sensing nodes and assessing the overall reliability of the system in different scenarios.