Shruthi
Published © MPL-2.0

HELM-Eye: The Smart Helmet Compliance Signage

HELM-Eye is an AI-powered sign that detects helmets and displays instant entry or safety messages.

BeginnerFull instructions provided8 hours32
HELM-Eye: The Smart Helmet Compliance Signage

Things used in this project

Story

Read more

Schematics

Circuit Diagram

Code

Code

C/C++
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "Seeed_Arduino_SSCMA.h"

// LCD settings
LiquidCrystal_I2C lcd(0x27, 16, 2);
SSCMA ai;

// Scroll variables
unsigned long lastScrollTime = 0;
int scrollPos = 0;
String scrollMsg = "";
#define SCROLL_INTERVAL 250

void setup() {
  Wire.begin();
  lcd.init();
  lcd.backlight();
  ai.begin();
  ai.setDefaultModel(); // Your SenseCraft model
}

void loop() {
  if (ai.invoke()) {
    int id = ai.getTopClass();
    String label = ai.getClassName(id);
    float conf = ai.getConfidence(id);

    if (conf < 0.6) {
      showStaticCentered("Stark Industries");
      lcd.setCursor(0, 1);
      lcd.print("                ");
    }
    else if (label == "Helmet") {
      showStaticTop("ENTRY GRANTED");
      scrollMsg = "Welcome to Stark Industries";
      scrollBottom();
    }
    else if (label == "No Helmet") {
      showStaticTop("ENTRY DENIED");
      scrollMsg = "Please wear a helmet";
      scrollBottom();
    }
  }
}

void showStaticTop(String msg) {
  lcd.setCursor(0, 0);
  lcd.print("                ");
  lcd.setCursor(0, 0);
  lcd.print(msg);
}

void showStaticCentered(String msg) {
  lcd.clear();
  int spaces = (16 - msg.length()) / 2;
  lcd.setCursor(spaces, 0);
  lcd.print(msg);
}

void scrollBottom() {
  if (millis() - lastScrollTime > SCROLL_INTERVAL) {
    String padded = scrollMsg + "   ";
    String displayPart = padded.substring(scrollPos, scrollPos + 16);
    lcd.setCursor(0, 1);
    lcd.print(displayPart);
    scrollPos++;
    if (scrollPos > padded.length()) scrollPos = 0;
    lastScrollTime = millis();
  }
}

Credits

Shruthi
2 projects • 0 followers

Comments