DIY

Automatic cocktail and beverage dispenser

Automatic cocktail and beverage dispenser From this article we will learn how to make a machine for making cocktails. The device can be operated both via the website and manually. Cocktail recipes are stored in a database. The history of prepared drinks will also be stored there for its further analysis and tracking of popular drinks.
Tools and materials: -Arduino UNO; -Raspberry Pi;
-Logic level switch;
-Power supply 12V;
-Potentiometer;
-Relay 5V – 6 pcs; -LCD – display;
-Temperature sensor;
-Membrane pump – 6 pcs; -Loss gauge – 6 pcs; -Pressure sensor Hx711; -Silicone hose; -Software;
Step one: setting up Raspberry Pi
To set up an SSH connection with a Raspberry Pi and a WiFi connection, the wizard writes a command in which we specify the network name and password:

  wpa_passphrase & lt; SSID & gt; & lt; password & gt; & gt; & gt; /etc/wpa_supplicant/wpa_supplicant.conf  

Then uses the following commands to connect:

 wpa_cli interface wlan0 reconfigure quit ping google.com  

Installs packages: Apache2, MariaDB, Python3 using the following commands:

  apt install apache2 -y apt install mariadb-server mariadb-client -y apt install python3 -y  

After installing python3, you need several libraries to connect to the interface and database.

 pip3 install flask-cors pip3 install flask-socketio pip3 install mysql-connector-python pip3 install gevent pip3 install gevent-websocket  

Creates a working folder containing 3 subfolders. Frontend, backend and database. Creates an HTML file for testing. You can use the files from the repository instead of the HTML file.

  nano /etc/apache2/sites-available/000-default.conf  

Next, you need to find a line that says “DocumentRoot” followed by a directory. We need to replace the directory with the directory of the folder for the frontend code and then restart Apache2 using the following command:

  service apache2 restart  

Now we need to set some rights of this folder … Opens the main Apache2 configuration file:

  nano /etc/apache2/apache2.conf  

Changes the file

  & # 34; & lt; Directory/& gt; Options FollowSymLinks AllowOverride All Require all denied & lt;/Directory & gt; & # 34;  

on

 & # 34; & lt; Directory/& gt; Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Require all granted & lt;/Directory & gt ;; & # 34;  

 Automatic dispenser for cocktails and drinks Step two: creating a database
Next, you need to create a MySQL database, similar to the example given, or you can use the provided database in the repository.
Automatic cocktail and beverage dispenser Next, you need to establish a connection between MySQL (a free database management system) and the Raspberry Pi. Adds a new MySQL connection and sets the connection method to “Standard TCP/IP over SSH”. Enters the requested forms as shown in the example (you need to change the hostname, passwords and username). After connecting, you need to enter cocktails, recipes and their necessary ingredients into the database.
Automatic cocktail and drink dispenser Step third: preparing the frontend
In step one, several folders were configured for the database, backend, and frontend. Now you need to link all these parts.
To establish communication between the interface and the server, you can use the flask and SocketIo libraries. They are not intended for use on large servers, but are ideal for small projects. You need to import the following code into your main Python file.

  from flask_cors import CORS from flask_socketio import SocketIO, emit, send from flask import Flask, jsonify  

Then it inserts HTML into the header.

  src = & # 34; https & # 58; //cdn.socket.io/4.0.1/socket.io.min.js" integrity = & # 34; sha384-LzhRnpGmQP + lOvWruF/lgkcqD + WDVt9fU3H4BWmwP5u5LTmkUGafMcpZKNObVMLU & # 34;  

In python you need to use the following code to send and receive data.

 # to send data emit (& # 39; subject & # 39 ;, data) # to receive data @ socketio.on (& # 39; subject & # 39;) def function_name (parameter) & # 58; pass  

Automatic cocktail and beverage dispenser Step four: cabinet
Any suitable cabinet can be used as a cabinet. There are several conditions. There should be room inside for six bottles and all the parts. The height of the cabinet should not be less than the height of the bottles + strain gauges and tube.
Automatic cocktail and beverage dispenser  Automatic dispenser for cocktails and drinks Automatic cocktail and drink dispenser Step five: assembly
Electrical installation is performed according to the following scheme.
Automatic dispenser for cocktails and drinks Automatic cocktail and beverage dispenser Connects pumps and sensors. A strain gauge is installed under each bottle + a sensor is installed under the glass. If there is no glass, then you can choose a drink, the pumps will not work.
Automatic cocktail and beverage dispenser Step six: serial communication between Arduino and Raspberry Pi
Arduino will not perform any action without command with Raspberry Pi.
First enables the serial interface using the following commands:

  sudo raspi-config interfacing options Serial  

Opens code

  enable_uart = 1 in /boot/config.txt.  

and checks if the line is added

  sudo nano /boot/config.txt  

Reboots Rusbury and further disables some services.

  sudo systemctl stop [email protected] sudo systemctl disable [email protected]  

Opens the cmdline.txt file and checks if the line console = serial, 115200 is present. If it is, then you need to remove it with the following command.

 sudo nanot /boot/cmdline.txt  

After an overload, the Arduino connection should be established.
Step Seven: Load Cells
Connect the load cells to the Hx711. The load cells are installed in 3D-printed holders.
Imports the HX711_asukiaaa.h library into Arduino. It allows you to read multiple sensors using a single sync line. Connects all sync lines to one line and data lines to a set pin on the Arduino.
Automatic cocktail and beverage dispenser Step eight: temperature sensor
In order to know the temperature of drinks and, if necessary, cool bottle master installed a single-wire temperature sensor in the device. First enables 1-wire communication by doing the following:

 sudo raspi-config interfacing options one wire - enable  

Then on the last line in boot/config.txt. prescribes:

  sudo nano /boot/config.txt  

Reboots Rusbury. Connects the sensor. Enters the following command:

  cd/sys/bus/w1/devices/ls  

Sensor data should now be retrieved.
The code for the sensor can be downloaded below.

 class OneWire & # 58; def __init __ (self, device_id = & # 34; 28-3c01d07567bf & # 34;) & # 58; #change device_id to your id self.device_id = device_id self.filename = f & # 39;/sys/bus/w1/devices/& # 123; device_id}/w1_slave & # 39; def read_temp (self) & # 58; # print (& # 39;  n *** Reading temperature ** & # 39;) sensor_file = open (self.filename, & # 39; r & # 39;) for line in sensor_file & # 58; if & # 39; t = & # 39; in line & # 58; line = line.strip (& # 34;  n & # 34;) line = line.split (& # 39; t = & # 39;) temperature = float (line & # 91; 1 & # 93;)/1000 # print (f & # 34; Current temperature is & # 58; & # 123; temperature} ° C & # 34;) sensor_file.close () return temperature  

 Automatic cocktail and drinks dispenser In principle, everything is ready. The wizard uses ApexCharts as a wrapper for the front-end. In the application, you can customize various input, appearance, commands “for yourself”.
 Automatic dispenser for cocktails and drinks Automatic cocktail and drink dispenser

Source:

usamodelkina.ru

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Check Also
Close
Back to top button