Set up camera vision with a prompt. SCADA gets one simple state per zone: Clear, Active or Unknown.
No model training and no vendor integrator: type what to watch, draw the area, and bind the tags over OPC UA, MQTT or REST. The main example is a restart permissive, where SCADA accepts a reset only while the zone reads Clear.
A person with a water bottle in front of a 3D printer, shown in an Ignition Perspective view. The bottle stands in for any object or person that should not be in a hazard zone.
- Rule, zone
A-101:hand overlaps the area AND bottle overlaps the area for 1 s. - Stop: a hand and a bottle are both in the drawn area on two fresh checks.
StategoesActive, Ignition latches a stop and sends the printer one Pause. - Clear: the hand and the bottle are not both in the area.
StatereadsClearand the print continues. After a stop,Clearalone restarts nothing. - Reset: System Reset is accepted only while
StateisClearandSettledis true. It is refused while the zone readsActive, and from the first fresh check that sees the hand and bottle in the area again.
- Light curtains detect crossing, not presence. A person steps inside, the curtain clears, someone resets, and the machine runs with them in it. The same applies to a person on a conveyor.
- Interlocks get bypassed with jumpers and dummy wires.
- Vision systems are closed vendor packages. The plant's own controls engineer can't change them.
- Main use: a permissive before restart. SCADA accepts a reset only while the zone's rule reads
Clear. A check takes seconds, so it is not a fast stop. Clearis the last confirmed result of the configured rule, and it expires if no fresh check follows. It does not mean the zone is empty: with a person AND dog rule, a person alone readsClear.- A lost camera, a failed check or a late result is
Unknown, neverClear. - Plain status over OPC UA, MQTT or REST. No vendor integrator, no proprietary hardware.
- Rules are prompts: name the object and draw the area. No retraining, no code changes.
What else it could watch, none of it tested: a stack light on a machine with no data connection, a pallet present, a bin full, a door open.
| Light curtain / interlock | Vendor vision safety system | vLock | |
|---|---|---|---|
| Detects presence inside the zone, not just crossing | No | Varies by product | Yes, on each check (2-4 s apart) |
| Tells who or what is there | No | Varies by product | The objects named in the prompt, with a count |
| Rule change | Rewire | Vendor visit | Edit a prompt |
| Who integrates | Electrician | Vendor integrator | Your own SCADA developer |
| Output | Safety relay | Proprietary | Open tags (OPC UA, MQTT, REST) |
| Safety certified | Yes | Yes | NO |
vLock combines camera vision and fixed SCADA tags in one public repository that a controls engineer can run and modify. The stop latch stays on the SCADA side.
flowchart LR
CAM[Camera] --> SAM[SAM 3.1]
SAM --> RULE[Fixed rule code]
RULE --> STATE[State: Clear / Active / Unknown]
STATE --> SCADA[Ignition]
RULE -. optional .-> VLM[Muse Spark frame check]
VLM -. advisory .-> TAG[VlmState tag]
- SAM 3.1 finds the objects named in the rule on the latest camera frame. It runs on a local NVIDIA GPU or through the Meta Model API.
- Fixed code compares the object outlines with the drawn area. A state change needs two matching fresh checks.
Unknownis neverClear. A lost camera, a failed model call or a late result publishesUnknownwith aReason.
Muse Spark can draft a rule from plain English, and a person approves it before it runs. The optional Muse frame check writes its answer to VlmState only. It never changes State.
| Part | Used in the demo |
|---|---|
| SCADA | Ignition Perspective |
| Stand-in machine | Bambu Lab P1S 3D printer |
| Camera | Raspberry Pi 5 with a USB camera, 640x480 |
| PC | Windows, RTX 3070 Ti Laptop GPU |
The Perspective view shows the printer's status, the zone state, a stop latch and System Start, Stop and Reset buttons. The latch that ran in the demo is the printerSite Gateway script. Details: demo site.
The customer side of the demo is in demo_site/ and is not part of the product:
demo_site/printer_ignition/: the Perspective printer project, the local MQTT connector for the printer, and the stop and reset logic.demo_site/pi_camera/: the camera service that runs on the Pi.
Not in this repo: the Ignition gateway itself, the connector's Windows service wrapper, and the printer's credentials. The app meets the demo site only through a camera address and its published tags.
| Type | Rule that was run | Tested |
|---|---|---|
| Demo rule | A hand and a water bottle are both in the area | Yes |
| Presence | A person is in the area | Yes |
| Non-worker | A person and a dog are both in the area, with a real dog | Yes |
Not yet validated:
- Presence on a conveyor belt. No conveyor was used.
- Authorization: red vest may enter, yellow vest stops the machine.
- PPE: only people wearing a hard hat may be in the zone. The
helmet-checkskill gives an advisory answer inVlmStateonly. - Headcount: at most 2 people in the zone. A count zone publishes
Count1for the whole frame, and SCADA would compare the limit. - Non-worker: a child in view.
Test every rule change before going live. The app, the model version and the API still need normal maintenance.
Owner-tested on November 4, 2026, through Ignition to a real printer. Observed by hand, not timed. Rule: person AND dog.
| Scene | State | Printer |
|---|---|---|
| Person alone | Clear |
Kept running |
| Person holding a real dog | Active |
Stopped |
| Camera disabled | Unknown |
Stopped |
Check times seen by the owner in the running app so far: 2-4 s on average. Tests with more camera angles and prompts are still to be added.
There is no accuracy benchmark yet. Details are in the test results.
Docker needs an NVIDIA GPU with 8 GB or more, host networking turned on in Docker Desktop, and a Hugging Face token approved for facebook/sam3.1.
git clone https://github.com/celikender/vLock-AI-Vision.git
cd vLock-AI-Vision
cp .env.example .env
docker compose up -d --buildSet HF_TOKEN in .env before the last command. Then open http://localhost:5056 and create the admin account.
docker compose logs -f sam
docker compose restart sam
docker compose downWithout a GPU, use the native start on Windows with Python 3.12 and set VLOCK_SAM_BACKEND=meta_api. See the install guide. Docker was tested with the local GPU engine only. More in the Docker guide.
Variables in .env:
| Variable | Default | Purpose |
|---|---|---|
VLOCK_SAM_BACKEND |
local |
local (GPU worker), meta_api (one image per check) or meta_api_video (four-frame clip) |
META_API_KEY |
Muse Spark and the Meta SAM engines | |
META_BASE_URL |
https://api.meta.ai/v1 |
Meta Model API address |
META_SAM_MODEL |
sam-3.1 |
SAM model name |
META_MUSE_MODEL |
muse-spark-1.3 |
Muse model name |
VLOCK_SAM_TIMEOUT_MS |
3000 |
Limit per Meta request |
VLOCK_SAM_DAILY_LIMIT_USD |
10 |
Estimated spend per UTC day at which paid requests stop |
VLOCK_OPCUA_SERVER_USERNAME, VLOCK_OPCUA_SERVER_PASSWORD |
OPC UA login for SCADA on another PC. Password of 12 or more characters | |
VLOCK_API_TOKEN |
Optional bearer token for the REST API | |
HF_TOKEN |
Docker only: downloads the SAM 3.1 weights once |
Set in the app, not in .env:
- Camera: per zone. A Pi camera service at
<Pi address>:8080on a private network, or anrtsp://address. RTSP has not been tested with a real camera. - OPC UA and MQTT: on the Integrations page. OPC UA defaults to port 4845. MQTT is off by default.
The app is a read-only OPC UA server. In Ignition, add an OPC UA connection named vLock Bridge:
opc.tcp://127.0.0.1:4845/vlock/
Each zone has the same tags at nsu=urn:vlock:bridge:v1;s=Bridge/Zones/<tag key>/<tag>.
| Tag | Type | Meaning |
|---|---|---|
State |
String | Active, Clear, Unknown, or Valid for count zones |
Active |
Boolean | Rule met. Bad quality when Unknown |
Quality |
String | Good, Unknown or Stale |
Reason |
String | Why the zone has this state |
Settled |
Boolean | False while a fresh check disagrees with State and is being confirmed. Bad quality when Unknown |
Count1, Count2 |
Int32 | Detections of each object in the whole frame |
ObservedAt, AgeSeconds |
String, Double | Time and age of the analysed frame |
Bridge/HeartbeatCounter, Bridge/Online |
Int64, Boolean | App heartbeat |
Read State, not only Active. Treat Unknown or Bad quality as stop. Accept a reset only while State is Clear and Settled is true: State changes after two matching checks, so for one check it can still read Clear after something has entered.
The same status over REST and MQTT:
GET http://localhost:5056/api/v1/zones
GET http://localhost:5056/api/v1/zones/<tag key>
MQTT topic: <topic prefix>/zones/<tag key>/state
{
"schema_version": 1,
"TagKey": "A-101",
"State": "Clear",
"Active": false,
"Quality": "Good",
"Settled": true,
"Rule": "hand overlaps the area AND bottle overlaps the area for 1 s",
"Object1": "hand",
"Object2": "bottle",
"Count1": 1,
"Count2": 0
}The example shows some of the fields. The tag package is ignition/vlock-zones.json, with the vLockZone UDT. Full list: zone tags. Setup steps: Ignition guide.
- The app publishes status only. It sends no machine commands.
- Latch, reset and stop logic belong in SCADA. The demo ran the latch script in
demo_site/printer_ignition/.ignition/stop_latch_example.pyis a separate example that has not run in a real gateway. - It is not a certified safety device.
- It does not replace interlocks, light curtains or lockout/tagout.
- A check takes seconds, so this is not a fast stop.
- One camera and one monitoring job at a time.
- Accuracy has been sampled, not benchmarked.
- On-demand camera check, run only when an interlock or light curtain is broken.
- Debounce for
Unknownin the app. Today the demo's latch script waits 2 s. - Log the active rule and prompt with each state change.
- Test what is implemented but not yet run: RTSP cameras and the Muse frame-check skills.
The Meta Global AI Developer Hackathon 2026, Indie Developer Track, by Ender Celik. Gallery entry.
The stop latch idea comes from my earlier project, vLock Digital LOTO, an Ignition Perspective demonstration. No code was copied from it.
The code is licensed under Apache-2.0. The SAM 3.1 weights stay under Meta's own license, and each user requests access on Hugging Face.




