An end-to-end smart archiving system that captures classroom whiteboard content, processes the image with computer vision and OCR, and generates a searchable PDF archive.
The system combines an Arduino-based capture trigger, Raspberry Pi camera, Bluetooth communication, a Flask backend, OpenCV image processing, EasyOCR, and ReportLab PDF generation.
The system is designed to simplify the process of archiving classroom whiteboard content.
A capture request starts on the Arduino and is transmitted through Bluetooth to a Raspberry Pi. The Raspberry Pi captures an image and sends it to the Flask application over the local network. The Flask application removes shadows from the image, extracts text using OCR, generates a PDF containing the processed image and extracted text, and makes the resulting documents available through a web interface.
Arduino Capture Trigger
↓
Bluetooth HC-05
↓
Raspberry Pi
↓
Camera Capture
↓
HTTP Upload
↓
Flask Application
↓
OpenCV Image Processing
↓
EasyOCR Text Extraction
↓
ReportLab PDF Generation
↓
Web Archive
The main processing logic is implemented in Python rather than relying on an external document-archiving framework.
flowchart TD
A[Arduino Capture Trigger] --> B[Bluetooth HC-05]
B --> C[Raspberry Pi Listener]
C --> D[Camera Capture]
D --> E[HTTP Upload]
E --> F[Flask Backend]
F --> G[OpenCV Preprocessing]
G --> H[EasyOCR]
H --> I[ReportLab PDF Generation]
I --> J[PDF Archive]
J --> K[Web Interface]
The system separates the capture hardware from the document-processing backend.
The Arduino and Raspberry Pi handle the physical capture workflow, while the Flask application performs image processing, OCR, PDF generation, and archive management.
A short preview of the system's capture and PDF generation workflow is shown below. The full demonstration video covers the complete process from whiteboard capture through processing and PDF generation.
Full demonstration video (MP4)
The Arduino acts as the physical capture trigger.
The project uses:
- Keypad input
- SoftwareSerial communication
- Bluetooth HC-05 communication
When a capture request is triggered, the Arduino sends the CAPTURE command to the Raspberry Pi.
The Raspberry Pi acts as the capture station.
Its responsibilities include:
- Connecting to the Arduino through Bluetooth
- Listening for capture commands
- Capturing an image using the camera
- Temporarily saving the captured frame
- Sending the image to the Flask server over HTTP
The Pi-side listener is implemented in listener.py.
The Flask application is the main processing component.
It provides:
- Web interface
- Image upload endpoint
- PDF archive listing
- PDF download
- PDF deletion
- Image processing and OCR
- PDF generation
The main application is implemented in app.py.
When an image is uploaded, the backend performs several processing stages.
The uploaded image is saved under the captures/ directory.
The application verifies that the image can be loaded successfully with OpenCV.
Classroom whiteboards can contain uneven lighting and shadows.
The application processes each color channel separately using:
- Morphological dilation
- Median blurring
- Background estimation
- Absolute difference
The processed channels are then merged into a cleaned image.
The resulting image is saved as a separate _cleaned.jpg file.
EasyOCR is used to extract text from the cleaned image.
Only OCR results with a confidence value above 0.3 are included in the extracted text.
The extracted lines are then combined into a text block for the generated PDF.
ReportLab is used to generate the final document.
Each generated PDF contains:
- A lecture archive title
- The processed image
- Extracted OCR text
- A timestamp-based filename
Generated documents are stored under the pdfs/ directory.
The project includes a small Flask/Jinja web interface for managing the generated archive.
The interface provides:
- A list of generated lecture PDFs
- PDF download buttons
- PDF deletion
- Password confirmation for deletion
- An empty-archive state
The interface is implemented as a single HTML template with Bootstrap RTL styling and Arabic language support.
The UI is intentionally lightweight; the main focus of the project is the capture, processing, OCR, and archiving pipeline.
The backend exposes an upload endpoint:
POST /upload
The Raspberry Pi sends the captured image as a multipart file upload.
A successful request returns a JSON response containing the processing status and generated PDF filename.
Example response:
{
"status": "processed",
"pdf": "lecture_YYYYMMDD_HHMMSS.pdf"
}The application also provides routes for:
GET /
GET /download/<filename>
POST /delete/<filename>
smart-archiving-system/
├── app.py
├── listener.py
├── arduino_part.cpp
├── start_capture.sh
├── requirements.txt
├── requirements_on_pi.txt
├── requirements_on_arduino.txt
├── templates/
│ └── index.html
├── captures/
├── pdfs/
└── README.md
Contains the Flask backend and document-processing pipeline:
- Flask routes
- Image upload handling
- OpenCV preprocessing
- EasyOCR text extraction
- PDF generation
- Archive listing
- PDF deletion
Contains the Raspberry Pi capture client:
- Bluetooth serial communication
- Capture command handling
- Camera access
- HTTP upload to the Flask backend
Contains the Arduino-side capture trigger and serial communication logic.
Automates Raspberry Pi startup:
- Bluetooth initialization
- HC-05 pairing/trust
- RFCOMM binding
- Listener startup
Contains the web interface used to browse, download, and delete archived PDFs.
The Flask backend requires an administrator password to be provided through an environment variable:
export ADMIN_PASSWORD="your-password"The Raspberry Pi listener requires the IP address of the computer running the Flask application:
export LAPTOP_IP="YOUR_LAPTOP_IP"These values are intentionally kept outside the source code.
The main Flask application requires:
- Python 3
- NumPy
- OpenCV
- EasyOCR
- Flask
- ReportLab
Install the application dependencies with:
pip install -r requirements.txtThe Raspberry Pi listener requires:
- Python 3
- OpenCV
- Requests
- PySerial
- Bluetooth/RFCOMM support
See requirements_on_pi.txt for the Pi-side dependencies.
The Arduino side uses:
- Keypad
- SoftwareSerial
See requirements_on_arduino.txt.
On the computer running the Flask backend, set the administrator password and start the application:
export ADMIN_PASSWORD="your-password"
python3 app.pyThe Flask server listens on port 5000.
From the Raspberry Pi, configure the address of the Flask host:
export LAPTOP_IP="YOUR_LAPTOP_IP"Then start the capture station:
./start_capture.shThe Raspberry Pi waits for the Arduino capture command, captures an image, and sends it to the Flask upload endpoint.
The web interface can be accessed from another device using the Flask host's LAN address:
http://YOUR_LAPTOP_IP:5000
A complete capture cycle works as follows:
- The user triggers a capture through the Arduino.
- The Arduino sends
CAPTUREthrough the Bluetooth connection. - The Raspberry Pi receives the command.
- The Pi captures an image from the camera.
- The image is uploaded to the Flask server.
- Flask preprocesses the image using OpenCV.
- EasyOCR extracts text from the processed image.
- ReportLab generates a PDF.
- The generated PDF is stored in the archive.
- The web interface displays the available document.
The current project does not contain an automated test suite.
The main processing pipeline can be tested by running the Flask application and sending an image to the upload endpoint.
- Python
- Flask
- NumPy
- OpenCV
- EasyOCR
- ReportLab
- Requests
- PySerial
- Arduino
- Raspberry Pi
- Bluetooth HC-05
- Bootstrap
The project focuses on integrating several independent components into a single working system:
- Hardware-triggered image capture
- Bluetooth serial communication
- Raspberry Pi camera integration
- HTTP client/server communication
- Image preprocessing with OpenCV
- OCR-based text extraction
- Programmatic PDF generation
- File-based document archiving
- Web-based archive management
- Environment-based configuration
The project demonstrates an end-to-end workflow where physical input is transformed into a processed and archived digital document.
This project was developed as an integrated hardware/software system rather than as a production document-management platform.
The implementation prioritizes demonstrating the complete capture-to-archive workflow, including communication between the Arduino, Raspberry Pi, and Python backend.
