Suspicious Activity Alerts With LLM

by KimY21 in Circuits > Cameras

19 Views, 1 Favorites, 0 Comments

Suspicious Activity Alerts With LLM

Instructables Cover Image.png

Turn your camera into an AI watchdog that actually understands what it's looking at. Instead of just spotting motion, this project waits for a person to linger in view at night, snaps a photo, hands it to a large language model, and only alerts you when the LLM describes the scene as suspicious. The push notification arrives with the snapshot attached and a short, plain-English description of what the AI saw. Works on any Grablo-supported device — if you have a laptop, you can try it right away with no extra hardware.

Supplies

Hardware:

  1. Windows PC, Mac, Raspberry Pi, or any other Grablo-supported device
  2. Camera — USB, CSI, ONVIF, or RTSP (not required for laptops with a built-in webcam)
  3. Smartphone with the Grablo app for receiving push notifications

Software:

  1. Grablo — No-Code IoT Platform
  2. Google Gemini API key (free tier — no credit card required)

Quick Start

Want to skip the build and try it right away? Copy the project from the Grablo Gallery:

  1. Download and install Grablo software on your device from grablo.co/download
  2. Get this project from the Grablo Gallery
  3. Configure your camera in Settings → Camera → Edit
  4. Paste your Gemini API key in Settings → LLM AI → Edit
  5. Connect to your device and hit RUN

If you'd like to build it from scratch, follow the steps below.

Create Dashboard

Create a new project at app.grablo.co, name it "AI Camera with Suspicious Activity Alerts," and select your device. Then create a dashboard and add a Camera widget for the live feed — resize it to fit the canvas. Add a Value widget and bind it to the variable that will hold the LLM's response so you can see the latest scene description at a glance.

Set Up Logic

This project uses two logics. The first logic runs once at project launch — it starts the AI Object Detection model, registers your camera, and tells the analyzer to watch specifically for the "Person" class, storing the detection result in a variable.

The second logic is where the intelligence lives. A Compare condition watches the person-detected variable and only fires when a person stays in view for at least 3 seconds — this hold-time filter is what keeps a quick walk-by from triggering an alert. A Time Range condition narrows it down to your chosen nighttime hours. Once both conditions are met, a Camera action captures a snapshot to a known file path. An LLM AI Query action then sends that snapshot to Google Gemini with a prompt asking it to describe anything suspicious in a short sentence, or simply reply "Normal" otherwise. A Compare condition checks the LLM's response, and when it's anything other than "Normal," a Push Notification action fires with the LLM's description as the message and the captured snapshot as the attachment.

Launch Your Project

Launch Your Project

  1. Open the Grablo app and select your project
  2. Make sure your camera is configured (Settings → Camera) and your Gemini API key is set (Settings → LLM AI)
  3. Connect to your device
  4. Hit RUN


Expected Results:

  1. The dashboard shows your camera feed in real time and the latest LLM description
  2. When someone lingers in front of the camera at night, a snapshot is captured
  3. The LLM judges the scene and either flags it with a short description or replies "Normal"
  4. A push notification arrives on your phone with the snapshot attached
  5. Tapping the notification jumps straight into the live camera stream
  6. The LLM keeps re-analyzing as long as the person stays in view, so the description updates as the scene changes


Video Tutorial

Suspicious Activity Alerts with LLM

Expand Your Project

Expand Your Project

  1. Refine the LLM prompt to ignore certain people, focus on specific behaviors (loitering, package handling, masked faces), or describe scenes in your preferred language
  2. Switch to a more capable Gemini model for richer descriptions
  3. Add multiple cameras and run the same LLM pipeline on each
  4. Log every flagged event to a CSV file or database for later review
  5. Trigger a smart speaker, siren, or smart light when the LLM flags a high-risk scene


Troubleshooting:

  1. Camera feed not showing — verify the camera in Settings → Camera and try a different USB port or CSI cable
  2. No push notifications — install the Grablo mobile app and log in with the same account
  3. LLM always replies "Normal" — confirm your Gemini API key in Settings → LLM AI and tighten the prompt with more specific suspicious-behavior examples
  4. Too many false alerts — increase the 3-second hold time, narrow the nighttime range, or refine the LLM prompt
  5. Person detection never triggers — pick a more accurate AI mode (Balanced or Accurate) and improve scene lighting