Skip to content
Snippets Groups Projects
Jeyan Kanagaratnam's avatar
0f8199ac

CM2305 Group 17 Project

Folder and File Structure

The program is ran from the physical_system_main.py file. This program calls files from the core file during execution to complete certain tasks. These core files are: email_template (used as the template for our automated email notifications), emails (used to connect the Plunk API to our system and send the email request), i2c (used for all sensors/actuators connected via the grove pi board), messages (stores all the messages displayed on the LCD screen), models (contains all the tables/databases), scan (used to detect barcodes using PyZbar) and thingsboard (a feature we were working on however, decided to create our own flask website)

The flask website is ran from the flask_server_main file. This program uses Flask as the micro web framework, and calls the index.html file from the templates folder. Within the static folder, the css subfolder contains style.css (used to style our website), the images subfolder stores our logo (used in the website) and the jf folder contains script.js (used in the datepicking and refreshing)

The test_add_product is used to add new products to the database, the test_add_user is used to add new users and test_send_email is used to test sending emails.

Finally, the Object_detection_picamera file is used within the object detection feature. This is ran as a subprocess called from the physical_system_main file. This has to be ran in the same folder as the TensorFlow models which can be pulled using: git clone --depth 1 https://github.com/tensorflow/models.git

Setup Instructions

After downloading and unzipping the files, there are a list of libraries and packages needed:

Flask==3.1.0 SQLAlchemy==2.0.39 Werkzeug==3.1.3 Jinja2==3.1.6 MarkupSafe==3.0.2 click==8.1.8 colorama==0.4.6 itsdangerous==2.2.0 blinker==1.9.0 numpy picamera pyzbar PIL

For the object detection (seperate list as it is quite a lot):

tensorflow libatlas-base-dev pillow lxml jupyter matplotlib cython python-tk libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev qt4-dev-tools libatlas-base-dev opencv-python protobuf-compiler

As well as the TensorFlow models: git clone --depth 1 https://github.com/tensorflow/models.git

Finally, the Object_detection_picamera file must be placed in /home/pi/tensorflow1/models/research/object_detection.

Running the project

The program can then be ran from the physcial_system_main folder.

A loyalty card need to be added to sign in via the test_add_user file. Products can be added via the test_add_product

Expected output includes SQLAlchemy debug lines as well as a camera preview appearing. The LCD screen will also switch on and display a message asking for the card to be scanned.

Third-party software

The original object detection project can be found here: https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi We modified this and integrated it within our project.

MariaDB is used to host the DB on the cloud. This is currently hashed out within the code allowing for it to be ran locally.

Plunk API is used to send emails.