Skip to content

chung-coder/Iot-bartender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IoT-bartender

logo

Overview

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.

Components

Hardward

  • 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

Software

  • Python 3.7
  • Open-Vino
  • Python Telegram Bot

Accessories

  • Red Label Rice Wine 紅標米酒
  • Sprite 雪碧
  • Golong Milk 國農牛乳
  • Mr. Brown Coffee 伯朗咖啡
  • Cranberry Juice 蔓越莓汁
  • Minute Maid 美粒果

Circuit Diagram

circuit diagram

Didn’t put webcam on the circuit diagram!

Just plug them in your raspberry pi. It’s simple!

How does Iot-bartender really look like

device1 device2

Telegram Bot User Interface Design

System Diagram on this project

Before Getting Start

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

Build up your Telegram Bot

  1. Download Telegram on your computer,then sign up for Telegram https://telegram.org/apps
  2. Use @BotFather to create new bot accounts and manage your existing bots
  3. Click these links to learn how to set your telegram bot
  1. 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)
  1. To upload image and get the url, register your application with Imgur.

  2. Go to Register your application to register your client. Then you will get your Client ID and Client secret

  3. 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

  1. 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

  1. Once you have your Azure subscription, create a Face resource in the Azure portal to get your key and endpoint.

  2. 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

  1. Run the script
python telegram_bot.py

Build up your Iot Bartender

  1. Make sure that all electronic component can work normally

  2. Set up your circuit diagram first, and make sure that all electronic component has been installed.

circuit diagram

  1. Using camera.py to scan and decode QR codes with OpenCV

    To get more infomation, you can go to An OpenCV barcode and QR code scanner with ZBar

  2. Run the script

python iotbartender.py

References

a. iot Bartender

b. telegram bot

c. Age Classification

About

an AI bartender with Age verification

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages