You can get all the code of our system in our git here.
A - Website :
We created many section in our Website to manage our system. You can find our code in our git in the section server.
PageAccueil.html : Home Page
- This page explain How to use our website and what is the use of each tabs.
PageCafe.html : Page to make a coffee
- In this section, you can make coffee instantly. You can either choose the dose of coffee, sugar and water or chose to make a coffee from a Recipe that already exists.
PageRecette.html : Page to create/delete Recipe
- In this section you can create or delete a new Recipe to/from the Data Base.
PageRoutine.html : Page to Program coffee making
- In this section you can program coffee making by choosing the days and hour when you want your coffee to be ready. We manage to add a " Routine " to the database but we did not finish it. Indeed, the section "delete a routine" is not completely finished and we did not manage to make a coffee while questioning our database to look for routine and coffee to make. So for now, our coffee machine can only make coffee instantly from the website.
PageEtat.html : Shows the level of water, coffee and sugar
- In This section, we can see the level of water, sugar and coffee of our machine to know if we have to refill it or not. We can also see if they is a coffee cup or not.
B - DataBase :
You can find our code in our git in the section server. We created 7 Tables to manage our system :
C - Server :
You can find our code for the server in our git in the section server.
The server enable our website to communicate with our database using AJAX Requests to ask for :
- All the Recipes submitted
- All the routines
The server, also communicate with our coffee machine using MQTT. Indeed, if you want to make a coffee, we send a MQTT request to our broker with the dose of coffee, sugar and size of the coffee.
The server is in our git in the folder "server".
In order to use our website, you can launch our server with this command on your terminal :
$ python3 server.py
Then
you just have to open an internet window and to write this command :
And here you go !
D - MQTT Communication :
For this part we are going to show you how to setup the broker and the communication between the hardware and the website.
To do so, you first need to install Mosquito on the raspberry pi. You can follow the tutorial in the link below:
https://randomnerdtutorials.com/how-to-install-mosquitto-broker-on-raspberry-pi/
Then when the broker is installed on the raspberry pi you have to activate it and modifie the Arduino code to match the IP address of the raspberry pi.
Important
: For our prototype the ESP32, the Rpi, and the device hosting the website must be connected to the same wifi.
To Resume our code, and more particularly the MQTT communication:
- The Raspberry Pi hosts the broker and the ESP32 subscribes to the topic "home/kfee" and will publish data from the sensor to the topic "Monitoring"
- When someone asks a coffee the server will publish on the topic "home/kfee" and it will trigger a call back on the ESP32, and prepare a coffee.
A - Control of motor and sensor :
B - Kettle :
Our coffee machine have a very simple mechanism if it's power up it will boil the water. So to control our machine we implemented a switch controlled by the ESP32.
Indeed the coffee machine has to security controller based on a ThermoStat and a Thermo Fuse. So we can easily control it with the following diagram :
We kept the Manual Switch to keep an safety button.
The Relay has to be use very carefully. We use the 230 Voltage with 32A. We added a red lego block to prevent touching the soldering under the relay and sealed it into a box.
C - 3D Impression :
To realise this project, we designed severals 3D impression, there is a list :
- a funnel to contain the coffee
- a funnel to contain the sugar
- two lids for funnels with a sensor emplacement (to control the level of coffee and sugar)
- two screws adapted for our motors
- two motor supports
- two discs to plug the end of the PVC (diameter in : 4.8 cm and diameter out : 5cm)
- two slides to permit the coffee and sugar to fall in the cup
- two big colonnes to raise the motor
We joined the.stl that we used if you want to reproduce it at the end of the article.
Comments