Automated Trading Card Inventory: Raspberry Pi, Lego, and AWS Rekognition
Build a digital catalogue for your trading and collectible cards using a Raspberry Pi, a Lego‑based platform, and AWS services.
Story
When I uncovered a box of Magic: The Gathering cards, I wondered how many I owned and what they were worth. Manually logging each card would have been tedious, so I set out to automate the process. The solution combined a Raspberry Pi, a custom Lego platform, and AWS S3 with Rekognition.
The Process
- Capture the card title with a Raspberry Pi camera mounted on a Lego platform.
- Upload the images to an AWS S3 bucket for storage and batch processing.
- Run AWS Rekognition to extract text, then query a pricing API for current market values.
The Lego Platform
Instead of woodworking, I chose a medium Lego bin—an inexpensive, low‑impact solution that keeps cards safe. The design is inspired by a $7 card sorter I once owned. A rear servo spins a wheel that nudges one card forward at a time, while a front wheel keeps the deck stable. I taped a few cards together to add weight, ensuring only a single card moves per cycle. The camera sits a few inches above the platform, angled precisely to capture the title area.
The ribbon cable length was a minor challenge; a longer cable improves reliability.
The Hardware
The Raspberry Pi is ideal for running Python scripts that control the servos and capture images. Required components: two servo motors, a Pi camera, and a 5V power supply (connected to a breadboard for convenience).
The Code
All code is written in Python 2.7. One script powers the servos and takes photos; the second processes the images stored in S3 with Rekognition.
After loading a set onto the platform, run:
python mtg_servo.py <set_abbreviation>
This activates the servos, scans the cards, and writes each image to a folder named after the set abbreviation (e.g., M13). I achieved a throughput of roughly 20–25 cards per minute.
AWS S3 and Rekognition
While Tesseract and OpenCV are powerful, Rekognition offered greater ease of use and flexibility in lighting and positioning. With an AWS account—free to set up—you can process up to 5,000 images per month on the free tier. Images are uploaded manually (a quick guide is available) to an S3 bucket mirroring the local directory structure: /set_name/file.jpg.
The following screenshots demonstrate Rekognition’s high accuracy, even with imperfect photos.
Once all images are in S3, automate OCR and export the results to CSV:
python Rekognize_S3.py <set_abbreviation>
Out of 920 scanned cards:
- 619 were exact (67.3%)
- 201 were off by one letter (21.8%)
- 100 were off by more than one letter (10.9%)
Following OCR, I queried TCGplayer’s API for live pricing. The total value of commons, uncommons, and rares—excluding already‑valued cards—was approximately $275.
*Update 05/27/18: The Rekognition script now streams detected text to TCGplayer’s API in real time, writing results to a file. API access requires a short application process.
Closing
I hope this project sparks your own exploration of digital card cataloguing. I plan to extend the system to sports cards and other collectible sets. Happy scanning!
Source: Trading Card Scanner/Organizer
Manufacturing process
- Amber: From Ancient Resin to Scientific Treasure – History, Properties, and Modern Uses
- The Guillotine: History, Design, and Legacy
- Silicon: Properties, Production, and Market Outlook
- The Ukulele: From Portuguese Roots to Modern Craftsmanship
- The Complete Guide to the U.S. Chicken Industry: History, Production, and Quality Control
- Compost: The Ultimate Soil Enrichment Solution
- Gelatin: From Ancient Protein to Modern Applications – Production, Uses, and Safety
- The Greeting Card Industry: History, Production, and Future Trends
- The Evolution and Manufacturing of Modern Pin‑Tumbler Locks
- Vodka: From Ancient Distillation to Modern Production