We didn't just throw parts on a breadboard. The PCB is a custom 2-layer board designed in KiCad 7.0. It routes the I2C bus, power distribution for solenoids, and screw terminals for each reed switch. The enclosure is a stack of 3D-printed PLA trays — each tray holds four lockers. We used Fusion 360 for the mechanical design and printed on a Bambu Lab X1 Carbon. Took about 14 hours total print time.
The firmware is written in C using the WiringPi library on Raspberry Pi OS Lite (64-bit). The Nayax integration uses a custom serial protocol — we send a simple ASCII command like `PAY 1.50` and get back `APPROVED` or `DECLINED`. No JSON, no REST, just clean serial.
Applications
This isn't a one-trick pony. We've deployed variants for:
- Workshop tool checkouts — mechanics grab a socket set, scan their badge, door pops open
- Pharmacy lockers — prescription pickup with insurance card reader (Nayax handles the PCI compliance)
- Electronics component vending — resistors, caps, dev boards in individual cubbies
- Food truck pickups — pre-ordered meals stored in temperature-controlled lockers
The key is the customizable vending machine architecture. You can swap the Nayax for a different terminal, change locker sizes by editing the 3D model, or add sensors (we're testing a load cell for weight-based inventory detection).
Future Improvements
We're working on three upgrades:
Battery backup. A 12V 7Ah SLA battery keeps the system running for 4 hours during power outages. The Pi will gracefully shut down if the battery drops below 11V.
Matter protocol support. We're porting the MQTT layer to Matter over Thread using an nRF52840 as a coprocessor. This lets the lockers integrate with smart home systems — imagine your Google Home telling you "Package delivered to Locker 3."
AI-assisted restocking. We're training a YOLOv8 model on images from a USB camera to detect empty lockers. Initial tests show 94% accuracy on a dataset of 200 images. Overkill? Maybe. Fun? Absolutely.
Conclusions
This project proves you don't need a million-dollar contract with a vending machine OEM to build a smart retail system. With a Raspberry Pi, a Nayax terminal, and some off-the-shelf hardware, you can create a personalized vending machine that handles real payments, reports live data, and fits your exact product dimensions.
We're an IoT product development company that ships working prototypes — not PowerPoint slides. If you need a similar system for your business, we can take this reference design and adapt it to your use case. Same architecture, different form factor. That's the point.
The files are on GitHub (KiCad schematics, Fusion 360 models, and the full firmware). Go build one. Then tell us what you broke — we'll help you fix it.
Himanshu Dada
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.