Skip to content

Melvin's Undergraduate Final Year Project - IIoT

Notifications You must be signed in to change notification settings

melvinchng/sparking

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IIoT - Parking and Reservation System Using Image Processing

Background

Purpose

This is the repository for Senior Project (Final Year Project) of Computer/Software Engineering (BS) in San Jose State University.

Team Members

  • Yi Cong Ch'ng (Melvin)
  • Alexis Cheung Ho
  • Cherie Sew
  • Timothy Wu

Project Advisor

Project Summary

Student group developed a system (hardware and software) to provide a guarantee parking spot for garage user. System includes microcontrollers with cameras, image recognition API to analyze license plates, Rails Web App with reserve and pay for a parking spot online or in garage, scalable Rails API App for REST API calls from microcontroller and Web App, statistics of parking garages, real time notification for garage administrator when a license plate is mismatched, and E-mail notification for users and administrators.

Features Implemented

General

  • Mobile and user friendly front end
  • Dynamic update without redirecting

User

  • Registration
  • Session (login and logout)
  • Forgot Password
  • Email Authentication
  • User Profile (basic information with vehicle information and license plate)
  • [Admin Only] Is a Garage Owner
  • Email & Text Notification System
  • Notify user if booking their booking due soon
  • Notify user if there is an upcoming booking

Booking System (Online)

  • Online Booking
  • Payment System
  • Choose Garages from Google Map
  • Booking History
  • QR Code generation
  • Receive E-mail on a successful booking

Garage System (In Person)

  • Check-in page (for online user)
  • Get a spot (for drop-in user)
  • Search for Parking Spot based on Booking ID
  • Payment System
  • Check-out page
  • Garage Dashboard
  • Real-time notification system based on Garage (ActionCable)
  • Admin receive E-mail on license plate mismatch

APIs

  • Query booking information (HTTP GET) based on garage and time
  • Query and resolve notifications (HTTP GET & HTTP POST) based on garage
  • Process license plate information from HTTP POST request

Python Script

  • Capture license plate and store on onboard storage
  • Send license plate picture to OpenALPR for (HTTP POST) license plate recognition
  • Send license plate information (HTTP POST) to Rails backend for processing

Architecture Diagram

Below are the major components of the system. Not all the diagrams are provided as our system is pretty huge.

High Level Architecture Diagram

A complete garage system (hardware and software) solution that is based on Web Application.

ER Diagram

Relation Schema Diagram

Assign A Spot Algorithm Flow

An algorithm to assign a spot to user.

License Plate Matching Flow

An algorithm to check if the license plate received from HTTP POST request from micro controller matches the result in database.

Technologies

Software Technology

Application Framework & API Framework

  • Ruby on Rails

Front End Framework

  • Materialize Framework

Database

  • PostgreSQL

Ruby Gems

Below is part of gems that assist the development for our Web Application.

  • gravatar_image_tag
  • abracadabra (fork and modified for Material Design)
  • cocoon
  • jquery-inputmask-rails
  • hashids
  • rqrcode
  • geocoder
  • gmaps4rails
  • gon
  • simple_calendar
  • stripe
  • jquery-rails
  • jquery-turbolinks
  • jquery-ui-rails
  • materialize-sass
  • material_icons
  • devise
  • redis
  • bcrypt
  • pg
  • better_errors
  • rails_db
  • rack-mini-profiler

Other Technology & Programming Language Used

  • OpenAPLR API
  • Python
  • JSON
  • ActionCable
  • Redis
  • RESTful API
  • Qoddi PaaS
  • Google Maps
  • Coffeescript
  • JQuery
  • Javascript
  • Gmail SMTP
  • SendGrid
  • Scheduler

Hardware Technology

  • Intel Edison
  • USB Camera
  • Barcode Scanner
  • Tablet Computers
  • Battery

Setup

Ruby On Rails

Required

  • Ruby 2.6.10
  • Rails 5.1.7

Install

  1. Clone this repository
  2. Install all the packages by using bundle install command.
  3. Start the server with rails s command.

Edison

Required

  • A flashed Intel Edison
  • Python 2.7
  • Ultrasonic sensor
  • Camera

Install

  1. Clone this repository

Install camera firmware

  1. Add packages for opkg
$ vi /etc/opkg/base-feeds.conf
  1. Copy paste these links into the opened vi file
src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2–32 http://repo.opkg.net/edison/repo/core2-32
src intel-iotdk http://iotdk.intel.com/repos/3.0/intelgalactic/opkg/i586
  1. Update opkg
$ opkg update
  1. Install camera package
$ opkg install kernel-module-uvcvideo

Install pip

  1. Run the following command
$ wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate 
$ python get-pip.py

Run the application

  1. From the cloned repository
$ cd sparking/edison
  1. Run the program and follow the instructions
$ python -m application.sparking
  1. Install any missing python package
$ pip install <package_name>

Code Structure

Rails Server

The server code is under sparking/ In the following structure, we will only highlight the most important directories

.
├── app                   # Application specific code (Uses MVC structure)
│   ├── assets            # Directory for JS & CSS
│   │   ├── javascript    # JS code
│   │   └── stylesheets   # CSS code
│   ├── controllers       # Has the logic between the model and view
│   |   └── api           # API Controller
│   ├── models            # Stores all model related code
│   └── views             # Directory for HTML files
├── config                # Initialize set values for website
│   └── routes            # Defines the URL structure of the website 
├── db                    # Database related files
│   ├── schema            # Generates database tables
│   └── seeds             # Populates database with preset entries
└── script                # Ruby scripts to test API endpoints

Edison

The edison code is under sparking/edison/

.
├── application             # Holds high level abstract code (application specific)
│   └── sparking            # Smart Parking application logic
├── component               # Device specific logic
│   ├── camera
│   ├── checkLicensePlate
│   ├── led
│   ├── openAlprApi
│   ├── sparkingEdison
│   └── ultrasonic 
├── images                  # Directory to store images
├── lib                     # Directory to store custom libraries
└── wrapper                 # Lowest level logic
    ├── api
    ├── edison
    └── sensor 

Demo

Ruby on Rails Web Application

We do not provide tech support to anyone that tries to run our code Ruby on Rails code. This is due to there are too many constraints that are set within the code and relies on a lot of dependencies. Not all of the features available in this application are illustrated in the animated gif below.

Description API Server Host
Regular Server Link Qoddi
API Server Link Qoddi

Home Page

User Login

Online Reservation Feature

User Profile

Edit User Profile

Add/Edit/Delete Vehicle License Plate

Garage Admin Login

Garage Owner Dashboard

Dynamic Notification for Garage Admin

Get A Spot In Person (In The Garage)

Check In via Online Booking (In The Garage)

Search And Pay (In The Garage)

Check Out (In The Garage)

Mobile Friendly for Both User and Garage Owner

Intel Edison

Edison: Ultrasonic with no object

Edison: Ultrasonic with object

Edison: Camera taking picture of license plate

Edison: Console Output of image recognition from camera picture

Video of System In Action

Link To Youtube

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 33.0%
  • Python 28.5%
  • HTML 22.9%
  • JavaScript 12.6%
  • SCSS 2.5%
  • CoffeeScript 0.5%