Smart Beverage Management
by matsverbeke in Circuits > Raspberry Pi
71 Views, 1 Favorites, 0 Comments
Smart Beverage Management
Hello,
On this page, you will find all the information about my Smart Beverage Management project. In my youth movement, we have a bar where you can buy a drink. The problem is that this is anything but efficient and involves a lot of unnecessary work. That's why I created this project. All the information to create this project yourself can be found here.
The idea of my project is that you can take a drink from the fridge that you would like to enjoy. Then, you simply scan your personal badge and the drink. Everything else is automatic, allowing you to enjoy your drink without worrying about anything else. All the data is stored in a database and displayed on the website.
My Github Repository: https://github.com/howest-mct/2023-2024-projectone-mct-mats-verbeke
Downloads
Supplies
Microcontroller:
- Raspberry Pi 4
Sensors and modules
Sensors:
- RC522 RFID Module
This module is designed for reading and writing RFID tags and utilizes the MFRC522 IC, capable of
communication with SPI, I2C and UART interfaces. It is primarily used in attendance systems and various
identification applications for people and objects. In my project, it serves as an identification system.
- GM805-S Barcode Scanner
This module is a barcode scanner for efficient and accurate reading capabilities. The GM805-S can quickly decode
various barcode types including 1D and 2D, QR codes and more. It is most used in inventory management and
other applications requiring barcode identification. In my project, it is utilized for scanning the barcodes of various
beverages.
- MC-38 Magnetic contact switch sensor
This is a magnetic sensor commonly used to detect the opening and closing of doors and windows. It consists of a
reed switch and a magnet. When the magnet is close to the sensor, the reed switch is activated, indicating that the
door is closed. When the magnet moves away, it is deactivated, indicating that the door is open. In my project, it
is utilized to monitor whether the refrigerator is open or closed.
Actuators:
- 2.4 inch SSD1309 OLED Display
This OLED Display is a compact module with a bright and high resolution OLED screen driven by the SSD1309
controller. This controller enables the display to render clear and sharp text and images. OLED technology
ensures each pixel emits its own light. The display typically communicates with microcontrollers via I2C or SPI
protocols. In my project, it is utilized to clarify events and provide visual feedback to users.
- WS2815 Neopixel LED
This is a versatile RGB LED that incorporates the WS2815 control IC, allowing for individually addressable colors.
With the integrated control, this LED provides vibrant and customizable lighting effects. It can easily controlled
using a microcontroller. In my project, this led serves as a visual indicator adding interactivity.
- AC-1205G-LF Passive Buzzer
This is a simple sound-producing component that generates audible tones when an electrical signal is applied.
Unlike active buzzers, passive buzzers require an external oscillating signal to produce sound. This buzzer is
compact and simple to use making it suitable for various applications such as alarms, notifications or alerts.
In my project, it serves as an auditory indicator, providing alerts to users based on events.
Connecting All the Electronics
For my project I made two Fritzing circuits, a breadboard and a schematic. On this circuits you can see how all the electronics should be connected.You can also see some pictures from test circuits with the senors and the Raspberry Pi.
Setting Up the Raspberry Pi
For this project we use a Raspberry Pi to control everything.
This means the backend, frontend and the database.
I used Visual Studio Code to run all of my code.
Follow these steps to setup the Raspberry Pi:
Install Raspbian
Download raspbian via these link.
Make connection with your Raspberry Pi
Make connection with your Raspberry Pi.
You can follow the steps via these link.
Creating the Database
All of the sensor data and user data is stored in a MySQL database.
My database consists out of 5 tables:
Device
- DeviceID: ID of the device
- Name: Name of the device
- Type: Type of the device (sensor or actuator)
- Description: Extra information about the device
- Price: Price of the device
Meting
- MetingID: ID of a measurement
- DeviceID: ID from the Device of the measurement
- MetingDatum: Date of the measurement
- Waarde: Value of the measurement
- Commentaar: Extra information about the measurement
User
- UserID: ID of the user
- Firstname: Firstname of the user
- Lastname: Lastname of the user
- Email: Email of the user
- Password: Password of the user
- Admin: If the user is a admin or not
- LastPayment: Last Payment of the user
- RFID: RFID ID of the users badge
Drink
- DrindID: ID of a drink
- Name: The name of the drink
- Price: The price of the drink
- Stock: The supply of the drink
- Barcode: The barcode of the drink
User_Drink
- UserDrinkID: The ID of the UserDrink join
- UserID: ID of the User
- DrinkID: ID of the drink
- Aantal: amount of drinks
Setting Up the Backend
App.py:
This is the main backend code of the project. All sensor programs are controlled from here.
The app.py also contains the routes being used to retrieve data from the Database.
DataRepository.py:
Here are the SQL queries to get, change or delete data from the database.
Database.py:
This is to execute and read the database.
Config.py:
This is the configuration to connect with the Database
Setting Up the Frontend
The frontend consists out of all the HTML files, the SCC files for de styling and the javascript files.
Login.html:
This is the login page of the site
Dashboard.html:
Here you can find all the information of the sensors
Users.html:
Here you can find all the users. You can add, change or delete users.
Drinks.html:
Here you can find all the different drinks. You can add, change or delete drinks.
App.js:
Here you can find all the javascript code to communicate information from the webserver with the backend.
Creating the Casing
Casing:
I have 3D printed a two-part enclosure with the necessary holes to neatly and compactly integrate all components in my housing. I've accomplished this using a resin 3D printer, as it was available to met at home. Hower, the same can be achieved with other types of 3D printers. The lid of the housing is secured using screws positioned at the four corners.