📜 ⬆️ ⬇️

Arduino in the coffee machine

A little abstracting from the simple brewing of tea, I will show an example of one of my projects on the Arduino. Before that, I had the experience of Hello World on this platform, and of technical education, coupled with the ACS.



So. In a certain spherical vacuum there is a coffee machine. Old enough model, but very reliable. Prepares instant coffee drinks (nut, vanilla), different variations of coffee + cream + chocolate + sugar, instant tea. The automatic machine in view of its age has quite a few functions for the owner, leaving all his strength only for buyers. Machine can:
- to take money;
- prepare the selected drink;
- issue change;
- take care of yourself (boil water, maintain its level).
')
Of course, like any machine, he knows how to take money and not to give anything in return. It depends on the mood, the position of the moon in the starry sky, and of the power surges.

As the owner of the machine, I was not satisfied with its other functions, or rather their absence. After the first month of ownership, the following desires appeared:
- Remote notification of the stop of the machine;
- sales statistics for each drink;
- the functions of free sales "for their";
- function of automatic washing;
- chips.

I'll start in order.

The technical part of this solution


Arduino Nano (freeduino nano) + MAX232-adapter + Serial GSM modem + optocouplers + small things
The modem can be controlled by the usual AT commands via the com port. In Arduino, there is only one com-port that is used for programming (tied to a USB adapter). What would be the process of the firmware was convenient and without unnecessary movements - will not touch this port. The solution is quite simple - Software Serial is the ability to create a port on any two Arduin digital legs. Together with the adapter on the MAX232 chip, we get a full-fledged port to which external devices can be connected.
The whole scheme is assembled on a breadboard with a regular soldering on the reverse side. The technology of the laser iron has not yet been applied, since this is the first project and in the course of change the purpose of the legs and outlets.



1. Remote notification of the machine stop


The machine itself is able to keep track of some abnormal situations (overflow of the drain tank, lack of clean water, banknote jam, coin sticking in the coin acceptor). One of the listed reasons is enough for the machine to completely stop selling and go to the astral (until the owner of the machine has solved these problems).

If you approach the machine every day (for free coffee :), and check all possible causes of a future stop, then this is enough. But we aim Arduino on this place!

The first part - Arduino should read the status of the status LEDs of the machine. According to their values, send SMS to the specified number with a description of the problem. In addition, send an SMS about the reboot of the machine (in the event of a power failure) - so as to be aware.

To do this, connect through the optocoupler. It is necessary for the galvanic isolation of the circuit of the automaton and the sensitive brains of our arduin. We will not go into physics, I will say that this is the simplest and most reliable solution for connecting to an unfamiliar circuit. Given the fact that we do not even have the concept of an automaton. All the necessary outputs of the machine are punched with a multimer and the necessary diode wires are located.

2. sales statistics for each drink


In the machine there are 11 buttons for each drink option. I want to know which drink is popular. Well, how much we earned per day :) Actually, the latter is very interesting for the machine owner :) We will not take tax into account, therefore we keep records in simple Excel + formulas.

Each button has an LED indicator. When preparing a drink, this indicator is lit during cooking. On all 11 indicators we hang up the optocouplers and get them at the inputs to the Arduino. In addition, there is a readiness indicator of the drink (while it is burning - the drink is prepared and it is not recommended to take out a glass :). Both analog inputs and digital inputs were used (it is enough to track the appearance of power supply to them). Of course, you can complicate the scheme (shift registers), but this is our first project.

How to remove statistics: at any time, call the machine with a previously hammered into the firmware number. When you receive a call, the machine resets the call and in response sends an SMS with the number of sales of each button. The length of the messages makes it possible to write only in the form: 1 = 10.2 = 3.3 = 1 ..., and even for inserting into the history of sales it is more convenient than the names of drinks.

3. free sales "for their"


The machine is in a friendly room and the rent is not paid, but in return free drinks are provided. Unfortunately, Arduin’s free legs ended before this idea, and it was not possible to bring it to the end. Therefore, the issuance is made by opening the machine with a key and pressing the cherished button for free sale (the standard function of the machine is that all beverage selection buttons are activated for one attempt). But there is a great idea to make the issuance of drinks on season tickets and one-time coupons - through a barcode scanner (the usual model on the com-port). Although Habré had a great article - use the brains of an ordinary optical mouse as a reader. I will try to implement one of these options in the second version of the Automaton.

Another idea - a small variation of statistics removal - when you receive a call from a certain number - to include a free sale. But not in this version ...

4. automatic flushing


As with any dishes - automatic requires attention and periodic cleaning (dried coffee with sugar - even that glue). Unfortunately, it’s not always possible to appear every day (and withdraw money :), it was necessary to set up an automatic flushing function. There is such a function in the machine, but it is launched by pressing a special button on the remote. Therefore, we connected to the console and, through the relay, press the button when necessary. I have an automatic flush every night after collecting statistics. Previously, the flushing was after an hour of inactivity after the last sale, but the water quickly ended and had to abandon this frequency.

5. chips


I wanted to add interactivity to the machine. For example, a signal about the readiness of the drink. The piezo element from the starting set of Arduinschik is great for this idea - said, done! I plan to add another highlight of the beverage dispensing window after readiness.

The first version is ready!


Since the project is purely amateur and for myself, I don’t see the point of sharing the source code. Many suggested putting the production on stream, but this is just a hobby - and I do not intend to break away from the main work.

Already, I am preparing for the second version of the machine - or rather, for the complete replacement of standard brains with an Arduino + computer - both for larger functions and for convenience (online statistics, cash monitoring, webcam, SMS payment). A similar implementation has already been carried out on a nearby snack machine (chips-bar-cola), in just a couple of days I will publish a description of this project.

Passing question to readers - would you like to see an interactive machine that, after the drink was ready, would ask you - “how do you like coffee?” And, if you wish, you could upload a photo to a fan club on facebook / facebook / twitter? The implementation is simple - voice playback of a sound file through a computer, the “PHOTO” button on the machine panel and a webcam.

and for dessert - umm coffee


Source: https://habr.com/ru/post/132619/


All Articles