Raspberry Pi Car Loan Detector

Raspberry Pi Car Loan Detector

Published on

Can a Raspberry Pi in your car really read number plates — and even check whether the owner still owes money on the vehicle? Short answer: yes. In this project I turned a Raspberry Pi 5 into a lightweight license-plate recognition system that captures video on the edge, extracts plate crops, runs OCR, and cross-checks registry data to see if a car has outstanding finance. It’s part DIY, part data-sleuthing, and a bit of “traffic cop meets bank manager.”

Below I’ll walk through the hardware, software pipeline, results, and lessons learned — plus some practical tips if you want to try this yourself.

What I built (overview)

  • Hardware: Raspberry Pi 5 + AI Hat (13 TOPS edition), 1080p USB webcam, powered from the car’s 12V socket via a high-power USB-C converter.
  • Software: segmentation model for plate detection see this post for more info, post-drive inference on the Pi, OCR via a PaddleOCR API on an x86 machine, registry lookups, and a Streamlit UI for control and reporting.
  • Workflow: record video while driving → run plate detection/inference (post-drive) → crop plates → OCR → query vehicle registry → store results in SQLite → generate reports.

Why this approach?

  • Edge capture + selective processing minimizes the amount of data you need to upload and analyze off-device.
  • Running segmentation on the Pi reduces video size by extracting only the regions of interest (number plate crops).
  • Running OCR on a separate x86 machine (via a simple API) gives better performance and flexibility — PaddleOCR works better for this use case than some alternatives on the Pi.
  • Streamlit makes building a quick control UI and report dashboard simple.

Hardware setup

  • Raspberry Pi 5 with the AI Hat (13 TOPS edition).
  • 1080p USB webcam (high-speed USB port on Pi).
  • USB-C power adapter connected to the car cigarette lighter / 12V output (use a high-power converter to supply the Pi + camera).
  • Phone hotspot to connect to the Pi for remote UI access.
  • A very professional camera mount: masking tape on the dashboard (hey, it worked).

Software pipeline (multi-stage)

  1. Record video on the Pi while driving (Streamlit UI to start/stop).
  2. Post-drive: run segmentation inference on the captured videos to detect plates and save crop images (this was the model I trained in the previous video — see that tutorial for training details).
  3. Post-processing: send plate crops to an OCR service (PaddleOCR) via a simple API running on an x86 machine.
    • I chose PaddleOCR for reliability and the option to fine-tune model behavior for license plates.
    • PaddleOCR didn’t run well on the Pi, hence the small API on an external CPU box.
    • I experimented with EasyOCR and LLM-based OCR (GPT-4o Mini), but found cost and rate-limiting issues with the LLM approach.
  4. Registry lookup: query the Norwegian registry/database to get vehicle registration info and whether there’s an outstanding loan on the car.
  5. Store results locally in SQLite and generate a report via the Streamlit UI.

Tools & libraries used

  • Raspberry Pi 5 + AI Hat (13 TOPS)
  • USB 1080p webcam
  • Streamlit (UI) + pipeline implementation github link
  • SQLite (local database)
  • Custom segmentation model (trained previously please contact me if you would like the model or training data)
  • PaddleOCR HTTP API github link
05 Processing and Running Inference

05 Processing and Running Inference

Results from a test run

  • Total crops processed: 406
  • License plates detected: 296
  • Registry matches performed: 141
  • Valid records reported: 61
    • With loans: 12
    • Without loans: 49
  • Observations:
    • ~20% loan rate among the valid records (12/61 ≈ 19.7%).
    • 31% of cars found were under 5 years old.
  • Notes: The pipeline reduced large video files (up to ~4 GB) into compact plate crops for OCR and database queries — an efficient edge + cloud tradeoff.

Why not do everything on the Pi?

You could try to run OCR and registry queries entirely on the Pi, but:

  • PaddleOCR is less friendly or slower to run on the Pi.
  • External HTTPS queries to registry APIs are still needed.
  • Doing initial segmentation on the Pi reduces the data you need to upload and limits off-device compute — good balance between edge and server processing.
06 Database Integration and Results

06 Database Integration and Results

Practical tips & gotchas

  • Use a high-quality power adapter — the Pi + AI hat + webcam can draw significant power.
  • Mount the camera securely (masking tape works for prototypes; use a proper mount for longer-term installs).
  • Record first and run inference post-drive if your priority is throughput (more plates captured) rather than real-time results.
  • PaddleOCR is robust and fine-tunable for license plates; LLM-based OCR may be very accurate but can be costly and rate-limited.
  • SQLite is a great local DB for prototypes — lightweight, reliable, no server required.
  • If you train your own segmentation model, test on a variety of lighting conditions and plate angles.

Ethics, privacy & legality (important)

Scanning and storing license plate data and checking registries can have legal and privacy implications depending on your country and use case. Before capturing, processing, or publishing personally identifiable information:

  • Check local laws on data collection and vehicle registration lookups.
  • Use the system responsibly — obtain consent when required, and secure any stored data.
  • Avoid deploying systems that could be used for intrusive surveillance.

Where to get the code / next steps

  • The video description includes a GitHub link to the simple PaddleOCR API and other code referenced in the build.
  • If you want to replicate the whole pipeline:
    • Read the previous post to learn how I trained the segmentation model.
    • Use the GitHub code for the PaddleOCR API and Streamlit UI as a starting point.
    • Tweak the OCR/segmentation models to match your country’s plate formats and fonts.
07 Conclusions and Final Thoughts

Conclusions and Final Thoughts

Final thoughts

This project shows how a Raspberry Pi 5 with an AI hat can form the backbone of a practical, edge-enabled license plate recognition system. It’s a neat exercise in balancing edge compute and off-device services: do enough work on the Pi to reduce data upload, but use server-grade OCR when you need reliability and performance.

If you would like any assistance with the code, model training, or hardware setup, please get in touch via github or bsky. I’m happy to help you get started on your own Raspberry Pi ANPR project!