A smart IoT system for contactless vending and remote machine monitoring.
Customers pick products by scanning a QR code and pay by tapping an RFID card, so they never touch the machine. Vendors get a live dashboard, low-stock email alerts and daily sales reports for every machine.
A normal vending machine needs physical contact in two places:
- Selecting the food or beverage item on the keypad.
- Paying with notes and coins.
During a pandemic, both are infection risks.
| Step | Conventional Machine | Touchless Vending Machine |
|---|---|---|
| Select item | Press buttons on the machine | Scan a QR code and pick the item on a web page |
| Pay | Insert notes / coins | Tap a bank credit/debit card or a vendor-issued RFID card |
| Monitor stock | Manual checks | Live dashboard with email alerts |
| Sales records | Manual counting | Automatic daily logs and email reports |
- Contactless product selection through a QR code and web page
- Contactless payment through an RFID card (bank or vendor-issued)
- Live dashboard showing current stock, sales from the last 24 hours, last refill time and local weather
- Email + dashboard alerts when stock falls below a vendor-set threshold (at most one email every 6 hours, adjustable)
- Daily sales log saved to a file and emailed as a summary at the end of each day
- Per-machine settings for capacity, location and alert threshold
- Weather updates for the machine's location via the OpenWeather API, since weather strongly affects drink sales
- Refills are recorded through the same web page
- Access is authorized only with a specially issued RFID token; unknown tokens are rejected
Figure 1: System framework
ββββββββββββββββ HTTP (LAN) ββββββββββββββββββββ MQTT (JSON) ββββββββββββββββ
β User's Phone β ββββββββββββΆ β NodeMCU β βββββββββββββββΆ β MQTT Broker β
β (QR β Web UI)β β Web server + RFIDβ ββββββββ¬ββββββββ
ββββββββββββββββ β + GPIO actuators β β
ββββββββββββββββββββ βΌ
ββββββββββββββββββββββ
OpenWeather API βββββββββββββββΆ β Node-RED β
β Dashboard Β· Alerts β
β Logs Β· Email β
βββββββββββ¬βββββββββββ
βΌ
Vendor (Email)
| Component | Role |
|---|---|
| NodeMCU (ESP8266) | Hosts the web server, reads RFID cards, publishes orders and refills over MQTT, drives the actuators through GPIO |
| RFID reader | Reads the customer's payment card or the staff's authorization token |
| MQTT broker | Carries JSON messages from the machine to the dashboard |
| Node-RED | Dashboard, alert logic, sales logging and email (runs locally or on IBM Cloud) |
| OpenWeather API | Weather at the machine's location |
- The NodeMCU connects to the gateway/router and runs a web server (HTML, CSS, JavaScript) on its IP address.
- The user scans the QR code on the machine and opens the web page on their phone, which must be on the same LAN.
- The home page has a button for each product, plus a service button for ground staff.
- When the user picks a product, the NodeMCU runs a C++ function that starts an RFID scan and reads the card details.
- When the payment succeeds, the user is redirected to a transaction confirmation page. In this implementation, that page only demonstrates the transaction.
- The NodeMCU publishes the order as JSON to the MQTT broker.
- The NodeMCU uses GPIO pins to drive the actuators that dispense the item.
- Staff press the service button on the web page.
- The NodeMCU scans the RFID token and checks it against a pre-defined list of authorized IDs.
- β Match: redirect to the Service Page, where staff can record the refill. β No match: redirect to a rejected notice page.
- After the refill, a refill notice is published to the MQTT broker.
- In the dashboard Settings tab, the vendor sets the machine capacity, location and alert threshold.
- Node-RED subscribes to the machine's MQTT topic and converts the incoming JSON into a JavaScript object with the stock and refill data.
- The dashboard updates current stock, sales, last refill time and 24-hour sales statistics for each product.
- Stock levels are compared against the threshold. When stock is low:
- an email alert goes to the vendor (at most one every 6 hours, adjustable)
- an alert is pushed to the dashboard
- The OpenWeather API provides weather at the machine's location.
- At the end of each day, the sales log file is updated and a daily summary email is sent.
Figure 2: Node-RED flow for one machine
| Product Selection | RFID Payment | Transaction Complete |
|---|---|---|
![]() |
![]() |
![]() |
| Figure 4 | Figure 5 | Figure 6 |
| Authorized β Service Page | Unauthorized β Rejected |
|---|---|
![]() |
![]() |
| Figure 7 | Figure 8 |
Figure 9: Current stock, 24-hour sales, last refill time and weather
Figure 10: Per-machine settings (location, capacity, alert threshold)
| Dashboard Alert | Email Alert |
|---|---|
![]() |
![]() |
| Figure 11 | Figure 12 |
| Sales Log File | Daily Email Summary |
|---|---|
![]() |
![]() |
| Figure 13 | Figure 14 |
- π¦ Hygienic: customers never touch the machine, which matters during a pandemic.
- π° Lower manufacturing cost: no complex note and coin detection and counting mechanism is needed.
- π Safer: no cash in the machine means no robbery risk, and no risky periodic cash collection.
- π¦ Never out of stock: low-stock alerts let ground staff refill in time, keeping supply continuous and revenue up.
- π Lower logistics costs: stock visibility helps managers plan refill routes.
- π Easy to retrofit: can be added to existing machines at low cost, either alongside cash payment or replacing it completely.
- π Scalable: works with any number of machines and adapts to other kinds of vending machines with small changes.
- Sales prediction with machine learning: once enough sales and weather data has been collected, deploy a TensorFlow.js model in Node-RED to predict demand.
- Use the predictions to plan refill routines and further reduce logistics costs.
Built with NodeMCU Β· MQTT Β· Node-RED Β· OpenWeather API












