Tech Gyan Set
Published © MIT

ESP32 Real-Time Smart Queue Management System

ESP32-based system that monitors and manages queues in real time using sensors and a display to reduce waiting time and overcrowding.

BeginnerFull instructions provided7 hours41
ESP32 Real-Time Smart Queue Management System

Things used in this project

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Code

πŸ₯ ESP32 Smart Queue Management System – Complete Code

C/C++
// ------------------------------------
// ESP32 Smart Queue Management System
// ------------------------------------

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// LCD Address (usually 0x27 or 0x3F)
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Sensor Pins
#define ENTRY_SENSOR 32
#define EXIT_SENSOR 33
#define BUZZER_PIN 26

int queueCount = 0;

bool entryState = false;
bool exitState = false;

void setup()
{
  Serial.begin(115200);

  pinMode(ENTRY_SENSOR, INPUT);
  pinMode(EXIT_SENSOR, INPUT);
  pinMode(BUZZER_PIN, OUTPUT);

  digitalWrite(BUZZER_PIN, LOW);

  lcd.init();
  lcd.backlight();

  lcd.setCursor(0,0);
  lcd.print("Smart Queue Sys");

  delay(2000);
  lcd.clear();
}

void loop()
{

  int entryValue = digitalRead(ENTRY_SENSOR);
  int exitValue = digitalRead(EXIT_SENSOR);

  // Entry detection
  if(entryValue == LOW && entryState == false)
  {
    queueCount++;
    entryState = true;

    digitalWrite(BUZZER_PIN, HIGH);
    delay(100);
    digitalWrite(BUZZER_PIN, LOW);

    Serial.print("Person Entered | Queue: ");
    Serial.println(queueCount);
  }

  if(entryValue == HIGH)
  {
    entryState = false;
  }

  // Exit detection
  if(exitValue == LOW && exitState == false)
  {
    if(queueCount > 0)
      queueCount--;

    exitState = true;

    digitalWrite(BUZZER_PIN, HIGH);
    delay(100);
    digitalWrite(BUZZER_PIN, LOW);

    Serial.print("Person Left | Queue: ");
    Serial.println(queueCount);
  }

  if(exitValue == HIGH)
  {
    exitState = false;
  }

  // LCD Display
  lcd.setCursor(0,0);
  lcd.print("Queue Count:");

  lcd.setCursor(0,1);
  lcd.print(queueCount);
  lcd.print(" People   ");

  delay(200);
}

Credits

Tech Gyan Set
32 projects β€’ 13 followers
Tech Gyan Set | IoT & Embedded Systems Creator | Arduino, ESP32, GSM & NodeMCU Projects | Smart Home & Real-Life Automation Tutorials
Thanks to Tech Gyan Set .

Comments