Suspicious Activity Alerts With LLM
by KimY21 in Circuits > Cameras
19 Views, 1 Favorites, 0 Comments
Suspicious Activity Alerts With LLM
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:
- Windows PC, Mac, Raspberry Pi, or any other Grablo-supported device
- Camera — USB, CSI, ONVIF, or RTSP (not required for laptops with a built-in webcam)
- Smartphone with the Grablo app for receiving push notifications
Software:
- Grablo — No-Code IoT Platform
- 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:
- Download and install Grablo software on your device from grablo.co/download
- Get this project from the Grablo Gallery
- Configure your camera in Settings → Camera → Edit
- Paste your Gemini API key in Settings → LLM AI → Edit
- 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
- Open the Grablo app and select your project
- Make sure your camera is configured (Settings → Camera) and your Gemini API key is set (Settings → LLM AI)
- Connect to your device
- Hit RUN
Expected Results:
- The dashboard shows your camera feed in real time and the latest LLM description
- When someone lingers in front of the camera at night, a snapshot is captured
- The LLM judges the scene and either flags it with a short description or replies "Normal"
- A push notification arrives on your phone with the snapshot attached
- Tapping the notification jumps straight into the live camera stream
- The LLM keeps re-analyzing as long as the person stays in view, so the description updates as the scene changes
Video Tutorial
Expand Your Project
Expand Your Project
- Refine the LLM prompt to ignore certain people, focus on specific behaviors (loitering, package handling, masked faces), or describe scenes in your preferred language
- Switch to a more capable Gemini model for richer descriptions
- Add multiple cameras and run the same LLM pipeline on each
- Log every flagged event to a CSV file or database for later review
- Trigger a smart speaker, siren, or smart light when the LLM flags a high-risk scene
Troubleshooting:
- Camera feed not showing — verify the camera in Settings → Camera and try a different USB port or CSI cable
- No push notifications — install the Grablo mobile app and log in with the same account
- LLM always replies "Normal" — confirm your Gemini API key in Settings → LLM AI and tighten the prompt with more specific suspicious-behavior examples
- Too many false alerts — increase the 3-second hold time, narrow the nighttime range, or refine the LLM prompt
- Person detection never triggers — pick a more accurate AI mode (Balanced or Accurate) and improve scene lighting