Tool Inventory System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 62

https://www.halvorsen.

blog

Tool Inventory
System
Hans-Petter Halvorsen
Tool Inventory System - Background
• A company has a room (inventory room) full of
expensive tools
• The tools are used by the employees in their daily
work
• The company wants to keep track of the tools in
this inventory room
• The door into the room has access control (ID card
is needed to open the door) but there is no
tracking of the tools
Tool Inventory System - Goals
• The system should track tools in the inventory,
i.e., track when someone borrow tools and
when someone return tools
• The system should have a card reader at the
door to the tool storage/inventory, which in
addition to unlocking the door means that the
tool that is taken out is registered on this
person.
Tool Inventory System – Suggested Solution
Rough sketch for solution to be implemented:
Tool Storage/Inventory Database
(Data Storage)
Registration Module
Communication
with Database

Application for registration of


information about each tool
Functional Requirements
• The system should track tools in the inventory, i.e., track when
someone borrow tools and when someone return tools
• The system should have a card reader at the door to the tool
storage/inventory, which in addition to unlocking the door means
that the tool that is taken out is registered on this person.
• The system should automatically register the time and person in the
database when tools are taken out (/ in) of the inventory.
• The system should automatically register when a tool leaves the
inventory
• The inventory should have access control
• The following information should be stored for each tool: Tool
Number, Vendor, Model, Purchase Date, Calibration Date, Price,
Owner, Categories and Subcategories
Functional Requirements
• A program to easily add new tools or modify existing ones in
the database, preferably with a web interface for easier
access
• Create a graphical display application on a screen:
– If the tool is outside / inside
– When it was taken out
– Person who has taken the tool
– Possible picture of tools
– Here it is possibly desirable with a touch screen to be able to
browse the list, perhaps with a small search function or some
filtering options, but without access to make changes.
Functional Requirements
• It should be possible to get lists of available tools,
possibly who borrowed it and when, etc.
• It should be possible to send reminders to get
tools back, etc.
• It should be possible to add users, edit user
information and delete old non existing users
• The user needs to login to the web system with a
Username and a Password
• Possible to reserve tools that you need
Non-Functional Requirements
• The system shall use RFID tags for access control
• The system should be wireless, preferably using RFID tags for
tracking tools in the inventory
• The range for the RFID reader should be 2m
• The web application should be created using non-licensed
based software
• The Web Application should preferable be hosted on
Microsoft Azure because the customer already uses this
service
• The system and programs should be designed in such a way
that they are as general and configurable as possible.
Non-Functional Requirements
• The system should satisfy the GDPR and satisfy basic security
requirements, login, etc.
• The web application(s) should work with both Microsoft Edge and
Google Chrome
• The customer mainly wants a total solution that is as license free as
possible. Assessments must be made of development tools,
programming languages, frameworks, etc. so that this is taken care of
in the best possible way
• The User Passwords should have necessary security such as “Hashing”
• The system should be modularized for easy maintenance and further
development by the customer
• The code should be well structured and well documented to make it
possible for the customer to maintain and to further develop the
system
RFID
• Radio-frequency identification (RFID)
• RFID is the method of uniquely identifying items
using radio waves
• An RFID system comprises a tag, a reader, and an
antenna
• Unlike a barcode, the tag does not need to be within
the line of sight of the reader
https://en.wikipedia.org/wiki/Radio-frequency_identification
RFID Parts
• An RFID tag in its most simplistic form, is comprised of two
parts – an antenna for transmitting and receiving signals, and
an RFID chip (or integrated circuit, IC) which stores the tag’s
ID and other information. RFID tags are affixed to items in
order to track them using an RFID reader and antenna.
• An RFID reader is the brain of the RFID system and is
necessary for any system to function
• RFID Antennas are necessary elements in an RFID system
because they convert the RFID reader’s signal into RF waves
that can be picked up by RFID tags
• Many RFID readers has an integrated antenna
https://www.atlasrfidstore.com/rfid-beginners-guide/
RFID System Overview
PC (or a Microcontroller/Microcomputer, e.g., Arduino, Raspberry Pi, Intel NUC, …)

RFID Reader and Antenna are typically in one unit. For


USB longer distance, a separate Antenna may be needed?
RFID Antenna RFID Tag
RFID Reader
RFID Tags
There are two types of RFID tags:
• Passive tags are powered by energy from the RFID
reader's interrogating radio waves.
• Active tags are powered by a battery and thus can be
read at a greater range from the RFID reader, up to
hundreds of meters.
RFID tags can be attached to physical objects,
clothing, and possessions, or implanted in
animals and people
Inventory System - System Overview
Internet
The User scan ID Card and Tool with RFID Server
Tag when going out of the Inventory door
Tool x has been
borrowed
RFID Module
Database

Web Applications
Tool Management System Tools

Tool with RFID Tag

Used by the Administrator to The User can get an overview of


Add, Edit, Delete Tools and Users available Tools in the Inventory
Inventory System - Architecture
Microsoft Azure
Internet
The User scan ID Card and Tool with RFID Server SQL Server
Tag when going out of the Inventory door
C# Desktop Tool x has been
RFID (WinForm) App borrowed
Range Windows Database
2m NUC RFID Server
Windows 10 Module
Parallax USB RFID Reader ASP.NET Core Web Applications
Tools
Tool Management System
Web
Tool with RFID Tag Web Application
Application
Used by the Administrator to The User can get an overview of
Add, Edit, Delete Tools and Users available Tools in the Inventory
Risk Analysis
• The RFID reader has not the necessary range
• Tool registered on wrong person if 2 persons are in the inventory and/o leave the
room at the same time
• Existing Access Card cannot be used because they don’t have RFID or different
standard is used
• Risk of GDPR violation
• Hacker attacks
• Data stored in a cloud service out of control of the company
• User data/information stored in 2 different systems (this system and existing access
control system)
• What if an ID Card has been stolen?
• A person uses an ID card that is not his (borrowed from another)
• The RFID Tag on the tool has fallen of
• The tools are used in a hazardous environment which can case that the RFID falls off
or is destroyed in some way
https://www.halvorsen.blog

Prototype

Hans-Petter Halvorsen
Prototyping Development Time
20-80 Rule:
• It takes 20% of the total development time to make the
system 80% finished (The main functionality but it lacks
robustness, systematic testing, etc.)
• It takes 80% of the time to finish the remaining 20% of the
system (Robustness, bug fixes, fin-tuning, change in
requirements and customer wants some changes or new
functionality, etc.)
• 80% of the users are only using 20% of the features in an
application
https://www.halvorsen.blog

RFID Reader

Hans-Petter Halvorsen
Parallax USB RFID Reader
User ID Cards with RFID for Access Control

RFID Tags for mounting on each tool


https://www.parallax.com/product/rfid-card-reader-usb/
https://no.rs-online.com/web/p/identification-sensors/8430793
Parallax USB RFID Reader
From Parallax USB RFID Reader Documentation
• It reads passive 125 kHz RFID transponder tags
• The Parallax RFID Card Reader USB version can be connected directly to any PC,
Macintosh, or Linux machine that has a USB port and the appropriate drivers
installed. The module is powered from the host computer’s USB port and uses an
industry-standard FTDI FT232R device to provide the USB connectivity
• A visual indication of the state of the RFID Card Reader is given with the on-board
LED. When the module is successfully powered-up and is in an idle state, the LED
will be GREEN. When the module is in an active state searching for or
communicating with a valid tag, the LED will be RED.
• The RFID Card Reader USB version is activated via the DTR line of the USB Virtual
COM port. When the DTR line is set HIGH, the module will enter the active state.
When the DTR line is set LOW, the module will enter the idle state.
• RFID Tag read distance of approximately 4 inches (10cm).
Parallax USB RFID Reader
Communication Protocol:
• The RFID Card Reader USB version transmits the
data through the USB Virtual COM Port driver
• All communication is 8 data bits, no parity, 1 stop
bit, and least significant bit first (8N1) at 2400 bps.
• When the RFID Card Reader is active and a valid
RFID transponder tag is placed within range of the
activated reader, the tag’s unique ID will be
transmitted as a 12-byte printable ASCII string
serially to the host in the following format:
Parallax USB RFID Reader
Communication Protocol:

The start byte and stop byte are used to easily identify that
a correct string has been received from the reader (they
correspond to line feed (\n)and carriage return (\r)
characters, respectively).
The middle ten bytes are the actual tag's unique ID.
For example, for a tag with a valid ID of 0F0184F07A, the
following bytes would be sent: 0x0A, 0x30, 0x46, 0x30,
0x31, 0x38, 0x34, 0x46, 0x30, 0x37, 0x41, 0x0D.
RFID Python Prototype
RFID Python Prototype
RFID LabVIEW Prototype
RFID LabVIEW Prototype
using System.IO.Ports;
Read RFID Tag with C# SerialPort port = new System.IO.Ports.SerialPort("COM4", 2400, System.IO.Ports.Parity.None,
8, System.IO.Ports.StopBits.One);

port.Open();
port.DtrEnable = true;

int numberBytesToRead = 12;


byte[] data = new byte[numberBytesToRead];
port.ReadTimeout = 1000;
port.Read(data, 0, numberBytesToRead);

string rfidTag;
rfidTag = System.Text.Encoding.UTF8.GetString(data, 0, data.Length);

rfidTag = rfidTag.Replace("\n", "");


rfidTag = rfidTag.Replace("\r", "");

port.Close();
RFID C# Prototype
using System;

RFID C# Prototype
using System.IO.Ports;
using System.Windows.Forms;

namespace ReadRfidApp
{
public partial class Form1 : Form
{
string rfidTag;
SerialPort port = new System.IO.Ports.SerialPort("COM4", 2400, System.IO.Ports.Parity.None, 8, System.IO.Ports.StopBits.One);

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)


{}

private void btnInitialize_Click(object sender, EventArgs e)


{
port.Open();
port.DtrEnable = true;

txtTagData.Text = "";
}

private void btnReadTag_Click(object sender, EventArgs e)


{
int numberBytesToRead = 12;
byte[] data = new byte[numberBytesToRead];
port.ReadTimeout = 1000;
port.Read(data, 0, numberBytesToRead);

rfidTag = System.Text.Encoding.UTF8.GetString(data, 0, data.Length);

rfidTag = rfidTag.Replace("\n", "");


rfidTag = rfidTag.Replace("\r", "");

txtTagData.Text = rfidTag;

port.Close();
}
}
}
https://www.halvorsen.blog

Applications
The applications are basic CRUD applications implemented in C# (WinForm and ASP.NET Core)

Hans-Petter Halvorsen
Inventory System - Applications
Internet
SQL Server

Tool Scanner 1

Database

Desktop App
Tools
Tool Management 3
2 Web
Tool with RFID Tag Web Application
Application

ASP.NET Core Web Applications


https://www.halvorsen.blog

Tool Scanner
(App #1)
Hans-Petter Halvorsen
Use Case Diagram
ScanIdCard

ReadIdCard

ScanTool
RFID Reader

Loaner ReadToolTag

LoanTool

Database
ReturnTool
Tool Scanner (App #1)
C# WinForm Desktop Application

The User scan ID Card and Tool


with RFID Tag when going out of
the Inventory door
Tool Scanner (App #1) – Improved!
C# WinForm Desktop Application
The Tool Scanner Application
automatically scans the User ID
Card and the Tool he wants to
borrow when the person is leaving
the Inventory room through the
door.

No manual steps are required by


the user!

When the user return with the


Tool, the system will be
automatically updated
https://www.halvorsen.blog

Tool Management
(App #2)
Hans-Petter Halvorsen
Use Case Diagram
Login
Logout
ChangeLogin

ShowTools

Administrator Database
CreateTool CreateUser

EditTool EditUser

ReturnTool
BorrowTool
Tool Management (App #2)
ASP.NET Core Web Application

Used by the Administrator to


Add, Edit, Delete Tools and Users
Login
Update User Information
Borrow Tool
Tool Management
Tool Details
User/Person Management
https://www.halvorsen.blog

Tools
(App #3)
Hans-Petter Halvorsen
Use Case Diagram
Login
Logout

ChangeLogin

ShowTools

Loaner Database
BorrowTool

ReturnTool

ReserveTool
Tools (App #3)
ASP.NET Core Web Application The User can get an overview of
available Tools in the Inventory
Login
Update User Information
Search
Reserve Tool
https://www.halvorsen.blog

Database

Hans-Petter Halvorsen
Database (ER Diagram)
SQL Server

The Database Design (ER


diagram) has been created
with erwin Data Modeler
Stored Procedures
• NewPerson
• UpdatePerson
• DeletePerson

• NewTool
• DeleteTool
• UpdateTool

• BorrowTool
• BorrowToolById
• ReturnTool
• ReturnToolById
• SetToolStatus
IF EXISTS (SELECT name
Example FROM sysobjects
WHERE name = 'NewTool'
AND type = 'P')
DROP PROCEDURE NewTool
GO

CREATE PROCEDURE NewTool


@ToolName varchar(100),
@ToolTag varchar(100),
@ToolDescription varchar(1000)
AS

if not exists (select * from TOOL where ToolName = @ToolName)


INSERT INTO TOOL (ToolName, ToolTag, ToolDescription, ToolInUse)
VALUES (@ToolName, @ToolTag, @ToolDescription, 0)

GO
https://www.halvorsen.blog

Visual Studio

Hans-Petter Halvorsen
Visual Studio App #2: Tool
Management (Web App)

App #1 :Tool Scanner


(Desktop App)

App #3: Tools


These 3 applications share (Web App)
much of the same code. App #2 and #3
That’s why a shared Class share the same
Library has been used. Class Library
Classes
The following Classes have been
implemented in a shared Class
Library:
• Person
• Tool
• Login
• Rfid
The different Classes are dealing with separate
functionality of the applications. All these classes
communicate with the database
Class Diagram
This is the Initial Classes for the
Core Functionality.
More Classes and Methods may
be added later when more
functionality will be added.
ASP.NET Core
Web Page: https://halvorsen.blog/documents/programming/web/aspnet
Videos:
• ASP.NET Core – Introduction
https://youtu.be/zkOtiBcwo8s
• ASP.NET Core – Database Communication
https://youtu.be/0Ta3dQ3rxzs
• ASP.NET Core - Database CRUD Application
https://youtu.be/k5TCZDwTYcE
• ASP.NET Core – Class Library
https://youtu.be/emUiMd1zRrY
• ASP.NET Core – Charts
https://youtu.be/mksUls9fx-Q
• ASP.NET Core – Session Data
https://youtu.be/I0SQ_XAoFvA
Hans-Petter Halvorsen
University of South-Eastern Norway
www.usn.no

E-mail: [email protected]
Web: https://www.halvorsen.blog

You might also like