Skip to main content
Version: FILS English

Scanny, the GuardBot

An autonomous robot that patrols a parking lot and scans license plates.

info

Author: Anastasiu Antonia-Maria
GitHub Project Link: https://github.com/UPB-PMRust-Students/fils-project-2026-antoanastasiu96-dotcom

Description

Scanny is an autonomous patrol robot designed to scan and verify license plates in a private parking lot, running firmware written in Rust on two Raspberry Pi Pico 2W microcontrollers. When a button is pressed, the robot begins patrolling. It uses an ultrasonic sensor to detect nearby objects. Once close enough to one, it stops and the servo motor rotates the camera for up to 10 seconds, scanning for a license plate. If no plate is detected, the robot assumes the object is not a vehicle and continues. If a plate is found, the ESP32-CAM captures a photo and the system checks the number against a registered vehicles database. A valid plate triggers a green LED, a short beep and a "NUMBER VALID" message on the display. An unregistered plate triggers a red LED, a longer beep, a "NUMBER NOT FOUND" message and the plate is automatically saved to a separate database. The robot then continues its patrol regardless of the outcome.

Motivation

The inspiration for this project came from the security guard at my campus, who spends his days and nights patrolling between parked cars, writing plate numbers in a small notebook and checking them manually against a list. The work is repetitive and exhausting. I wanted to build something that would take over the most demanding part of that routine, so he could focus on managing the situation rather than doing the physical patrol himself. Beyond the practical side, the project gave me the chance to work with embedded systems, wireless communication, computer vision and real-time control all at once, which made it a genuinely challenging and rewarding build.

Architecture

The system uses a dual-controller architecture supported by an external vision server to manage high-latency tasks without interrupting robot movement.

Control & Debugging: The primary Pico 2W runs an async Embassy executor managing motor control, sensor polling and feedback. A secondary Pico 2W acts as a Picoprobe via SWD for hardware debugging and real-time logging via probe-rs.

Power: Two Samsung INR18650-35E 3450mAh lithium-ion cells wired in series supply 7.4V to the L298N motor driver. The motor driver regulates and passes power to the Pico 2W via the VSYS pin, allowing the entire system to run from a single battery pack without a separate power supply for the microcontroller.

Motion: The L298N motor driver receives GPIO signals from the Pico 2W to control the direction of four DC motors independently. The robot moves forward/backwards/left/right during patrol and stops when the ultrasonic sensor detects an object within the configured threshold distance (5cm for example).

Sensing & Input: The HC-SR04 ultrasonic sensor is connected via GPIO, with a voltage divider on the ECHO pin to bring the 5V signal down to 3.3V for safe Pico operation. Two push buttons handle start and stop commands, also read as GPIO inputs with internal pull-up resistors.

Feedback: A red and green LED pair gives immediate visual status: green for a registered plate, red for an unregistered one. A passive buzzer driven by PWM emits distinct tones to differentiate between the two outcomes. An OLED SSD1306 display connected via I2C shows the scanned plate number and its validation result in real time (FOUND OR NOT FOUND).

Vision & OCR: The SG90 servo motor, controlled via PWM, continuously rotates the ESP32-CAM to scan the area in front of the robot. Once a license plate is detected, the servo stops and the ESP32-CAM captures a still image. The image is transmitted over Wi-Fi via an HTTP POST request to a Python Flask server running on the development laptop. The server processes the image using EasyOCR and OpenCV, queries a SQLite database of registered vehicles and returns the validation result to the ESP32-CAM. The result is then forwarded to the Pico 2W over UART, which triggers the appropriate LED, buzzer and OLED response.

Laptop <================ USB ================> Picoprobe Debugger
^ |
| | SWD
| v
| +------------------------------------ Pico 2W (Master)
| | | | | | | | |
| | v v v v v v v
| | HC-SR04 Buttons LEDs OLED SG90 Buzzer ESP32-CAM
| | Sensor (Start/ (Status)Display Servo (Audio) (Camera)
| | (GPIO) Stop) (GPIO) (I2C) (PWM) (PWM) (UART)
| | (GPIO) |
| WiFi | |
+------+--------------------------------------------------+
|
| GPIO (Control) & VSYS (5V Power)
|
v
L298N Motor Driver <---------- 7.4V ---------- 18650 Batteries x2
|
v
DC Motors (x4)

Log

Week 1 - 4

  • Thought about what kind of project I wanted to build.
  • Explored several directions and looked into different component options.
  • Studied how license plate recognition works and how ESP32-CAM handles image capture and WiFi communication.

Week 5 - 6

  • Settled on the final concept and placed the orders.
  • Once the components arrived, started with the easier assembly parts like mounting the wheels and fitting the chassis together.

Week 7 - 8

  • Moved on to integrating the accumulators, the push button, the L298N motor driver module and the HC-SR04 ultrasonic sensor.
  • By the end of this period the robot was able to move on its own, navigating with the help of the ultrasonic sensor without any manual intervention.

Hardware

The Prototype Chassis: The robot is built on a 4WD transparent chassis with DC motors driven by an L298N motor driver. Two Raspberry Pi Pico 2W boards handle control and feedback respectively. An ESP32-CAM with OV2640 2MP camera is used for image capture. An HC-SR04 ultrasonic sensor detects obstacles, while an SG90 servo motor rotates the camera during scanning.

Feedback and Power: A 0.96" OLED display (128x64) shows status messages. Red and green LEDs and a passive buzzer provide immediate visual and audio feedback. Power comes from two Samsung INR18650-35E 3450mAh batteries in a dual holder. A CH340G USB-to-UART converter is used for uploading code to the ESP32-CAM.

Schematics

img

Photos of the robot (in progress)

img img

Component Connections:

ComponentInterfacePico 2W Pins
HC-SR04 UltrasonicGPIOTRIG: GP20, ECHO: GP22 (voltage divider), VCC: VSYS, GND: GND
L298N Motor DriverGPIO x4IN1: GP10, IN2: GP11, IN3: GP14, IN4: GP15
SSD1306 OLEDI2CSDA: GP26, SCL: GP27
SG90 ServoPWMGP2
ESP32-CAMUARTTX: GP4, RX: GP5
PicoprobeSWDSWDIO, SWCLK, GND
Start ButtonGPIO inputGP16
Stop ButtonGPIO inputGP17
BuzzerPWMGP3
Red LEDGPIOGP13
Green LEDGPIOGP12

Bill of Materials

DeviceUsagePrice
Raspberry Pi Pico 2W (x2)Main microcontroller and dedicated debugger79,32 RON
ESP32-CAMImage capture and WiFi communication53,89 RON
Wheels with Motors (4x)Robot mobility~40-50 RON
L298N Dual Motor DriverDC motor control10,99 RON
SG90 Servo MotorCamera rotation~15 RON
HC-SR04 Ultrasonic SensorObstacle detection~7 RON
0.96" OLED Display (I2C)Status messages~20 RON
LEDs (Red + Green)Visual feedback~2 RON
Passive BuzzerAudio feedback~1 RON
Push ButtonStarts the patrol~0,40 RON
Samsung 18650 Battery (x2)Power supply34,49 RON
Dual 18650 Battery HolderBattery housing3,99 RON
18650 Dual ChargerBattery charging19,99 RON
CH340G USB to UARTESP32-CAM programming9,99 RON
Jumper Cables (40-Pin)Interconnections8,28 RON
BreadboardPrototyping~10 RON
ResistorsCircuit protection~5 RON

Software

LibraryDescriptionUsage
embassy-rpHAL for RP2350Core peripheral access for GPIO, I2C, PWM, UART on the Pico 2W
embassy-executorAsync task executorRuns concurrent tasks such as motor control and sensor reading
embassy-timeTime managementHandles delays, timers and timeouts
embassy-syncSynchronization primitivesSafe communication between async tasks
embedded-halHardware abstraction traitsStandard interface for embedded peripherals
embedded-hal-asyncAsync HAL traitsNon-blocking peripheral communication
cyw43CYW43439 WiFi driverManages WiFi on the Pico 2W
cyw43-pioPIO-based SPI for CYW43Handles SPI communication between RP2350 and the WiFi chip
embassy-netAsync networking stackTCP/IP communication with the laptop server
defmtLogging frameworkDebug output from the Pico
defmt-rttRTT transport for defmtTransfers logs over debug probe
ssd1306OLED display driverControls the 0.96" OLED display over I2C
  1. Raspberry Pi Pico 2W Datasheet
  2. Embassy Book
  3. EasyOCR Documentation
  4. ESP32-CAM Getting Started
  5. Embedded Rust Book