Gyms are a strange retail environment. Members show up sweaty, in a hurry, and often without a wallet. They want a protein shake, a bottle of water, maybe a pre-workout sachet — and they want it in under a minute. A standard snack machine with a coin slot doesn't fit that behavior. Over the past few years we've built connected vending hardware for several fitness clients, and the pattern is consistent: the machine has to work without cash, report its own status, and know what's running low before a member finds an empty row.
Here's how we approach a vending machine fitness centers can actually rely on, from the electronics up.
The hardware stack
Most of our builds start with an ESP32-S3 for the main controller. It gives us Wi-Fi and BLE on one chip, enough GPIO for a 12-column motor driver board, and headroom for a small display running LVGL. For machines that need cellular fallback (basements, older buildings with bad Wi-Fi), we pair it with a SIM7080G module over UART.
The payment side is where people underestimate the work. A card reader from a vendor like Nayax or Ingenico handles EMV and contactless, but it talks to your controller over serial or MQTT, and you need a clean state machine to handle declines, timeouts, and refunds. We run that logic on the ESP32 with a watchdog, so a hung reader never leaves a member charged with no product dispensed.
For the dispensing mechanism itself, we use optical sensors on each auger or spiral to confirm a product actually dropped. Without that feedback, you're trusting the motor — and motors stall. A $0.40 IR sensor pair saves you from a lot of refund tickets.
Payments that match how people buy at a gym
Members typically carry a phone and a gym card, not cash. We support three paths:
- NFC tap using the reader's contactless interface
- QR payment via a 4-inch display showing a UPI or wallet code, refreshed per transaction
- Gym membership account — the machine pulls the member ID from a card scan and debits a stored balance through the gym's API
That third path matters more than it sounds. When a fitness center ties vending to membership, attach rates go up because there's no payment friction at all. We've seen machines where 60% of transactions run through the member account rather than card.
IoT monitoring: what the machine should report
A vending machine in a gym sits unattended for hours. The telemetry layer is what keeps it from becoming a maintenance headache. Our firmware publishes to an MQTT broker over TLS, typically every 60 seconds, with:
- Per-column stock counts (derived from dispense events, reconciled against sensor confirmations)
- Temperature and door-open state
- Motor fault codes and sensor mismatches
- Payment terminal health and last successful transaction timestamp
- Signal strength and uptime
On the backend, we run a small service that turns this into alerts. If a column drops below three units, the operator gets a restock ping. If the door sensor trips outside a scheduled window, that's a tamper alert. If the machine hasn't phoned home in 15 minutes, someone checks it.
We've also wired in a simple rule engine for pricing. A gym that wants to push a new electrolyte drink can drop the price for a week from the dashboard — no technician visit, no firmware flash.
Inventory tracking that survives reality
Inventory on a vending machine is harder than a database count. Products get stuck, members buy two of the same item, and someone occasionally shakes the machine. We handle this with two layers: dispense events from the controller, and a daily reconciliation where the operator scans restocked items on a phone app. The two should match. When they don't, the dashboard flags the column so the next visit includes a physical check.
For gyms with multiple locations, we tag each machine with a location ID and push stock data into a shared inventory view. A regional manager can see that the downtown location is out of protein bars while the suburban one has 40 in stock, and move a restock run accordingly. That's a small feature, but it's the one operations teams ask about first.
Firmware, PCB, and enclosure
We design the control board in KiCad — usually a four-layer board with the ESP32 module, motor drivers, sensor headers, and a power section that handles 24V from the machine's supply. The firmware runs on Zephyr RTOS when we need deterministic timing for the motor sequencing, or on ESP-IDF with FreeRTOS for simpler builds. OTA updates go through a signed firmware image, so a machine in the field can't be bricked by a bad push.
The enclosure and the product tray geometry we model in CAD and 3D-print for the first prototype. Getting the spiral pitch and product clearance right is trial and error — we usually run three or four tray revisions before committing to tooling.