RMIT Programming Internet of Things Assignment 2
by Quan Cheng, Yanan Guo, Jing Li, Cheng Qian
A Smart Library System Built for Raspberry Pi. The system can be used to facilitate everyday operations of a library. For the system to work, two Raspberry Pi's are required with one being the Master Pi and the other being the Reception Pi.
The Reception Pi handles user registration and user login, while the Master Pi handles main functions, such as Search, Borrow, and Return a book.
To login to the system, the user can either choose to manually type in the credentials ro to use facial recognition provided they have had their faces scanned beforehand.
Once logged in, the user can search for books to borrow. The user can either type in the search query or use the voice recognition to search. When returning a borrowed book, the user can choose to manually enter the book ID or scan the QR code of the book.
For library admin, the system also provides a web app that allows the admin to add new books and to delete books. Besides, the admin can also view the borrow & return statistics for a specific time period.
- SSH into the Raspbian and run
mkdir Workspaces
- Run cd Workspaces and then git clone this repository.
Run the following to install all required dependencies:
sudo apt-get install sqlite3
pip3 install pymysql
pip3 install tabulate
pip3 install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib
pip3 install SpeechRecognition
sudo apt-get install portaudio19-dev python-all-dev python3-all-dev
pip3 install pyaudio
sudo apt-get install flac
pip3 install pyzbar
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
sudo apt-get install libgtk2.0-dev libgtk-3-dev
sudo apt-get install libcanberra-gtk*
sudo apt-get install libatlas-base-dev gfortran
sudo apt-get install python2.7-dev python3-dev
pip3 install numpy
sudo apt-get install python3-picamera
pip3 install --upgrade picamera[array]
pip3 install dlib
pip3 install face_recognition
pip3 install imutils
pip3 install Flask
pip3 install flask_sqlalchemy
pip3 install flask_marshmallow
pip3 install flask_bootstrap
pip3 install flask_wtf
pip3 install marshmallow-sqlalchemy
pip3 install mysqlclient
sudo apt-get install libmariadbclient-dev
To use the system, one must first create a MySQL database, preferably with one of cloud service provides,
such as Google Cloud Platform. Then create a db_config.json
file in the root directory of this
project with following information.
{
"HOST": "<Host Name>",
"USER": "<User Name",
"PASSWORD": "<Password>",
"DATABASE": "<DB Name"
}
For the Reception Pi to communicate with the Master Pi, one must provide an ip_config.json
file
in the root directory of this project with the following information.
{
"ip": "<IP Address of the Master Pi>"
}
The Smart Library System comes with two USB cameras (Microsoft® LifeCam HD-3000) to enable for facial and voice search functionality.
For the Pi to know the default device, one must add the .asoundrc
file to the home direction of the Pi.
pcm.!default {
type asym
capture.pcm "mic"
playback.pcm "speaker"
}
pcm.mic {
type plug
slave {
pcm "hw:1,0"
}
}
pcm.speaker {
type plug
slave {
pcm "hw:0,0"
}
}
The system automatically creates event on due date when a customer borrows a book on the Google Calendar, therefore,
one must obtain a credentials.json
file from Google Calendar API and add it to the root directory
of this project.
To start the Reception Pi console program, simply run the following on one of the Pi's:
python3 reception_pi_app.py
Then the main menu will display in the terminal.
On the other Pi, run the following:
python3 master_pi_app.py
Then this will start the Master Pi console and the Master Pi will continue listening to signals sent by the Reception Pi. Whenever a user logs in on the Reception Pi, the main menu of the Master Pi will be activated.
On the Master Pi, first change the HOST_IP
in the webapp/config.py
to be the IP address
of the Master Pi. Then run the following:
python3 webapp/flask_main.py
Please view the website for Sphinx Documentation: Go