The catch was their existing solution relied on aging, proprietary controllers that were expensive to source and a nightmare to update.
They weren't just storing packages. They were renting out premium equipment—cameras, drones, even camping gear—to customers who expected a seamless, card-tapping experience. The hardware they had couldn't handle modern contactless payments without bolting on a clunky external reader. Worse, firmware updates required a technician on-site with a laptop.
They needed a system that could handle secure access control, real-time inventory tracking, and cashless payments out of the box. And they needed it yesterday.
Why Raspberry Pi Made Sense (and Why It Usually Doesn't)
We hear "just use a Raspberry Pi" a lot. For production hardware, we usually push back. The Pi is a development board, not a hardened industrial controller. But for this specific use case, it was actually the right call.
Here's why: The client needed a custom built vending machine—essentially, that's what a smart locker is—with a heavy emphasis on connectivity and remote management. The Pi (specifically the Compute Module 4) gave us the flexibility to design a custom carrier board with the exact I/O we needed, without the massive lead times associated with custom ASICs or high-end MCUs.
We paired the CM4 with a custom carrier board we designed in KiCad. This board handled the heavy lifting: driving the electronic locks (we used 12V solenoid locks with a feedback sensor to confirm open/closed state), managing the LED status strips, and reading the door reed switches.
The Pi handled the brain work: running the application logic, managing the local database, and communicating with the cloud. It's overkill for blinking an LED, but perfect for handling TLS encryption, WebSocket connections, and local caching if the internet drops.
The Payment Integration: Nayax and the Cashless Conundrum
The trickiest part of this project wasn't the lock mechanism—it was the money.
We integrated the Nayax VPOS Touch (their Android-based payment terminal). This device handles all the PCI compliance, EMV chip reading, and NFC/contactless payments (Apple Pay, Google Pay). That's a huge burden off our shoulders; we don't want to mess with raw card data.
The challenge was the communication protocol between the Pi and the VPOS. Nayax uses a specific serial protocol (VPOS Protocol) over USB or TTL serial. We had to write a custom driver in Python to handle the handshake.
Here's how the flow works in our firmware:
1. User taps a locker on the touchscreen (we used a 7" HDMI display).
2. The Pi sends a "sale request" to the VPOS via serial.
3. The VPOS wakes up, prompts for payment, and processes the transaction.
4. The VPOS sends back a "sale response" with a unique transaction ID.
5. The Pi validates the response, checks the amount, and then triggers the relay to unlock the specific locker door.
We spent a week debugging the serial timing on this. The VPOS is picky about acknowledgment frames. If you don't send the ACK within 500ms, it assumes a failure and rolls back the transaction. Our Python driver needed to run in a dedicated thread with high priority to ensure we never missed that window.
Custom Built Vending Machine Mechanics: The 3D Design and PCB
While the Pi handled the logic, the physical layer needed to be reliable. We designed the entire control board in-house. The PCB includes:
- Relay Drivers: ULN2003A ICs to switch the 12V solenoid locks safely.
- Current Sensing: We added a current sense resistor on the lock circuit to detect if a lock is jammed. If the current spikes too high, the firmware cuts power and sends an alert. This prevents burned-out coils.
- Power Management: A buck converter to step down the 24V input (from the main PSU) to 5V for the Pi, and a separate regulator for the 3.3V logic.
For the physical housing, we handled the 3D design for the bezels and the mounting brackets for the VPOS terminal. We printed prototypes in PETG to test the fitment, then moved to injection molding for the final production run. The PCB was designed to fit snugly inside the locker's control compartment, with the Pi mounted on standoffs.
The "Overnight Shipping" Factor
One of the reasons we chose the Pi was the development speed. We had a working proof-of-concept on a bench in three days. But the real value was in the production logistics.
Since the client needed these lockers in multiple states, we designed the firmware to be "headless" and self-configuring. On boot, the Pi connects to our MQTT broker (via Wi-Fi or Ethernet). It downloads the latest configuration and locker assignments.
If a locker needs to be reassigned from "parcel" to "rental," the client just changes it in their dashboard. The Pi picks up the change on the next heartbeat. No re-flashing, no physical access required.
The Result: A Viable, Scalable System
The system has been live for over a year now. We shipped the initial batch of 50 lockers with full firmware and hardware support.
The uptime has been solid. The main issues we've encountered weren't with the Pi or the custom board, but with the off-the-shelf power supplies failing in high-heat environments. We've since specified a higher-grade PSU.
From a business perspective, the client's revenue per locker increased by 40% because they could finally accept mobile wallets, which their previous system couldn't. The remote management capability also cut their field service costs significantly—they no longer need to send a technician to change pricing or unlock a jammed door.
Our Takeaway
This project proved that a Raspberry Pi can be the heart of a commercial-grade device if you treat it with respect. You can't just slap a Pi on a table and hope it works in a vending environment. You need custom carrier boards, proper power conditioning, and robust error handling in the firmware.
If you're looking to build a
custom built vending machine , a kiosk, or any IoT device that needs to take payments and control physical hardware, the architecture is proven. It just takes careful engineering to make it bulletproof.
We handle the full stack—from the KiCad schematic to the final prototype shipping. If you have a project that needs this level of integration, we'd be happy to talk through the mechanics and the firmware with you.
Discussie (0 opmerking(en))