lang:ende

A Robotic Bar and a Secure Cashless System for an IoT Graduation Event

·13 min read·

A Robotic Bar and a Secure Cashless System for an IoT Graduation Event

When a cross-semester group of Internet of Things students, alumni, and a few friends from other programs decides to throw a farewell party for their course, the dance floor is not the only thing that gets engineered. After eight years, the IoT program at our university is being shut down; the current cohort is the last to graduate from it. Several people in the group are passionate event techs, so lights, sound, and stage are covered. The rest had to reflect what these people had spent years working on: a robotic bartender, and a cashless payment system that wouldn't embarrass anyone in the room.

This article documents the technical decisions behind both systems. Where implementation details are still being finalized, I'll flag that explicitly.


Context and constraints

Around 500 guests are expected: friends, current students, alumni, and people from neighbouring programs. The event has no institutional funding. Everything runs on sponsorships, entry fees, and donated equipment time. That constraint shapes almost every design decision — no vendor SLA to fall back on, no operations team on call, no tolerance for a 45-minute outage at the bar.

The audience is also not a typical event crowd. Many attendees have embedded systems experience, have worked in industrial automation, or understand RF protocols well enough to probe weak implementations. This is relevant not as a threat model in a malicious sense, but as a quality bar: if something is held together with duct tape, someone will notice and say so publicly.


The robotic bartender

Hardware

The arm is a repurposed ABB industrial robot with an IRC5 controller — the class originally designed for pick-and-place or welding tasks on a factory floor. Industrial arms in this class are built for repeatability, not adaptability: they follow programmed trajectories with sub-millimeter precision, but they have no tolerance for anything being out of place. That's a useful property in a factory. At a party, it requires careful system design.

The arm is not driven through ABB's standard external interfaces (RWS or EGM). Instead, a custom RAPID program (SERVER.mod) runs on the controller and listens on a TCP socket at port 5000, speaking a small text-based instruction protocol. On the other end sits a Node.js library (abb-node) that wraps motion primitives — Cartesian and joint moves, tool, work object, zones, buffered paths — behind a JS interface. The choice is deliberate: socket messaging is primitive but transparent, debuggable with nc, and keeps the entire control stack inspectable.

End-of-arm tooling has been replaced with a custom cable-actuated gripper. The mechanism works like a bicycle brake: a motor mounted further back on the arm winds a cable under tension, the cable pulls the gripper jaw closed, and a return spring opens it again. Only the cable and the jaw itself extend to the tip. The primary design constraint was profile width — bottles sit in a standard crate with minimal spacing between them, and the gripper has to enter a slot without disturbing neighbors. Routing actuation force through a cable rather than placing a cylinder or gear stage at the fingertip is what makes that profile possible.

The cable is driven by a stepper motor with a TMC2209 driver. The TMC2209 is spoken to over UART directly from Node.js; the CRC8-protected datagram protocol and the necessary registers (VACTUAL for velocity, MSCNT for microstep position, SG_RESULT for stall detection) are implemented in a dedicated TypeScript library (case_motor_control).

Gripping glass bottles

Glass bottles are among the more difficult objects to grip reliably in an uncontrolled setting. The challenges stack up:

  • Geometry variation. Bottles are not cylinders. The shoulder, neck, and label area all have different diameters. A gripper sized for one section of the bottle may slip if the pick point drifts by a few centimeters.
  • Surface properties. Glass is smooth and, in a warm environment with condensation, wet. Silicone-tipped fingers or compliant pads provide significantly more friction than bare aluminum jaws and are the assumed choice.
  • Force limiting. Glass breaks under excessive clamping force, and it provides no tactile feedback that you're approaching that limit. The TMC2209 solves this via StallGuard4: the driver measures motor load via back-EMF and exposes it as a register value. Firmware closes the jaw until the StallGuard reading crosses a tunable threshold — that's both the stop criterion and the calibration knob. No pressure regulation, no separate force sensor, no break-beam detector. The same mechanism is used to home the gripper against a mechanical hard stop.
  • Orientation consistency. The arm can only grip reliably if bottles are presented in a known orientation. That implies a structured storage area — a rack with fixed slots — rather than a loose bin. Bottles sit in a 5×4 grid (A1–E4, 20 slots), and the robot moves to a calibrated Cartesian pose with quaternion orientation for each slot.

The slot coordinates are not hard-coded in robot code but stored in a backend database, read at runtime, and adjustable via a calibration API while the system is live. That separation is deliberate: mechanical drift between rack and arm should never trigger a redeploy.

Safety and the enclosure

Industrial robots are not safe to be near during operation. The arm operates fast enough and with enough force to cause serious injury. The entire installation sits inside a Brühl Safety machine guarding fence — the same type used in production environments — with controlled access points.

The access points use safety-rated interlock switches: when a gate is opened, power to the arm's drive system is cut before the gate is fully open. This is standard practice (think ISO 10218 or the corresponding Machinery Directive requirements), and using off-the-shelf safety fencing means the hardware is already rated for the application rather than requiring custom certification.

Guest interaction with the robot is indirect. A guest approaches a terminal outside the fence, places their order (and pays, via the RFID system described below), and the robot fulfills it by moving the bottle to a handoff position inside a pass-through hatch — a small opening in the fence with a physical barrier that prevents a hand from reaching inward while the robot is moving. The bottle is collected from outside the hatch. The robot does not reach toward the guest.

This architecture separates human and robot interaction zones entirely. It adds latency, but it eliminates the need for collaborative robot features — force-limited operation, proximity sensing, dynamic path replanning — that would require significantly more integration work.

Throughput

At 500 attendees over a four-hour event, even a modest drink-consumption rate implies meaningful throughput requirements. A rough estimate: if 40% of attendees order one drink from the robot bar over the event duration, that's 200 orders, or roughly one every 70 seconds. A cycle time of 30–45 seconds per bottle — pick, move to hatch, release, return to home — is achievable with a well-tuned industrial arm.

Restocking is handled by a feed runway that extends into the robot's workspace from outside the enclosure. Helpers push full bottle crates onto the runway from the external end; during quieter service moments, the robot picks bottles from those crates and transfers them into its internal slot rack. This removes restocking from the event schedule entirely, without anyone entering the enclosure — the gate stays closed throughout service, and the safety interlocks are never triggered. The crates on the runway are not slot-calibrated; the robot runs a standard sweep over the expected crate positions and handles the sort into its calibrated internal slots itself.

Software stack

The backend (case_backend) is a Fastify service with BullMQ as the job queue, Redis as the queue store, and Prisma/SQLite for persistent configuration and scan history. Jobs — pick-and-place, crate ejection — land in a queue with concurrency 1. That's not incidental: the arm must never attempt two motions simultaneously, and a hard queue-level serialization enforces that at the infrastructure layer rather than relying on disciplined application code.

A WebSocket interface pushes state changes (queue depth, job lifecycle, crate state) to connected clients — including a Nuxt frontend (case_bottle_mapper) that visualizes the slot grid and lets operators intervene manually. The high-level API is deliberately small: POST /dispense takes a drink type, finds a matching available slot, and queues the job. No closed-loop force control, no dynamic path planning — simple, predictable, debuggable at 11pm.


The RFID payment and ticketing system

Why not cash or a simple prepaid system

The decision to use a contactless smart card system rather than cash, or a simple QR-code ticket, comes down to three factors: operational flow, safety, and the audience.

Cash at a 600-person event means cash floats at every station, counting errors, theft risk, and slow transactions. QR codes are fine for entry but require a network-connected scanner for every payment, and their security is only as strong as the link between scan and backend — replayable if not carefully implemented. A stored-value card with on-card balance is fast, works partially offline, and puts no money in a till.

The question then is which card technology. MIFARE Classic would be the cheap answer. It would also be the wrong one. MIFARE Classic has been broken since 2008; cloning a card takes under a minute with off-the-shelf hardware. In front of an audience where a meaningful fraction carries NFC-capable phones and knows what mfoc is, issuing Classic cards as real-money tokens is not an option.

MIFARE DESFire

DESFire is MIFARE's application-oriented platform. Each card has a structured filesystem — applications containing files — and every read or write to a protected file requires a successful mutual authentication exchange using AES (or 3DES on older versions). The card itself performs the cryptographic operations; it is not a passive memory chip.

The security properties targeted for this deployment — framed as design intent, because the actual crypto implementation lives inside a closed-source daemon (EventAuth) that initializes the cards and executes the protected read/write operations:

  • Cloning resistance. The card's UID is not the secret — authentication requires knowledge of the application key. A cloned UID without the key is useless.
  • Per-application isolation. The ticketing application and the payment application should be keyed separately. A reader at the food stand can access the payment balance without being able to read or modify the ticketing data, because it only holds the payment application key.
  • Diversified keys. Rather than a single global key for all cards, each card's application key is derived from a master key and the card's UID using a key diversification function (CMAC-based, per NXP AN10922). A compromised reader terminal leaks only a single card's derived key, not the ability to forge arbitrary cards.

The trade-off for all of this is implementation complexity. DESFire initialization is significantly more work than sticking a hex string into a MIFARE Classic block. That work is done once — at issuance time — and runtime behavior is fast enough for tap-and-go payment.

Card lifecycle

Cards are initialized at purchase. At runtime, a card has one of several states that matter to the readers: valid (initialized, ready to use), used (entry has been recorded, but the card is still usable for top-ups and POS transactions), master (staff card with unlimited credit), blank (not yet personalized), foreign (belongs to a different event), and invalid (legacy or unreadable). The distinction between valid and used matters: it prevents the same entry being recorded twice without rendering the card useless for everything that follows.

The payment balance is decremented at each point of sale. Because the balance lives on the card, offline transactions are possible — a reader that can't reach the backend can still authorize a debit by doing the AES exchange locally and writing the new balance to the card. Backend sync happens when the reader reconnects. This is a meaningful operational resilience property: a Wi-Fi dropout doesn't take the bar down.

Terminal hardware

The top-up terminal is a self-contained piece of furniture with a laser-cut enclosure (ausgabe/, topup_terminal/). The software stack:

  • Host: a Raspberry Pi 3 running a Node.js/TypeScript service.
  • Card reader: Hopt+Schuler 855T — a motorized dual-antenna reader that draws the card in, holds it during the transaction, and ejects (or retains) it on completion. Advantage over a tap-reader: a defined contact window, no accidental double-payment from re-tapping. The catch was that the vendor SDK didn't run on ARM; the USB protocol was reverse-engineered from Windows-side packet captures (opcodes 0xCA intake, 0xC1 move, 0x41 LED set, etc.) and reimplemented in TypeScript.
  • DESFire backend: the EventAuth daemon is spawned as a subprocess and addressed over line-based JSON IPC (dumpinfo, topup, pos, personalize, format). All AES operations and key derivation happen there — the Node service sees only commands and results.
  • Barcode scanner: Symbol/Zebra MS4717 in SSI mode over USB-serial — for QR voucher codes (pre-purchased tickets, pay-at-terminal tokens). Heartbeats every 45 seconds and auto-reconnect, because the hardware silently falls foul of Linux USB autosuspend on idle.
  • Display and feedback: a 16×2 HD44780-compatible LCD driven by an Arduino, which also handles the cancel button, a servo for the dispense push, and an RGB LED bezel with a six-color status palette (idle green → reading blue → QR cyan → pay orange → success bright green → error red). Card presence itself is detected by a photointerrupter.

A second top-up terminal with its own laser-cut housing (topup_terminal_laser/) is in preparation but not yet operational at the time of writing.

Backend architecture

The system has two backends with clearly separated responsibilities:

  • tickets_l4b_dev — a Nuxt application with Prisma on a Neon-hosted PostgreSQL instance, Resend for email, SumUp for payments. This is where pre-sales happen, where QR vouchers are generated, where SumUp reader webhooks are handled, and where promos and refunds are administered.
  • case_backend — Fastify + BullMQ, dedicated to the robot pipeline (described above).

Card issuance (ausgabe/) is currently a manual CLI activity: blank cards are inserted into a reader, the EventAuth personalize command writes ticket number and initial balance. A graphical issuance UI doesn't exist yet; the physical kiosk is built, the software wrapper around it is the open task of the coming weeks.

SumUp and pay-at-terminal

The first top-up at card purchase happens online through tickets_l4b_dev (web checkout, QR voucher emailed as a ticket). During the event itself, there's also a pay-at-terminal path: the guest inserts their card into the Hopt+Schuler reader, scans a voucher or picks an amount, the terminal posts a signed token to the charge API, the backend uses it to charge the paired SumUp reader, and on confirmation the terminal writes the new balance to the card via EventAuth. To prevent double-crediting, the terminal keeps a local SQLite blacklist of already-redeemed tokens.

Key management

Key management is the part most implementations get wrong. The master key used for diversification must not be stored on reader terminals. Terminal-side key derivation should happen either at issuance time (pre-computing per-card keys and storing them in a terminal-side key vault) or via a call to a key derivation service at transaction time. For an event of this size, pre-computation at issuance and encrypted storage on terminals is probably the right trade-off — it avoids runtime latency and network dependency, and the threat model doesn't require hardware security modules.

The master key itself lives offline, used only during issuance. This is standard HSM-adjacent practice applied without the HSM.


What this project actually demonstrates

It would be easy to frame the robotic bar as a spectacle and the payment system as logistical infrastructure. They're both more than that.

The robotic system is a real integration problem: industrial hardware designed for a controlled factory environment, redeployed into an uncontrolled social one, with safety requirements that can't be relaxed just because the setting is informal. The constraints — fragile objects, human proximity, throughput pressure, no vendor support — are representative of real embedded and robotics engineering challenges.

The payment system is a case study in security-proportionate design. The decision to use DESFire over simpler alternatives is not about being clever. It's about correctly assessing the threat model — a technically literate user base, real monetary value on the cards — and choosing a technology that matches it. The key diversification pattern, the offline-capable architecture, the application isolation: these are standard practices in deployed ticketing systems, applied at student-project scale.

Alongside those, there's a third, smaller system: an ESP32-C3 driving a WS2812B LED strip that guests can flash and configure themselves in advance, via a Web Serial tool in their browser, to synchronize their outfit to the venue lighting. It doesn't solve an engineering problem in the same sense as the other two — but it's a nice reminder that IoT was originally interesting partly because you can build things that are simply fun.

All three systems have to work reliably, on hardware the team owns, with no institutional fallback, in front of people who will notice if they don't.

That's the kind of constraint that produces good engineering.


This article was written ahead of the event and reflects the current design. Some implementation details remain subject to change as integration work continues.