Overview

This experimental Web3 project was developed as part of my Bachelor's thesis to explore the interaction between blockchain technology, smart contracts, and physical hardware. It allows users to activate a real coffee machine by sending ETH to its associated smart contract. Each machine is linked to its own unique NFT, offering a fun and practical example of how decentralized ownership and payments can connect with the real world.
Tech stack
- Solidity (Smart contract development)
- React (Frontend dashboard)
- Arduino (Hardware interface)
- Ethereum blockchain (Transactions and ownership)
- IPFS (Decentralized metadata storage)
Functionality
Core workflow
The system is composed of three main parts:
- smart contracts on Ethereum
- a React dashboard
- a physical coffee machine controlled via Arduino
Tokenized ownership
Each coffee machine is associated with an NFT (ERC-721), minted through the CoffeeMachineFactory
contract. Ownership of the NFT grants control over the machine and allows the owner to withdraw the ETH it collects. Metadata for the NFTs is stored on IPFS for transparency and immutability.
Smart contracts architecture
CoffeeMachineFactory.sol:
Handles NFT minting and machine deployment.CoffeeMachineToken.sol:
ERC-721 NFT implementation with metadata hosted on IPFS.CoffeeMachine.sol:
A contract deployed per machine acting as a dedicated wallet.
When an NFT is minted, the factory deploys a new CoffeeMachine
contract, mapping the token to a unique wallet address. This address receives ETH payments and emits an event when deposits occur, which the frontend listens to in real-time.
The smart contracts are currently deployed on the Sepolia testnet
React dashboard

The frontend provides an interface where users can monitor machines, send payments, and, for NFT holders, withdraw collected funds. It actively listens to the blockchain for events like payments or ownership transfers and provides feedback accordingly.
Arduino integration
Once a deposit event is detected, the React app sends a command to an Arduino board connected to the coffee machine. The board controls a relay that powers the machine, simulating a button press to brew a cup of coffee.
Future improvements
For now, the integration of the paper display is not included in the main branch due to issues likely caused by the serial connection. The dashboard should send two messages over serial: one to trigger the relay and another to send the machine address, which should be displayed as a QR code on the screen. Switching to BLE or Wi-Fi would likely offer a more reliable and efficient communication method than serial.
View Code on GitHub