Skip to content
OnlyProjects
B.Tech / B.E. · Electronics & CommunicationFor educational purposes only
Code included

Classroom Occupancy Counter with Live Display using IR Sensors (Arduino, Python)

Two IR sensors at the door count students in and out, an LCD shows live occupancy, and a Python logger archives every entry

Mapped to your syllabusAnna University Regulation 2021 · EC3811 Project Work / Internship · Semester 8

Overview

1 min read

Classroom Occupancy Counter with Live Display is a deliberately scoped, fully buildable mini-project that answers a question every department asks: how many people are inside that room right now? Labs are capped by bench strength, exam halls by seating, and reading halls by safety norms — yet the number on duty is maintained by guesswork or a register nobody updates.

The unit mounts two IR reflective sensor modules across the door frame, a few centimetres apart. An Arduino Uno watches the two beams; because a person entering breaks the outer beam before the inner one, and a person leaving breaks them in the reverse order, the firmware's small state machine decides direction from the sequence of beam breaks, not from a single trip — so it can tell entering from leaving. A 16x2 I2C LCD by the door shows OCC 47/60 in real time; when the count reaches the room's capacity, a buzzer and red LED signal that the room is full, and a green LED marks safe occupancy. Every entry and exit event is sent over USB serial to a Python (pyserial) logger that timestamps it with the PC clock and appends to a CSV file; a small report script summarises a week's footfall per classroom.

The engineering is honest and achievable: sensor tuning, debounce timing, an order-detecting state machine, non-volatile count storage, and a documented walk-trial that measures how accurate the unit really is. Everything uses parts already sitting in most college component stores.

Relevant for
Tamil Nadu
Level
Beginner · 12 weeks · team of 3
Common at
Anna University, Chennai, Visvesvaraya Technological University, Jawaharlal Nehru Technological University Hyderabad
Updated
Nov 2026

Syllabus alignment

Anna University · Regulation 2021

EC3811 · Project Work / Internship · Semester 8 · 10 credits

Subjects this project applies
  • C programming (Arduino firmware)
  • Python (serial data logger and weekly report script)
  • Microcontroller laboratory (digital sensor interfacing, I2C)
How it is evaluated

report (problem, literature, methodology, results, conclusion) + viva-voce by panel of examiners

Also fits: VTU 2022 Scheme (OBE/CBCS), JNTUH R22.

What's in the box

11 parts · 5 free · 2 previewed · 4 unlock for ₹2,000

Problem & synopsis

5 min read

Problem statement

College departments enforce occupancy limits — bench strength in labs, seating in exam halls, safety limits in reading rooms — using a door register and occasional manual headcounts. The count is never current, staff cannot see when a room is over capacity without walking to it, there is no record of room usage patterns, and power cuts or forgetting to update the register silently destroy whatever accuracy it had. There is no budget for commercial people-counting systems, and camera-based counting raises privacy objections in hostels and classrooms.

There is a need for a simple, low-cost, privacy-free occupancy unit that counts people through a single door with plain IR sensors, distinguishes entering from leaving, shows the live occupancy against the room's rated capacity where everyone can see it, alarms the moment the room is full, and keeps a timestamped log that a department can review at the end of the week.

Synopsis

Abstract

Departments cap lab, library and exam-hall occupancy but have no live way to enforce or observe it. This project builds a door-mounted counter that detects each person with a pair of IR reflective sensors, decides direction from the order in which the two beams are broken, displays live occupancy against capacity on an LCD, alarms at full capacity, and logs every event to CSV via a Python serial logger. A one-week classroom trial measured counting accuracy and documented the failure cases.

Introduction

A typical department runs 10–20 rooms with rated capacities between 30 and 120. The existing controls are manual: a register at the lab door that is filled in for the first batch and forgotten, an invigilator counting heads twice during an exam, and no data at all for library or reading-hall usage. When the HOD asks "how many students were in Lab 204 during the 11 o'clock hour?", nobody can answer. The unit in this project makes that answer a glance at a screen outside the door.

Existing System

  • A paper register or a warden's rough headcount, updated irregularly; the number drifts from reality within an hour.
  • Overflow situations (extra students in a lab session) are discovered only when a supervisor happens to visit.
  • Limitations: no live number, no history, no alarm, and no evidence to settle disputes about batch sizes or lab usage hours.

Proposed System

  • Sensing: two IR reflective modules across the door frame, 12 cm apart, tuned with their onboard potentiometers to trip at about 25 cm.
  • Direction logic: a five-state firmware state machine (idle → outer → both → inner → commit) interprets the beam-break order; a 600 ms inactivity timeout returns it to idle so a half-detected passage never corrupts the count.
  • Display and alarm: LCD shows occupancy and capacity; reaching capacity triggers a buzzer and red LED, cleared only when someone leaves.
  • Persistence: the count is saved to the Arduino's EEPROM periodically, so a power cut does not reset it to zero.
  • Logging: every committed event goes over USB serial; the Python logger stamps it with the PC clock and appends date, time, room, event, count rows to CSV, with a weekly summary script on top.

Feasibility Study

  • Technical: all sensing, display and logic is elementary digital interfacing of the kind taught in the microcontroller lab; the only subtle part — direction detection — is a small, well-testable state machine. No cloud, no networking, no camera, so there is no privacy impact.
  • Economic: the bill of materials is about ₹1,300, one-time, largely from the department store; the laptop that logs data already exists.
  • Operational: mounting is two brackets and a velcro-fixed LCD at the door; the unit runs from a 9 V adapter. Accuracy is honestly reported: our walk trials and the documented limitation for two people crossing abreast (mitigated by sensor spacing and mount height) are part of the report, not hidden.

Objectives

  1. 01Detect each passage through a door using two IR reflective sensor modules and decide direction from the order of beam breaks, using a five-state firmware state machine with a 600 ms timeout.
  2. 02Debounce sensor chatter so a hand waved at the sensors or a swinging bag does not change the count.
  3. 03Display live occupancy and rated capacity on a 16x2 I2C LCD mounted outside the door, with green/red status LEDs.
  4. 04Trigger a buzzer alarm when occupancy reaches the configured capacity and clear it automatically when the count falls.
  5. 05Persist the occupancy count in EEPROM so that power cuts do not reset it, with a deliberate reset button for room openings.
  6. 06Log every committed event over USB serial to a Python (pyserial) logger that writes timestamped CSV rows and produce a weekly footfall summary.
  7. 07Quantify counting accuracy with a documented walk trial (200 single-person passages, 50 two-abreast passages) and report the error honestly.

Scope

In scope

  • One doorway up to about 1.5 m wide, two-way foot traffic, single Arduino node.
  • Live occupancy display, configurable capacity (set in firmware or via a menu button), full-room alarm.
  • CSV event log on a connected laptop and a weekly summary per classroom.
  • Walk-trial accuracy measurement with published results.

Out of scope (v1)

  • Identification of individuals — the unit counts people, never recognises them (no camera, no biometrics).
  • Multiple doors per room or syncing several units; networked dashboards and mobile apps.
  • Counting vehicles or extremely wide gates; outdoor mounting in rain.
  • The known edge case of two or more people crossing exactly abreast is documented and mitigated, not solved — it is reported as a measured error term.

Methodology

The team used the Iterative (Incremental) SDLC model: four increments, each ending in something that works and can be demoed to the guide. For a first hardware build this beats the waterfall model, because sensor behaviour (IR range, debounce time) can only be learned by touching real hardware, and every increment absorbs that learning.

IncrementWeeksActivitiesDeliverable
1. Bench prototype1–3Breadboard one IR sensor, read it with a simple sketch, tune the potentiometer, add the second sensor and log raw sequencesSensors that reliably report beam breaks
2. Direction logic4–6Five-state state machine, debounce timing, timeout handling; walk-trial harness that prints raw vs countedDirection detection passing 90% of single-person trials
3. Display & alarm7–9I2C LCD pages, capacity alarm, EEPROM persistence, reset buttonFull stand-alone unit, no laptop needed
4. Logging & field trial10–12Python serial logger, CSV schema, weekly summary script; one-week trial on a lab door; report and PPTDeployed unit + accuracy report

Testing approach: unit tests for each sensor (toggle the module's LED by crossing its beam at varying distances and angles); integration tests for the state machine using scripted beam sequences (outer-then-inner, inner-then-outer, outer-only, both-at-once); system-level walk trials with a written protocol (single person, two abreast, person with a backpack, quick entry-exit); and a one-week acceptance trial whose logged counts are compared against a manual tally kept by the lab instructor. Every test case is recorded as ID, input, expected, actual, result.

Architecture & tech stack

1 diagram · 5 technologies · 1 min read

  • C (Arduino framework)
  • Arduino Uno (ATmega328P)
  • IR reflective sensor modules
  • 16x2 I2C LCD
  • Python (pyserial logger)

The system is a small, fully inspectable chain: sense → decide → show → log. Two IR reflective modules face each other across the door frame at waist height, 12 cm apart, each pulling its output low when a reflection is seen. The Arduino Uno polls both outputs every 10 ms — polling, because interrupt-plus-debounce logic for two channels is easier to reason about and verify as a state machine. The committed event updates the count, drives the LCD, the buzzer and the LEDs, and emits one serial line. A Python logger on the lab laptop adds the PC timestamp and appends to CSV; a separate script turns the week's CSV into a per-hour footfall summary. There is deliberately no network in v1: the unit must work with the laptop unplugged.

flowchart TD
  P["Person at door"] --> S1["IR sensor A (outer, Arduino D2)"]
  P --> S2["IR sensor B (inner, Arduino D3)"]
  S1 --> SM["Arduino Uno ATmega328P: 5-state direction state machine (C firmware)"]
  S2 --> SM
  SM --> LCD["16x2 I2C LCD: OCC 47/60"]
  SM --> AL["Buzzer + green/red LED capacity alarm"]
  SM --> EE["EEPROM count persistence + reset button"]
  SM -->|USB serial 9600 baud| PY["Python pyserial logger on laptop"]
  PY --> CSV["occupancy_log.csv (date, time, room, event, count)"]
  CSV --> WK["Weekly footfall summary script"]

The serial protocol is one line per event — EVT,IN,47 or EVT,OUT,46 — which makes the logger trivially simple and the log human-readable in any editor, an intentional choice for a first project.

Modules

4 modules

  1. Module 01

    Sensing & Direction Logic (Member 1)

    Owns sensor selection, mounting geometry (12 cm spacing, waist-height bracket), potentiometer tuning to a 25 cm trip point, and the five-state direction state machine with debounce and timeout constants — plus the walk-trial harness and the accuracy table that quantifies how well it all works.

  2. Module 02

    Display & Capacity Alarm (Member 2)

    Owns the I2C LCD driver and its two pages (live occupancy, last-event count), the capacity setting stored in EEPROM, the buzzer and red/green LED alarm logic, count persistence across power cuts, and the recessed reset button used when a room is opened for the day.

  3. Module 03

    Serial Logging & Reports (Member 3)

    Owns the Python side: the pyserial logger that timestamps each event with the PC clock and appends to CSV with duplicate-line protection, the weekly summary script that prints per-hour footfall and peak occupancy per room, and a playback mode that replays a raw trial log through the logic for regression testing.

  4. Module 04

    Mounting, Field Trial & Documentation (shared)

    The whole team builds the door-frame mounting, runs the one-week trial on Lab 204 with the instructor's manual tally as ground truth, writes the accuracy findings and the report chapters, and prepares the demo script so each member can explain every module.

Slides

11 slides · titles free · bullets, notes and the .pptx unlock

  1. Slide 1

    Classroom Occupancy Counter with Live Display

  2. Slide 2

    Problem Statement

  3. Slide 3

    Existing vs Proposed System

  4. Slide 4

    Objectives

  5. Slide 5

    Sensing Principle

  6. Slide 6

    Direction State Machine

  7. Slide 7

    System Architecture

  8. Slide 8

    Display, Alarm & Persistence

  9. Slide 9

    Testing

  10. Slide 10

    Results & Limitations

  11. Slide 11

    Conclusion & Future Scope

Bullets, speaker notes and the .pptx · ₹2,000

The titles above are the real outline. The rest is what you present from.

Unlock for ₹2,000

Viva questions & answers

3 of 16 answered free · 13 unlock

Read each answer, close it, and say it in your own words. Your viva will ask. Now you'll know.

  1. 01Concept

    Why two IR sensors instead of one?

    A single beam can only tell you that somebody passed, not in which direction, so the count would drift upward forever. With two beams spaced 12 cm apart, a person entering breaks the outer beam before the inner one and a person leaving breaks them in reverse order, so the sequence itself carries the direction information that the count depends on.

  2. 02Concept

    What is debouncing and why does your counter need it?

    Debouncing means ignoring rapid artificial transitions after a real event. Our IR modules chatter — a swinging bag, a waving hand, or a slow arm produces multiple quick beam breaks. The firmware requires a stable state for 40 ms before accepting a transition and uses a 600 ms inactivity timeout, so one physical passage produces exactly one counted event instead of five.

  3. 03Concept

    Why did you choose IR reflective modules rather than a camera or an ultrasonic pair?

    Cameras raise privacy objections in classrooms and hostels and need processing far beyond a beginner scope. Ultrasonic beams are wide and slow to localise at a door frame, so direction detection is unreliable. IR reflective modules are ₹50 each, react in microseconds, give a clean digital output, and their small sensing cone suits the narrow passage geometry a doorway demands.

+13 more questions, with answers

Try the free ones out loud first. Your examiner will not accept “it's in the PPT”.

Source code & how to run

6 steps · complete source code · unlocks with the project

Unlocks with the project · ₹2,000

6 steps · source code zip

Prerequisites, install, seed data and tests, written for demo day. Plus the complete source.

Unlock for ₹2,000

READMEFIRST

201 words · unlocks with the project

What to change before it goes anywhere near a submission. Skipping it is how the demo fails live.

Unlocks with the project · ₹2,000

201 words · ~1 min read

The checklist of things to rename, re-seed and re-think so the project reads as yours.

Unlock for ₹2,000

Instructions

361 words · unlocks with the project

How to study it, adapt it and walk your examiner through it, step by step.

Unlocks with the project · ₹2,000

361 words · ~2 min read

Report structure, formatting rules and the submission checklist your department will grade.

Unlock for ₹2,000

References

6 sources

  1. Arduino Language Reference (official docs.arduino.cc)
  2. Microchip — ATmega328P 8-bit AVR Microcontroller (product page and datasheet)
  3. Vishay CNY70 Reflective Optical Sensor with Transistor Output — datasheet
  4. Hitachi HD44780U LCD Controller Datasheet (document hosted by SparkFun)
  5. Michael Margolis, Arduino Cookbook, 2nd ed., O'Reilly Media
  6. Albert D. Helfrick & William D. Cooper, Modern Electronic Instrumentation and Measurement Techniques, Pearson

Cite this bundle

OnlyProjects. (2026). Classroom Occupancy Counter with Live Display using IR Sensors (Arduino, Python): B.Tech / B.E. Electronics & Communication project bundle [Educational resource]. https://onlyprojects.online/projects/btech-ece-ir-classroom-occupancy-counter-display

Future scope

1 min read

  • Multi-door units linked over ESP-NOW or RS-485 to one department dashboard, with per-room live status.
  • Identity-free analytics: peak-hour footfall and room-utilisation reports that help the department timetable lab batches without tracking any individual.
  • HVAC/light interlock: drive the room's lights or AC only when occupancy is above a threshold, as an energy-saving extension.
  • Exam-hall mode: a stricter two-threshold configuration (warning at 90% capacity, alarm at 100%) with an entry lockout log.
  • Battery backup and a Real-Time Clock so the unit keeps logging timestamps with the laptop fully disconnected.

Keep browsing

Same degree, same syllabus slot, different idea. Pick the one your guide will actually approve.

B.Tech / B.E.Code included

Electronics & Communication

Smart Energy-Meter Reading & Power-Theft Anomaly Logger (ESP32, Python)

A single-phase meter node that logs kWh at 1-minute intervals, flags tamper and overload anomalies, and plots them on a Python dashboard

  • C (ESP32, Arduino framework)
  • Python (Flask + SQLite dashboard)
  • MATLAB / Scilab (calibration & load-profile analysis)
  • +3

intermediate14 wk4 students

B.Tech / B.E.Code included

Aerospace / Aeronautical

Low-Speed Open-Circuit Wind Tunnel with Force Balance for Aerofoil Lift-Drag Measurement

Build a subsonic test tunnel on a student budget, then trace lift and drag on a 3D-printed NACA 0012 against theory

  • C / Arduino Uno (industry-standard extra) — HX711 load-cell and serial logging firmware
  • Python (NumPy, Matplotlib) — calibration, force coefficients and plots
  • MATLAB / Scilab — thin-airfoil theory overlay and regression
  • +4

intermediate14 wk4 students