Use “Check out” when a vehicle leaves without being read.
Plate
Origin
Type
Driver
ID
Purpose
Time in
Duration
Status
Plate
Origin
Type
Driver
ID
Purpose
In
Out
Dur.
Gate
Sync
Plate
List
Name
Note
The watchlist lives in the Watchlist tab of your Google Sheet. Blacklisted plates trigger a red alarm, while VIP, resident and staff plates show a green badge and pre-fill the name.
1 · Google Sheet database (≈5 minutes)
Create a new Google Sheet, for example “ParkX Gate Log”, then open Extensions → Apps Script.
Delete the sample code and paste the script below into Code.gs. Save it.
Choose the setup function in the toolbar and press Run. Approve the permissions. This creates the Log and Watchlist tabs and a Drive folder for images, and prints an API key in the execution log.
Deploy → New deployment → Web app. Set Execute as: Me and Who has access: Anyone. Copy the /exec URL.
Paste the URL and API key into Settings → Google Sheet, then press Test connection.
Optional cloud ANPR: get a token at platerecognizer.com. In Apps Script, go to Project Settings → Script properties and add PLATE_RECOGNIZER_TOKEN. Then choose Cloud as the plate engine.
If you change the script later, use Deploy → Manage deployments → Edit → New version so the URL stays the same.
2 · clearcam as the gate camera
Run clearcam on the NVR PC (pip install -r requirements.txt && python3 clearcam.py) and add the gate RTSP camera in its web UI at http://NVR-IP:8080.
Allow this console to read the stream (CORS). clearcam doesn't send CORS headers, so without this the browser can show the video but can't analyse it. Add these lines inside class HLSRequestHandler in clearcam.py and restart:
python3 - <<'EOF'
p='clearcam.py';s=open(p).read()
k='class HLSRequestHandler(BaseHTTPRequestHandler):\n'
if 'Access-Control-Allow-Origin' not in s:
s=s.replace(k,k+" def end_headers(self):\n self.send_header('Access-Control-Allow-Origin', '*')\n super().end_headers()\n",1)
open(p,'w').write(s);print('patched')
EOF
In this console, choose clearcam (HLS), enter NVR-IP:8080, pick the camera and press Start. The console follows clearcam's daily stream folder (/<camera>/streams/<YYYY-MM-DD>/stream.m3u8) and reconnects at midnight.
Open this file over http, not https. Browsers block an http:// camera stream inside an https:// page. On the guard PC, open the file directly (double-click) or run python3 -m http.server 8000 in its folder and browse to http://localhost:8000/. Webcam access works on both.
Mount the camera 1–2 m high and aimed at the lane so plates are at least 120 px wide. Use Set zone to box the lane.
AI plate models (long-range reading)
Keep the models folder next to index.html (Cloudflare Pages: upload the whole folder). The page loads the models from models/ and stores them on the device for offline use.
When you open the file by double-clicking, the browser can't read models/. Go to Settings → Recognition → Load model files and pick the four .onnx files once per device, or run python3 -m http.server 8000 in the folder.
Reading range: plates are detected from far away, but they're read only once they are at least 60 px wide in the image (about 100% accuracy at 140 px or more). At 1080p with a normal lens that's roughly 8–12 m; at 4K or with zoom, 2–3× further. Use Set zone around the lane, plus zoom where the camera supports it.
3 · Using a phone or tablet as the camera
Phones only allow the camera on https:// pages. Opening the file from Downloads, WhatsApp, Telegram, Google Drive or a preview will not work.
Free HTTPS hosting with GitHub Pages: in your GitHub repo, upload index.html (for example into a gate/ folder). Go to Settings → Pages → Deploy from a branch → main / (root) and save. After about a minute, open https://YOUR-USERNAME.github.io/REPO-NAME/gate/ in Chrome (Android) or Safari (iPhone).
Install as an app: on Android (Chrome), tap 📲 Install app in the top bar. On iPhone (Safari), tap Share → Add to Home Screen. The app then opens full-screen, works offline (records queue until the network returns), keeps the screen awake while the camera runs, and updates itself when you upload a new version.
Tap Allow when asked for the camera. In the camera list, pick the back camera. Then use Add to Home screen so the guard can open it like an app.
Your Sheet URL and settings are saved per device, so enter them once on each phone (the API key is already built in).
An HTTPS page can't show an http:// clearcam stream. Use the phone's camera on the phone, and clearcam on a PC that opens the file locally.
4 · Notes
Plate rules: Malaysian state prefixes (A–W, Sabah S*, Sarawak Q*, KV Langkawi, Taxi H*, Military Z*), special series (PUTRAJAYA, MALAYSIA, PATRIOT…), diplomatic (xx-xx-DC/CC/UN), Singapore (checksum validated), Indonesia (B 1234 XYZ) and Thai script (optional). Brunei and other plates can be set by hand.
Vehicle type: COCO-SSD detects car, truck, bus, motorcycle and bicycle. MobileNet then refines this into van, lorry, pickup, trailer, ambulance, police, fire engine, taxi, tow truck and so on. Police and ambulance are also guessed from livery colours and marked “probable”. The guard should always confirm.
Privacy (PDPA 2010): ID numbers and images are personal data. Keep the Sheet and Drive folder restricted, set a retention period, and turn off ID image upload if you don't need it.