Skip to content

Counts objects passing through an IR sensor and displays the count live on a web dashboard. The data is stored in Google Sheets or Firebase for monitoring and analysis.

Notifications You must be signed in to change notification settings

masum184e/quantrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Quantrix

An ESP32-powered IR detection system with real-time Web Serial dashboard integration.

🚀 Overview

Quantrix is a low-latency hardware-to-web solution designed for counting physical objects (industrial parts, people, or inventory) using an IR Obstacle sensor. It eliminates the need for complex cloud setups by using the Web Serial API to communicate directly between the ESP32 and a browser-based dashboard.

Key Features

  • Real-time Visualization: Instant UI updates via Web Serial.
  • Dual-Feedback System: Physical (Buzzer/LED) and Digital (Web Dashboard) alerts.
  • Responsive Analytics: Integrated Chart.js bar graphs for traffic overview.
  • Bidirectional Control: Reset hardware counters directly from the web interface.

🛠 Hardware Requirements

Component Description Quantity
ESP32 DevKit V1 Main Microcontroller with WiFi/Bluetooth 1
IR Obstacle Sensor Active-Low Infrared proximity sensor 1
Active Buzzer 3.3V - 5V Buzzer for audible feedback 1
Jumper Wires Female-to-Female or Male-to-Female 5+
USB Data Cable Micro-USB or USB-C (Must support Data) 1

🔌 Wiring Diagram

The system uses the following GPIO configuration. Ensure the ESP32 is unplugged during wiring.

Component Pin ESP32 Pin (GPIO)
IR Sensor VCC 3.3V
IR Sensor GND GND
IR Sensor OUT GPIO 23
Buzzer Positive (+) GPIO 18
Buzzer Negative (-) GND
LED Built-in GPIO 2

💻 Software Installation

1. ESP32 Firmware (C++)

The firmware monitors the IR sensor and sends a formatted string COUNT:X over Serial at 115200 baud. It also listens for a RESET string from the dashboard.

Upload via Arduino IDE:

  1. Set board to DOIT ESP32 DEVKIT V1.

  2. Set Baud Rate to 115200.

  3. Hold the BOOT button on the ESP32 if the upload fails with "Connecting...".

2. Web Dashboard (HTML/JS/Tailwind)

The dashboard uses the Web Serial API. Because this is a security-sensitive API, the following conditions must be met:

  • Browser: Google Chrome or Microsoft Edge.
  • Protocol: Must be served over https:// or localhost (or opened as a local file).

📖 Operational Guide

Initial Setup

  1. Flash the ESP32 with the provided firmware.

  2. Open the Dashboard: Launch your index.html file.

  3. Establish Handshake:

    • Click the Settings (Gear) Icon in the top right.
    • Select your ESP32's COM port from the browser popup.
    • Click Connect.

How it Works

  1. Detection: When an object breaks the IR beam, the sensor pulls GPIO 23 LOW.
  2. Hardware Action: The ESP32 increments the internal counter, beeps the buzzer, and sends COUNT:[Value] to the USB port.
  3. Web Processing: The JavaScript Buffer catches the fragments, reconstructs the line, and updates the Tailwind UI and Chart.js graph.

📊 Data Protocol

The communication follows a lightweight string-based protocol:

Source Direction String Action
ESP32 TX COUNT:5 Updates UI counter to 5
ESP32 TX STATUS:IDLE Resets UI badge to "Idle"
Web RX RESET Clears ESP32 memory and restarts count

🛠 Troubleshooting

  • Serial Port Busy: Ensure the Arduino IDE Serial Monitor is closed before connecting the web dashboard.
  • Incomplete Data: If the counter skips, check the serialBuffer logic in the JavaScript code to ensure fragments are being joined correctly.
  • No Buzzer Sound: Verify the buzzer is "Active" (beeps when connected directly to 3V) and not "Passive."

📈 Future Roadmap

  • Google Sheets Integration: Log every 10th count to a cloud spreadsheet.
  • Peak Hour Detection: Algorithm to highlight the most active 60-minute window.
  • PWA Support: Convert the dashboard into an offline-capable mobile app.

Real Use Cases

1. Smart Retail: Foot Traffic Monitor

Instead of counting objects, you place the IR sensor at the entrance of a small shop or a library.

The Problem: Small business owners need to know their "Conversion Rate" (how many people entered vs. how many bought something).

The Implementation: The dashboard tracks total entries. By looking at the Daily Traffic Overview chart, the owner can see which hours require more staff.

Value Add: If the count exceeds a "Capacity Limit," the ESP32 buzzer sounds an alert to stop more people from entering.

2. Manufacturing: Conveyor Belt Production Line

Place the sensor on a production line where items move past on a belt.

The Problem: Manual counting is prone to human error and fatigue.

The Implementation: As each product (bottles, boxes, or components) passes, the ESP32 logs it.

Value Add: By adding a "Time since last detection" logic in your HTML, the dashboard can detect a Conveyor Jam. If the counter hasn't moved in 30 seconds while the motor is on, the dashboard highlights red to alert the floor manager.

3. Logistics: Loading Dock & Warehouse Inventory

Mount the sensors on the sides of a loading dock door or a warehouse shelf.

The Problem: Keeping track of how many boxes have been loaded onto a truck.

The Implementation: Every time a worker carries a box through the door, the counter increments.

Value Add: Using the Reset button on the dashboard for every new truck, providing a digital "manifest" of what was loaded.

4. Smart Office: Room Occupancy & Desk Tracking

Place the sensor at the entrance of a meeting room or a shared co-working space.

The Problem: Large offices need to know if "Quiet Zones" or "Meeting Rooms" are actually being used to justify the rent.

The Implementation: The dashboard tracks cumulative usage over a week.

Value Add: You can integrate a "Current Occupancy" logic where the counter increments when someone enters and (with a second sensor) decrements when they leave.

5. Automated Parking: Vehicle Entrance Counter

Position the sensor at the height of a car bumper at a private parking lot entrance.

The Problem: Small private lots need a cheap way to know if they are full without expensive underground loop sensors.

The Implementation: The ESP32 counts cars entering.

Value Add: Since the dashboard is web-based, the security guard can monitor the "Live Counter" on a tablet or phone from anywhere within Bluetooth/Serial range.

About

Counts objects passing through an IR sensor and displays the count live on a web dashboard. The data is stored in Google Sheets or Firebase for monitoring and analysis.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published