The 'Robonomics Coffee' is a smart coffee machine integrated into the Robonomics Network. This project aims to illustrate Robonomics' potential in the IoT sphere through a real-world example.
Let's imagine a small office with a team of 10-15 people. While everybody is focused on their own deadlines for their main professional tasks, no one seems to care about the upkeep of the office space. The most common solution to avoid sinking into chaos is to hire third-party individuals for support. Another approach is to take the initiative and impose penalties on those who create a mess or deplete supplies without replenishing them. However, is it ethical to live under tyranny in our future crypto-anarchist world, where everyone is expected to be responsible and enjoy freedom? Let's strive to create a more democratic society using smart contracts and the new generation of Internet technologies (often referred to as Web3). We need tools that can help us make decisions together, and then ensure they work properly without humans having to get directly involved.
There's a concept widely discussed in economics, ecology, and other sciences known as the 'tragedy of the commons.' This pertains to a scenario in which individuals who have access to a shared resource prioritize their own interests, ultimately exhausting the resource. Coffee closely resembles such a resource, as it deteriorates due to uncontrolled consumption in the office. However, at the same time, usually none of the team members are inclined to invest their time and money in obtaining an additional package of coffee beans. So, they keep drinking coffee without getting new supplies.
How to formulate the task in numbers.Assuming a monthly coffee budget of $100, which is approximately equivalent to 150 cups for our team of 10 people, this leaves each person with 1 cup every 2 days. Now, let's delve into the technical details. The question is: how can we bring an autonomous coffee machine to life in the office?
Step 1: automated coffee bean ordering.We've made an arrangement with the barista, Nikita, who's located near the office. He'll supply us with coffee beans upon receiving an alert from the bot. The bot sends a message when the coffee is running low, specifying the quantity of coffee (in kilograms) needed for the order and the corresponding payment amount determined by the team. With these details, Nikita can select the coffee according to his preference.
Step 2: automatic access to smart office.Simultaneously with the order, the coffee machine generates a QR code. Nikita then presents this QR code to the camera for office entry.
Step 3: distribution of coffee tokens to the team.Once the local camera scans the QR code, the smart home management system initiates a payment to Nikita and distributes new coffee tokens among the team members.
Step 4: drink coffee!In order to receive a fresh cup of coffee, a team member needs to send a coffee token to the address of the coffee machine.
Furthermore, such an automated coffee machine introduces various economic and social dimensions. Let’s take a look at them:
To achieve hands-on control of the coffee machine, we integrated a single-board computer, specifically the Raspberry Pi 4, along with a commonly available mass-market coffee machine that supported GPIO connection. Our preference was the De’Longhi Magnifica ECAM 22.110, selected for its affordability and the convenience of its easily removable front panel.
Next, we worked out the operational details, specifically concerning which tokens users could send and the underlying algorithm. Here's the result:
To enjoy a cup of delicious coffee, users need to send a certain amount of funds (in our case, 1 Statemine's token ACT, id=3077) to the coffee machine's address from a parachain (Statemine). Afterward, the coffee pouring process begins, and an action log is subsequently published on the Robonomics Parachain portal via the Datalog function.
This concept offers numerous avenues for expanding the idea. It was successfully implemented at the Polkadot Web3 Hub during the 2022 World Economic Forum in Davos. Participants were able to place coffee orders and specify their desired coffee type (e.g., espresso, americano, cappuccino) by sending a certain amount of tokens.Let us share photos and videos from this event:
You can find a detailed tutorial and technical specifications in the open-source GitHub repository. Keep in mind that you can use any coffee machine you prefer and almost any token of your choice to bring this project to life in your own space.