This is an AI bartender with Age verification. Because of the working holiday in Orchid Island during the summer vacation, I want to share Original Cocktail that I met in this summer through this project. To implement this project, I would use five drinks and rice wine. As for user, there are three steps to operate.
a. First, users need to offer their selfie to identify age. If their age is less than 18 years old, they cannot choose rice wine as a component of drinks.
b. Second, users need to choose the drinks what they like and the proportion what they want on their mobile device.
c. Third, the mobile device will generate an qr-code and users can use it to pick their drink.
- Raspberry Pi 3 *1
- Logitech Webcam *1
- 12V Switching Power Supply *1
- Jumper wires
- breadboard
- 12V DC Dosing Pump Peristaltic *6
- Food Grade Silicone Tubing *3m
- 8 Channel DC 5V Relay Module *1
- power cable *1
- Python 3.7
- Open-Vino
- Python Telegram Bot
- Red Label Rice Wine 紅標米酒
- Sprite 雪碧
- Golong Milk 國農牛乳
- Mr. Brown Coffee 伯朗咖啡
- Cranberry Juice 蔓越莓汁
- Minute Maid 美粒果
Didn’t put webcam on the circuit diagram!
Just plug them in your raspberry pi. It’s simple!
The first thing to do is to build the environment on your Raspberry Pi. Go to Terminal and enter:
sudo apt-get install libzbar0
pip install pyzbar
pip install RPi.GPIO
pip install opencv-python
To get more infomation about opencv-python, you can go to https://docs.opencv.org/3.4.1/d2/de6/tutorial_py_setup_in_ubuntu.html
In order to create your telegram bot, you need to build the environment on your computer. Go to Terminal and enter:
pip install python-telegram-bot --upgrade
pip install cognitive_face
pip install pyimgur
pip install Pillow
pip install qrcode
- Download Telegram on your computer,then sign up for Telegram
https://telegram.org/apps
- Use @BotFather to create new bot accounts and manage your existing bots
- Click these links to learn how to set your telegram bot
- https://ithelp.ithome.com.tw/articles/10245264
- https://hackmd.io/@truckski/HkgaMUc24?type=view#Python-Telegram-Bot-%E6%95%99%E5%AD%B8-by-%E9%99%B3%E9%81%94%E4%BB%81
-
Input your token on the script "YOUR TOKEN HERE".
Notice: You need to keep your token and store it safely.
updater = Updater("YOUR TOKEN HERE", use_context=True)
-
To upload image and get the url, register your application with Imgur.
-
Go to Register your application to register your client. Then you will get your Client ID and Client secret
-
Input your CLIENT_ID on the script "YOUR CLIENT ID", then you can use PyImgur to upload the image
CLIENT_ID = "YOUR CLIENT ID"
PATH = "person_img.jpg" # A Filepath to an image on your computer"
title = "Uploaded with PyImgur"
im = pyimgur.Imgur(CLIENT_ID)
uploaded_image = im.upload_image(PATH, title=title)
print(uploaded_image.title)
print(uploaded_image.link)
To get more infomation, you can go to PyImgur
- Before using Face API to cognitive the age, you need to register your application with microsoft azure. Click Azure subscription to Create account for free
-
Once you have your Azure subscription, create a Face resource in the Azure portal to get your key and endpoint.
-
Input your SUBSCRIPTION KEY and REGIONAL on the script "SUBSCRIPTION KEY" and "REGIONAL"
# set up congnitive_face
KEY = 'SUBSCRIPTION KEY'
CF.Key.set(KEY)
# Replace with your regional Base URL
BASE_URL = 'https://REGIONAL.api.cognitive.microsoft.com/face/v1.0/'
CF.BaseUrl.set(BASE_URL)
To get more infomation, you can go to Quickstart: Use the Face client library
- Run the script
python telegram_bot.py
-
Set up your circuit diagram first, and make sure that all electronic component has been installed.
-
Using
camera.py
to scan and decode QR codes with OpenCVTo get more infomation, you can go to An OpenCV barcode and QR code scanner with ZBar
-
Run the script
python iotbartender.py
a. iot Bartender
- Smart Bartender https://www.hackster.io/hackershack/smart-bartender-5c430e
- Pitender https://hackmd.io/@nI3k8IIMTUuNhfYnYiVKlQ/rklX1RllU
- Taiwanese Indigenous Cocktail http://winelist.niusnews.com/post/3k2kt84
b. telegram bot
- telegram bot api https://core.telegram.org/bots/api
- python-telegram-bot https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/README.md
- python QR Code generator https://pypi.org/project/qrcode/
- upload image via PyImgur
c. Age Classification
- microsoft azure face api https://azure.microsoft.com/zh-tw/services/cognitive-services/face/#features