household inventory management system

47
Household Inventory Management System A thesis submitted to the Faculty of the Electrical and Computer Engineering Technology Program of the University of Cincinnati This document is a partial fulfillment of the requirements for the Bachelor of Science In Electrical Engineering at the College of Engineering and Applied Science BY Bryan Bally, Gordon Peterson, & Anthony Stoiber Bachelor of Science University of Cincinnati 4/26/2013 Faculty Advisor: Professor Haas

Upload: others

Post on 24-Dec-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Household inventory management system

 

Household  Inventory  Management  System  

 A  thesis  submitted  to  the  Faculty  of  the  Electrical  and  Computer  Engineering  Technology  Program  of  the  University  of  Cincinnati  

     

This  document  is  a  partial  fulfillment  of  the  requirements  for  the  Bachelor  of  Science  

In  Electrical  Engineering  at  the  College  of  Engineering  and  Applied  Science          

BY    

Bryan  Bally,  Gordon  Peterson,  &  Anthony  Stoiber      

Bachelor  of  Science  University  of  Cincinnati  4/26/2013  

Faculty  Advisor:  Professor  Haas  

Page 2: Household inventory management system

 

Table  of  Contents  Abstract...........................................................................................................................................................1  

Introduction ................................................................................................................................................ 2  

Problem ...................................................................................................................................................... 2  

Solution .......................................................................................................................................................3  

Credibility ................................................................................................................................................... 4  

Bryan  Bally .............................................................................................................................................. 4  

Gordon  Peterson ..................................................................................................................................... 4  

Anthony  Stoiber ...................................................................................................................................... 4  

Goals........................................................................................................................................................... 5  

Overview..................................................................................................................................................... 5  

Discussion ...................................................................................................................................................... 6  

Project  Concept .......................................................................................................................................... 6  

Design  Objectives ....................................................................................................................................... 6  

Tag  Read  Range  Minimum  of  15  feet ....................................................................................................... 6  

Accuracy.................................................................................................................................................. 6  

Accessibility............................................................................................................................................. 6  

Ease  of  Use .............................................................................................................................................. 6  

Economical...............................................................................................................................................7  

Design  Decisions ..........................................................................................................................................7  

Software...................................................................................................................................................7  

Hardware................................................................................................................................................12  

Budget .......................................................................................................................................................14  

Timeline.....................................................................................................................................................15  

Future  Implementations.............................................................................................................................15  

Conclusion.....................................................................................................................................................16  

References..................................................................................................................................................... 17  

Appendix  A....................................................................................................................................................18  

Windows  Application  Code ........................................................................................................................18  

Form1.cs.................................................................................................................................................18  

Program.cs ............................................................................................................................................ 20  

Page 3: Household inventory management system

iOS  Code................................................................................................................................................... 22  

Main  ViewController.m.......................................................................................................................... 22  

OptionDisplayViewController.m............................................................................................................ 22  

OptionDisplayViewController.h ..............................................................................................................23  

ProductInventoryViewController.m ........................................................................................................23  

ProductInventoryViewController.h .........................................................................................................27  

ProductViewController.m...................................................................................................................... 28  

ProductViewController.h ........................................................................................................................31  

ProductDetailViewController.m..............................................................................................................31  

ProductDetailViewController.h...............................................................................................................32  

ShoppingListViewController.m...............................................................................................................32  

ShoppingListViewController.h................................................................................................................33  

ChickenTableViewController.m ..............................................................................................................33  

ChickenTableViewController.m ..............................................................................................................38  

ChickenTableViewController.h ...............................................................................................................39  

RecipieDetailViewController.m...............................................................................................................39  

RecipieDetailViewController.h................................................................................................................39  

AddItemViewController.m..................................................................................................................... 40  

AddItemViewController.h...................................................................................................................... 40  

Appendix  B ....................................................................................................................................................41  

Hardware  Technical  Specs .........................................................................................................................41  

Impinji  RFID  Reader ................................................................................................................................41  

Laird  S9025P  RFID  Antenna....................................................................................................................43  

Netgear  WNCE2001............................................................................................................................... 44  

 

Page 4: Household inventory management system

P a g e | 1

Abstract  The  Household  Inventory  Management  system  (HHIM)  demonstrates  the  value  of  RFID-­‐labeled  products  for  the  consumer.  This  system  maintains  an  inventory  of  consumer  products  in  a  users  refrigerator,  pantry,  laundry  room,  bathroom,  etc.  using  radio  frequency  identification  (RFID)  technology.    Custom  software  applications  provided  valued  services  such  as  expiration  warnings,  shopping  lists,  and  recipe  creators.  To  achieve  said  services,  HHIM  utilizes  pre-­‐existing  software  such  as  Microsoft  SQL  Server  2012,  BizTalk  RFID,  Microsoft  C#.NET  with  Visual  Studios,  and  Xcode  along  with  the  hardware  which  includes  the  Impinji  Speedway  R1000  RFID  reader,  Laird    S9025  RFID  Antenna,  IMEX  RFID  Antenna,  Netgear  WNCE2001,  and  Avert  Dennison  RFID  tags.    

Page 5: Household inventory management system

P a g e |

2

 

Introduction   The  following  report  outlines  the  process  involved  in  conceiving,  conceptualizing,  designing,  and  completing  the  Household  Inventory  Management  system.    

The  Household  Inventory  Management  system  (HHIM)  is  a  complete  system  to  track  products  within  the  home  using  radio  frequency  identification,  RFID,  tags.  The  main  object  of  the  system  is  to  save  time  and  money  for  the  user.  The  system  keeps  a  real-­‐time  inventory  of  what  products  are  in  the  home.  This  can  help  to  eliminate  the  user  from  buying  duplicate  items  at  the  store,  having  to  make  multiple  trips  to  the  store,  throwing  out  expired  food,  and  wasting  time  trying  to  determine  what  is  actually  in  your  fridge.    

The  system  is  comprised  of  both  hardware  and  software  elements  connected  via  a  wireless  link.  All  of  the  hardware  is  used  to  read  the  RFID  tags  and  then  relay  the  tag  information  to  our  software.  From  there,  the  software  makes  sense  of  what  the  tag  is  reading  and  then  communicates  it  back  to  the  user  via  a  Windows  and  iPhone  application.  

Problem   Every  year  around  the  world  there  are  billions  and  billions  of  dollars  wasted  on  spoiled  food.  Each  day  people  look  into  their  refrigerator  to  make  lunch  or  dinner  and  find  that  they  don’t  have  a  certain  ingredient  to  make  that  recipe  and  either  have  to  run  to  the  store  or  switch  around  their  meal.  Each  day  people  also  spend  time  on  deciding  what  recipe  to  make  for  dinner  with  the  contents  of  their  refrigerator.  According  to  the  USDA  a  family  of  four  will  spend  around  $1,244  a  month  on  food  or  about  $14,928  a  year.  According  to  an  article  on  marketplace.org,  it  is  estimated  that  a  family  of  four  will  throw  away  more  than  $2,000  worth  of  food.  Figure  1  shows  the  percentage  of  food  wasted  compared  to  the  amount  spent.  It  shows  that  13%  of  food  bought  each  year  is  wasted  by  a  family  of  four.  In  high-­‐income  countries  like  the  United  States  much  of  the  food  thrown  away  is  once  it  gets  to  the  consumer  and  into  the  household.  With  these  statistics,  the  USDA  has  calculated  that  about  27  percent  of  refrigerated  food  gets  tossed  in  the  trash  by  stores,  restaurants  and  consumers.    

What  if  consumers  could  know  when  something  in  your  refrigerator  is  about  to  expire  so  they  could  use  it  before  it  goes  bad?A  refrigerator  costs  a  lot  to  operate  yearly,  which  is  something  that  consumers  only  have  so  much  control  over.  An  average  refrigerator  uses  about  110  kilowatts  per  month,  which  makes  it  the  second  most  expensive  appliance  used.  The  annual  cost  of  a  refrigerator  ranges  from  $75  -­‐  $100.  

Even  more  electricity  is  used  when  the  refrigerator  is  opened  for  an  extended  period  of  time,  which  can  happen  when  someone  is  either  searching  for  an  item  or  opening  and  closing  the  refrigerator  constantly  to  prepare  a  recipe.  Thedailygreen.com,  a  website  dedicated  to  helping  consumers  reduce  electricity  cost  published  an  article  about  how  to  save  7%  yearly  by  keeping  the  refrigerators  door  closed.    According  to  Home  Energy  Magazine,  opening  the  fridge  accounts  for  7%  of  energy  uses  a  year.  The  Food  and  Agricultural  Sciences  at  the  University  of  Florida  says  that  poor  open/close  habits  can  waste  50  to  120  kWh  a  year.  At  the  end  of  the  year  50  kWh  of  energy  could  run  the  dishwasher  20  times  and  a  100  kWh  could  run  the  washing  

Page 6: Household inventory management system

P a g e |

3

machine  50  times  which  equals  to  a  free  load  of  laundry  every  week  for  an  entire  year.  With  the  economy  struggling  and  everyone  looking  to  save  money  wherever  possible  why  not  have  a  device  that  could  save  money  consumers  yearly.    

Another  problem  is  that  most  Americans  don’t  know  what  recipes  can  be  made  with  the  contents  of  their  refrigerator,  without  digging  out  their  recipe  books  and  searching  for  something  that  sounds  good  and  making  sure  they  have  all  the  ingredients.  This  can  be  time  consuming  and  frustrating.  What  if  there  was  something  that  suggested  recipes  based  on  the  contents  of  your  refrigerator  and  took  the  hassle  out  of  looking  for  a  recipe.      

Each  year  about  250  tons  of  medicine  are  expired  and  disposed  of  improperly  costing  about  50  million  dollar.  Not  only  is  this  bad  for  the  environment  but  very  expensive  because  expired  medicine  is  supposed  to  be  destroyed  in  an  incinerator.  A  study  has  found  that  when  medicine  expires  does  not  necessarily  mean  that  the  drug  is  no  longer  effective  or  bad  for  humans  but  studies  have  found  that  about  a  year  after  expiration  is  when  over  the  counter  and  prescription  drugs  begin  to  become  less  effective  and  overall  need  to  be  disposed  off.  Liquid  drugs  such  as  nitroglycerin,  insulin,  and  liquid  antibiotics  are  not  nearly  as  stable  after  expiration  as  solid  form  medicine.  In  America  28.5  million  people  diabetes,  which  requires  these  people  with  this  disease  to  have  insulin,  vials  on  hand  for  daily  injections.  Since  liquid  antibiotics  are  very  unstable  after  expiration  it  is  important  to  know  when  this  medication  is  expired  or  about  to  expire.  With  the  system  that  we  are  proposing  people  with  diabetes  will  be  able  to  know  important  information  about  their  medication.  This  system  will  not  only  benefit  people  with  diabetes  but  every  consumer  that  has  medicine  stored  in  their  home.    All  of  these  problems  plague  the  American  society  each  and  every  day  and  can  be  solved  with  a  system  that  has  the  ability  to  register  what  items  are  in  currently  in  the  refrigerator,  pantry,  medicine  cabinet,  laundry  room,  etc.  The  system  will  be  able  to  tell  how  often  the  item  is  used,  when  it  will  expire  with  an  alert  that  lets  the  consumer  know  what  items  are  a  bought  to  expire,  can  create  shopping  lists  based  on  the  contents  of  the  refrigerator  and  can  come  up  with  recipes  based  on  the  contents  of  the  refrigerator/pantry.      

Solution   Our  solution  was  to  build  a  system  that  uses  RFID  tags  and  sensors  that  can  offer  assistance  to  consumers  to  save  money,  cook  easier,  and  gather  information  for  a  shopping  list.  We  built  a  system  that  keeps  track  of  everything  in  your  refrigerator,  pantry,  medicine  cabinet,  laundry  room,  and  more.  This  system  will  uses  passive  RFID  tags  that  are    tracked  with  RFID  readers  and  then  that  information  is  sent  back  to  a  central  hub  such  as  a  home/laptop  computer.  This  system  keeps  track  of  expiration  dates,  build  grocery  lists  and  can  be  accessed  through  a  smart  phone  or  computer  for  convince  when  out  of  the  home.  This  system  can  also  make  suggestions  on  what  you  should  cook  for  dinner  based  on  the  contents  of  your  pantry  and  refrigerator.  

13%  

87%  

Food  Wasted  yearly  by  a  family  of  four  

Figure  1:  Food  Used  Vs.  Food  Wasted

Page 7: Household inventory management system

P a g e |

4

Passive  RFID  tags  are  placed  on  all  of  the  consumer’s  products  in  the  refrigerator/pantry  and  medicine  cabinet,(including  items  such  as  laundry  detergent,  toilet  paper,  paper  towels).  The  RFID  tags  are  programmed  differently  for  each  product.  The  RFID  tags  are  used  along  with  sensors  that  tracks  when  an  item  is  in  the  home.  The  tag  information  is  then  sent  back  to  the  hub  computer  from  the  RFID  reader  via  a  wireless  connection.  This  program  consists  of  a  database  that  holds  all  of  the  product  information  including  things  such  as  the  item  type,  the  quantity,  the  expiration  dates,  and  the  frequency  of  use.  From  the  information  in  the  database  shopping  lists  are  created,  expiration  alerts  are  created,  and  recipes  are  found.  

Credibility   The  collective  knowledge  between  Bryan  Bally,  Gordon  Peterson,  and  Anthony  Stoiber  spans  over  20  years  through  both  their  education  and  work  experience.  .      

  Bryan  Bally  

Bryan  Bally  worked  on  both  hardware  and  software  for  the  Household  Inventory  Management  System.  From  a  young  age  Bryan  has  always  enjoyed  computers  and  how  they  worked.  Bryan  has  always  been  interested  in  objective  C,  and  when  the  chance  came  during  senior  design  he  jumped  right  on  it.  He  spent  countless  hours  watching  tutorials  on  writing  in  C#.  Bryan  designed,  developed,and  programmed  the  Windows  form  Application  for  PC  users.  Bryan  also  worked  a  lot  with  the  SQL  server  and  getting  it  to  communicate  with  the  RFID  equipment.    

  Gordon  Peterson  

Gordon  worked  on  both  hardware  and  software  for  the  Household  Inventory  Management  System.  Gordon  has  always  liked  electronics  and  increasing  his  knowledge  on  how  they  work.  Radio  Frequency  Identification  has  always  interested  Gordon  and  his  interest  really  peaked  when  his  group  decided  to  have  their  project  revolve  around  UHF  RFID.  Along  with  Anthony,  Gordon  designed,  developed,  and  programmed  the  iPhone  application.From  working  in  groups  during  Gordon's  co-­‐op,  gave  him  the  skills  to  work  on  a  team.  Gordon  decided  to  take  an  iPhone  development  class  during  the  2013  Spring  Semester  which  helped  drastically  with  programming  the  iPhone  application.  

  Anthony  Stoiber  

Anthony's  main  focuses  of  the  project  were  database  work  via  MSSQL  Server,    a  co-­‐developer  of  the  iPhone  application,  and  establishing  communications  between  the  iPhone  and  the  database.  Anthony  was  first  introduced  to  database  programming  during  his  co-­‐op  at  Duke  Energy.  There  he  used  MSSQL  Server  to  set  up  a  database  to  track  power  delivery  equipment  and  their  ever  changing  prices.  This  experience,  coupled  by  his  knowledge  of  programming  languages  learnt  while  obtaining  his  bachelor's  degree,  provided  excellent  help  on  the  project.  

Page 8: Household inventory management system

P a g e |

5

Goals   The  overall  goal  of  the  HHIM  project  was  to  keep  an  up  to  date  inventory  of  all  the  products  within  the  user's  home,  along  with  user  friendly  applications  to  access  their  inventory  data.  More  specifically  we  wanted  to  accurately  read  RFID  tags  in  real-­‐time  within  a  kitchen,  relay  the  tag  information  to  a  database,  and  then  associate  the  tags  with  product  information.  From  there,  we  wanted  to  create  an  iPhone  and  Windows  application  to  read  and  write  to  the  product  database,  view  current  stock,  alert  user  of  upcoming  expiration  dates,  and  find  recipes  and  create  shopping  lists  based  on  the  present  inventory.    

Overview   The  remainder  of  this  final  report  outlines  in  detail  how  the  project  was  completed.  This  includes  design  objectives  and  decisions,  budgets,  timeline,  and  future  implementations.    

 

Page 9: Household inventory management system

P a g e |

6

 

Discussion  Project  Concept   The  idea  for  HHIM  came  from  a  number  of  different  sources.  After  Anthony,  Gordon,  and  Bryan  joined  up  as  a  team  and  selecting  Prof.  Hass  as  their  advisor  they  began  brainstorming.  It  was  clear  that  they  wanted  to  use  the  radio  frequency  identification  technology  somehow  in  their  project.  Multiple  meetings  were  held  to  determine  how  they  could  use  RFIDs  to  make  an  everyday  activity  more  time  and  cost  efficient.  Eventually,  the  idea  to  incorporate  RFIDs  into  the  home  was  brought  up.  After  much  debate,  it  was  decided  to  use  RFIDs  to  track  items  within  a  home,  more  specifically,  the  kitchen.      After  the  decisions  was  made  to  use  RFID  technology  to  track  items  in  the  kitchen,  the  idea  was  expanded  on.  Once  the  item  was  tracked,  there  were  endless  possibilities  of  what  could  be  done  with  the  information.  It  was  agreed  that  HHIM  would  focus  on  creating  recipes  and  shopping  lists  based  on  the  inventory,  warn  the  user  of  upcoming  expiration  dates,  and  keep  an  up  to  date  inventory  list.      Custom  applications  would  then  be  created  so  they  user  has  an  easy  way  to  access  all  of  the  information.  These  applications  would  be  made  as  user  friendly  as  possible  so  that  anyone  could  use  them,  no  matter  their  technical  expertise.    

Design  Objectives   The  objectives  for  the  Household  Inventory  System  are  as  follows:    

  Tag  Read  Range  Minimum  of  15  feet  

A  goal  of  a  15foot  tagread  range  was  decided  on.  The  average  kitchen  in  the  US  is  about  300  square  feet.  With  a  reading  radius  of  15  feet,  it  is  covering  an  area  of    over  700  square  feet.  This  coverage  would  be  more  than  ample  to  reach  everywhere  in  the  average  kitchen.      

  Accuracy  

The  system  needed  to  be  able  to  keep  an  up  to  date  record  of  the  inventory  down  to  the  minute,  and  be  able  to  read  everything  within  the  kitchen.    

  Accessibility  

This  is  one  of  the  key  concepts  of  HHIM.  The  inventory  data  must  be  accessible  from  nearly  anywhere.  

  Ease  of  Use  

In  order  for  the  project  to  be  successful,  it  must  be  user  friendly.  The  user  should  easily  be  able  to  find  recipes,  shopping  lists,  and  their  item  inventory.  

Page 10: Household inventory management system

P a g e |

7

  Economical  

The  total  cost  of  the  system  cannot  outweigh  the  costs  and  wasted  time  used  to  figure  out  what  to  make  to  eat,  throwing  away  unused  food,  and  creating  shopping  lists.  

Design  Decisions   The  project  can  be  broken  into  two  distinct  parts,  software  and  hardware.  The  technical  design  portion  of  HHIM  required  much  research,  testing,  and  analysis  for  both  the  software  and  hardware  sides  of  the  project.    The  following  section  describes  each  aspect  in  detail.    

Software  

  Microsoft  SQL  Server  2012  

The  first  task  of  the  project  was  determining  the  best  way  to  store  all  of  the  product  information.  This  is  one  of  the  most  important  pieces  of  the  project,  everything  runs  through  this  database.  It  was  known  that  this  stored  information  needed  to  be  easily  accessible  through  other  programs  and  read  and  written  to  hundreds  of  times  a  day.  Microsoft  SQL  Server  2012  (MSSQL)  could  handle  everything  we  wanted  to  do,  and  was  an  easy  choice  of  software  to  use  for  the  systems  database.    MSSQL  is  a  relational  database  management  system  developed  by  Microsoft.  It's  primary  function  is  to  store  and  retrieve  data  as  requested  by  outside  software  applications.      As  previously  stated,  MSSQL  was  the  centerpiece  of  the  project.  All  of  the  other  applications  are  constantly  communicating  with  the  database,  reading  and  writing  data.  The  database  was  set  up  to  store  all  of  the  product  information.  The  product  information  included  such  things  as  expiration  dates,  quantities,  brands,  type  of  food,  and  most  importantly  the  RFID  tag  number.  A  screenshot  of  the  product  database  can  be  seen  in  Figure  2  below.    

 

Figure  2:  MSSQL  Product  Database

Page 11: Household inventory management system

P a g e |

8

  Microsoft  BizTalk  RFID  

The  next  challenge  of  the  project  was  setting  up  communication  between  our  RFID  reader,  which  will  be  discussed  later,  and  the  product  database.  That  is  where  Microsoft  BizTalk  RFID  came  into  play.    Microsoft  BizTalk  RFID  is  a  device  management  and  event  processing  platform.  It  provides  a  scalable  and  extensible  platform  for  development,  deployment,  and  management  of  RFIDs.  Using  BizTalk,  a  system  for  reading  tag  information,  and  sending  that  information  to  our  MSSQL  database  was  setup.  A  screenshot  of  the  RFID  manager  can  be  seen  below  in  Figure  3.    

     

  Internet  Information  Services  7  (IIS)  

Through  much  research,  it  was  found  that  iPhone  applications  can  not  directly  communicate  with  a  MSSQL  database.  If  they  iPhone  could  not  read  the  database,  then  the  app  is  basically  obsolete.  To  solve  this  communication  problem,  a  decision  was  made  to  setup  a  web  server  to  display  the  contents  of  the  database  on  the  web.  This  would  make  it  possible  for  the  iPhone  to  read  and  write  to  the  database  at  anytime  indirectly.    There  are  multiple  web  service  software  applications  available.  Through  trial  and  error,  Internet  Information  Services  7  (IIS)  was  chosen  to  act  as  the  project's  web  server.  IIS  is  a  web  server  software  application  created  by  Microsoft.  IIS  is  currently  ranked  as  the  third  most  popular  web  server  in  the  US  because  it's  ease  of  use  and  convenience.      

Figure  3:  BizTalk  RFID  Manager

Page 12: Household inventory management system

P a g e |

9

  Microsoft  C#.NET  w/  Visual  Studios  2012  

The  team  wanted  to  design  a  Windows  application  capable  of  reading  and  displaying  the  information  from  the  product  database,  creating  shopping  lists,  and  find  recipes  based  on  the  product  inventory.    Bryan  Bally  spearheaded  this  portion  of  the  project.  With  Professor  Haas'  helped  it  was  determined  that  the  best  way  to  develop  a  Windows  app  was  through  Microsoft  Visual  Studios  2012  using  C#.NET.    Using    C#  made  it  easy  to  develop  software  components  through  various  language  constructs  which  includes  delegates,  properties,  attributes,  and  most  importantly  Language-­‐Integrated  Query  which  provided  the  built  in  query  capabilities.  The  C#  program  runs  on  the  .NET  Framework.  Architecture  for  the  .NET  Framework  is  shown  in  Figure  4,  and  a  screenshot  of  the  Windows  application  is  shown  in  Figure  5.This  code  can  be  found  in  Appendix  A.    

       

Figure  4:  .NET  Framework  

Page 13: Household inventory management system

P a g e |

10

 

 

  Apple  Xcode&  iPhone  Application  

To  design  and  build  the  iPhone  application  Xcode  was  used.  Xcode  is  an  integrated  development  environment  containing  a  suite  of  software  development  tools  developed  by  Apple  for  developing  software  for  iOS  (mobile  operating  system  for  the  Apple  iPhone  and  iPad).    The  iPhone  application  was  designed  to  do  many  things  with  the  product  inventory.  As  previously  stated,  using  the  web  server  the  iPhone  app  was  able  to  have  a  real  time  copy  of  the  users  inventory.  Much  like  the  Windows  app,  with  that  inventory  the  app  could  be  used  to  view  the  product  inventory  and  information,  find  recipes,  create  shopping  lists,  and  warn  the  user  of  upcoming  expiration  dates.    The  biggest  goal  in  designing  the  iPhone  app  was  to  make  it  as  user  friendly  was  possible  and  have  a  real  time  product  inventory,  both  of  which  were  accomplished  in  the  HHIM  iPhone  app.  The  code  for  this  application  can  be  found  in  Appendix  B.The  architecture  for  the  iPhone  app  is  shown  in  Figure  7,  and  a  variety  of  screenshots  of  the  iPhone  application  are  shown  in  Figure6.      

Figure  5:  Windows  HHIM  Application

Page 14: Household inventory management system

P a g e |

11

       

 

 

Figure  6:  HHIM  iPhone  Application  Screenshots

Figure  7:  HHIM  iPhone  Application  Storyboard

Page 15: Household inventory management system

P a g e |

12

Hardware  

  Impinji  Speedway  R1000  RFID  Reader  

The  Impinji  Speedway  R1000  RFID  Reader  was  chosen  was  the  reader  of  choice  for  the  HHIM  project.  The  Impinji  is  a  stationary  ultrahigh  frequency  RFID  reader.  The  reader  operates  between  902  and  928  MHz.  The  reasons  this  reader  was  chosen  over  others  were  that  it  had  multiple  antenna    ports  (4),  relatively  low  cost,  and  its  Wi-­‐Fi  adapter  connection.    

  Laird  S9025  &  IMEX  RFID  Antennas  

These  two  antennas  were  chosen  for  the  project  based  on  their  low  cost  and  their  gains.  The  Laird  antenna  operated  at  a  frequency  of  902-­‐928  MHz  and  had  a  gain  of  5.5  dBi.  This  antenna  was  mounted  inside  of  the  refrigerator.  The  IMEX  antenna  also  operated  at  an  ultrahigh  frequency,  902-­‐928  MHz,  and  had  a  gain  of  9.0  dBi.  This  antenna  was  used  for  reading  all  of  the  tags  outside  of  the  refrigerator.    We  tested  the  read  range  of  each  antenna  versus  the  power  ratio.  The  results  of  the  test  are  shown  below  in  Figure  8  and  9.    

       

0.00  

20.00  

40.00  

60.00  

80.00  

100.00  

120.00  

140.00  

160.00  

180.00  

200.00  

15.00   20.00   25.00   30.00   35.00  

Distanc

e  

dBm  (power  ratio)  

5.5  dBi  Antenna  Read  Ranges  

Avery  Dennison  UHF  RFID  Tags  (AD-­‐224  xl)  

Avery  Dennison  UHF  (AD-­‐223  

Figure  8:  Laird  S9025  Read  Ranges

Page 16: Household inventory management system

P a g e |

13

   

  Netgear  WNCE2001  

To  connect  the  RFID  reader  to  the  computer  hub  a  Wi-­‐Fi  internet  adapter  was  needed.  The  Netgear  WNCE2001  was  used  for  this  purpose.  The  implementation  of  these  four  pieces  of  hardware  is  can  be  seen  below  in  Figure  10  

       

0.00  

50.00  

100.00  

150.00  

200.00  

250.00  

15.00   20.00   25.00   30.00   35.00  

Distanc

e    

dBm  (power  ratio)  

9.5  dBi  antenna  Read  range  

Avery  Dennison  UHF  RFID  Tags  (AD-­‐224  xl)  

Avery  Dennison  UHF  (AD-­‐223  

Figure  9:  IMEX  Read  Ranges

Figure  10:  Hardware  Implementation

Page 17: Household inventory management system

P a g e |

14

Budget   The  initial  budget,  shown  in  Figure  11,  was  created  within  the  first  month  of  the  project.  We  tried  to  include  all  parts  that  we  thought  we  would  need  to  complete  the  project.  The  prices  were  estimated  based  on  research.  The  preliminary  cost  estimate  for  parts  was  $602.50.  Are  actual  cost  for  the  project,  shown  in  Figure  12,  was  $330.00.  The  price  was  lower  because  we  ended  up  needing  less  hardware  than  planned,  and  didn't  purchase  any  hardware  till  we  found  the  best  deal  available.      

Figure  11:  Estimated  Budget       Figure  12:  Actual  Budget

Page 18: Household inventory management system

P a g e |

15

Timeline   A  timeline  was  created  within  the  first  month  of  the  project.  The  timeline  broke  down  all  of  the  aspects  involved  in  the  project  and  assigned  an  amount  of  time  we  planned  to  spend  on  each  item.  After  the  completion  of  the  project,  we  adjusted  the  timeline  to  show  how  much  time  was  actually  spent  on  each  part  of  the  project.  Figure  13  shows  the  timeline.  The  red  bars  represent  the  initial  time  assigned  to  each  task.  The  blue  bars  indicate  the  actual  time  if  there  was  any  deviance  from  the  original  allotted  time.    

     

In  the  original  timeline  we  did  not  account  for  how  much  programming  we  would  actually  be  doing  in  the  project,  how  long  it  would  take  to  research  and  order  necessary  parts,  troubleshoot,  and  build  the  final  prototype.  Despite  the  inaccuracies  of  the  initial  timeline,  all  expectations  were  met  in  time  for  the  Tech  Expo.  

Future  Implementations   With  the  completion  of  this  project  we  have  shown  that  there  is  obvious  room  for  expansion  and  other  implementations  using  RFID  technology  in  everyday  life.  For  example  this  system,  or  a  variation  of  it,  could  be  used  in  hotels  to  track  food  within  a  rooms  refrigerator  for  billing  purposes,  a  restaurant  for  keeping  track  of  their  food  stock,  or  in  a  grocery  store  for  keeping  an  accurate  count  of  their  products.  We  have  shown  that  corporations  could  implement  RFID  tags  onto  their  products  allowing  RFID  tags  and  product  association  to  be  used  in  a  multitude  of  scenarios.  

Figure  11:  Timeline  Comparison

Page 19: Household inventory management system

P a g e |

16

Conclusion  The  outcome  of  this  project  was  a  working  prototype.  We  accomplished  all  of  the  goals  set  by  us,  and  exceeded  a  lot  of  our  expectations  for  the  project.  We  successful  showed  the  potential  positive  affects  that  radio  frequency  identification  can  have  on  everyday  life.  With  this  prot0ype  complete,  it  is  clear  that  if  and  when  companies  start  to  place  RFID  tags  on  products  that  there  are  obvious  advantages  and  thousands  of  potential  uses.  

Page 20: Household inventory management system

P a g e |

17

 

References   Aparicio, Selene. “Shut the Refrigerator Door, Save 7%.” The Daily Green. Good House Keeping, 25 Oct. 2011. Web. 19 Sept. 2012. <http://www.thedailygreen.com/going-green/tips/refrigerator-door-wastes-energy>. "Diabetes Basics." Diabetes Statistics. American Diabetes Association, n.d. Web. 22 Oct. 2012. <http://www.diabetes.org/diabetes-basics/diabetes-statistics/>. Ford, Roy, Professor. "RFID Help." Personal interview. 3 Oct. 2012. Green, Mrs. "The Shocking Truth about Wasted Medicines." The Shocking Truth about Wasted Medicines. My Zero Waste, 31 Dec. 2011. Web. 24 Oct. 2012. <http://myzerowaste.com/2010/12/the-shocking-truth-about-wasted-medicines/>. Hill, Adriene. “Marketplace.org” Marketplace.org.American Public Media, 27 Aug. 2012. Web. 19 Sept. 2012. <http://www.marketplace.org/topics/world/spilled-andspoiled-us-consumers-are-food-wasters> "Is Expired Medication Safe to Use?" DoctorSolve Blog. Doctor Solve, 14 Jan. 2012. Web. 24 Oct. 2012. <http://www.doctorsolve.com/blog/2010/01/drugs-past-their-expiration-date-are-they-safe-to-use.html>.

Page 21: Household inventory management system

P a g e |

18

 

Appendix  A  Windows  Application  Code     Form1.cs    using  System;  usingSystem.Collections.Generic;  usingSystem.ComponentModel;  usingSystem.Data;  usingSystem.Drawing;  usingSystem.Linq;  usingSystem.Text;  usingSystem.Windows.Forms;  using  System.Net;  usingSystem.Runtime.Serialization;  usingSystem.Runtime.Serialization.Json;  namespace  HHIMv2._0  {  publicpartialclassForm1  :  Form          {  public  Form1()                  {  InitializeComponent();                  }    privatevoidbtnExit_Click(object  sender,  EventArgs  e)                  {  Application.Exit();                  }    privatevoid  Form1_Load(object  sender,  EventArgs  e)                  {  //  TODO:  This  line  of  code  loads  data  into  the    

         //rfidsinkDataSet5.InventoryTestTable'  table.  You  can  move,  or  remove  it,  as              //needed.  

this.inventoryTestTableTableAdapter2.Fill(this.rfidsinkDataSet5.InventoryTestTable);  //  TODO:  This  line  of  code  loads  data  into  the    

         //  'rfidsinkDataSet4.InventoryTestTable'  table.  You  can  move,  or  remove  it,              //  as  needed.  

this.inventoryTestTableTableAdapter1.Fill(this.rfidsinkDataSet4.InventoryTestTable);                  }    //***************************************************************************************//***************************************************************************************  //  THIS  SECTION  OF  CODE  DEALS  WITH  FILTERING  THE  INVENTORY  TAB  **************************  //***************************************************************************************//***************************************************************************************    privatevoidbtnResetFilter_Click(object  sender,  EventArgs  e)                  {  

this.inventoryTestTableTableAdapter1.Fill(this.rfidsinkDataSet4.InventoryTestTable);                  }        

Page 22: Household inventory management system

P a g e |

19

   //***************************************************************************************//***************************************************************************************  //  THIS  SECTION  OF  CODE  DEALS  WITH  THE  RECIPE  PUPPY  API  *********************************  //***************************************************************************************  //***************************************************************************************    privatevoid  button1_Click(object  sender,  EventArgs  e)                  {  string  ingredients  =  textBox1.Text;  try                          {  stringqueryString  =  ingredients;  stringlocationsRequest  =  CreateRequest(queryString);  ResponselocationsResponse  =  MakeRequest(locationsRequest);  intlocNum  =  locationsResponse.results.Length;  richTextBox1.Text  =  "  ";    //Get  all  recipes  in  the  response  and  then  extract  the  Recipe    

   //title,href,ingredients,  and  thumbnail  for  each  recipe.    

for  (int  i  =  0;  i  <locNum;  i++)                                  {  ResourceSet  location  =  (ResourceSet)locationsResponse.results[i];  richTextBox1.AppendText(location.RecipeTitle);  richTextBox1.AppendText("  \n");  richTextBox1.AppendText(location.RecipeHref);  richTextBox1.AppendText("  \n");  richTextBox1.AppendText("Ingredients:  "  +            

location.RecipeIngredients);  richTextBox1.AppendText("  \n");  richTextBox1.AppendText("  \n");                                  }                          }  catch  (Exception  f)                          {  Console.WriteLine(f.Message);  Console.Read();                          }                  }    //Create  the  request  URL  publicstaticstringCreateRequest(stringqueryString)                  {  stringUrlRequest  =  "http://www.recipepuppy.com/api/?i="  +  queryString;  return  (UrlRequest);                  }    publicstaticResponseMakeRequest(stringrequestUrl)                  {  try                          {  HttpWebRequest  request  =  WebRequest.Create(requestUrl)  asHttpWebRequest;  using  (HttpWebResponse  response  =  request.GetResponse()  as  

HttpWebResponse)                                  {  if  (response.StatusCode  !=  HttpStatusCode.OK)  thrownewException(String.Format(  "Server  error  (HTTP  {0}:  {1}).",  response.StatusCode,  response.StatusDescription));  

Page 23: Household inventory management system

P a g e |

20

  DataContractJsonSerializerjsonSerializer  =  new  DataContractJsonSerializer(typeof(Response));  objectobjResponse  =    jsonSerializer.ReadObject(response.GetResponseStream());  

ResponsejsonResponse  =  objResponseasResponse;  returnjsonResponse;                                  }                          }  catch  (Exception  e)                          {  MessageBox.Show(e.Message);  returnnull;                          }                  }    privatevoid  richTextBox1_LinkClicked(object  sender,  LinkClickedEventArgs  e)                  {  System.Diagnostics.Process.Start(e.LinkText);                  }    //***************************************************************************************//***************************************************************************************  //***************************************************************************************//***************************************************************************************    privatevoid  tabControl1_Selected_1(object  sender,  TabControlEventArgs  e)                  {  if  (tabControl1.SelectedTab.Equals(tabPage1))                          {                          }  elseif  (tabControl1.SelectedTab.Equals(tabPage2))                          {                          }  elseif  (tabControl1.SelectedTab.Equals(tabPage3))  {                                        }  elseif  (tabControl1.SelectedTab.Equals(tabPage4))                          {  if  (MessageBox.Show("                                                                            Authorized    

Technicians  Only\n                                            Changing  Settings  May  Cause    System  Failure!\n                                                                            Would  You    Like  to  Continue?","Warning",  MessageBoxButtons.YesNoCancel)  ==    DialogResult.Yes)  

                               {  webBrowser1.Navigate(urlString:  "http://hhim.no-­‐ip.org:80");                                  }                          }                  }          }  }    

  Program.cs    using  System;  usingSystem.Collections.Generic;  usingSystem.Linq;  usingSystem.Windows.Forms;  usingSystem.Data;  using  System.Net;  usingSystem.Text;  usingSystem.ComponentModel;  

Page 24: Household inventory management system

P a g e |

21

usingSystem.Runtime.Serialization;  usingSystem.Runtime.Serialization.Json;    namespace  HHIMv2._0  {          [DataContract]  publicclassResponse          {                  [DataMember(Name  =  "title")]  publicstring  Title  {  get;  set;  }                  [DataMember(Name  =  "href")]  publicstringHref  {  get;  set;  }                  [DataMember(Name  =  "version")]  publicdecimal  Version  {  get;  set;  }                  [DataMember(Name  =  "results")]  publicResourceSet[]  results  {  get;  set;  }          }            [DataContract]  publicclassResourceSet          {                  [DataMember(Name  =  "title")]  publicstringRecipeTitle  {  get;  set;  }                  [DataMember(Name  =  "href")]  publicstringRecipeHref  {  get;  set;  }                  [DataMember(Name  =  "ingredients")]  publicstringRecipeIngredients  {  get;  set;  }                  [DataMember(Name  =  "thumbnail")]  publicstringRecipeThumbnail  {  get;  set;  }          }    staticclassProgram          {  ///<summary>  ///The  main  entry  point  for  the  application.  ///</summary>                  [STAThread]  staticvoid  Main()                  {  Application.EnableVisualStyles();  Application.SetCompatibleTextRenderingDefault(false);  Application.Run(newForm1());                  }          }  }  

Page 25: Household inventory management system

P a g e |

22

iOS  Code  

Main  ViewController.m  #import"ViewController.h" #import"ProductInventoryViewController.h" @interfaceViewController () @end @implementation ViewController - (void)viewDidLoad { [superviewDidLoad]; // Do any additional setup after loading the view, typically from a nib. } - (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end  

Main  ViewController.h  

#import<UIKit/UIKit.h> @interface ViewController : UIViewController @end  

OptionDisplayViewController.m  #import"OptionDisplayViewController.h" @interfaceOptionDisplayViewController () @end @implementation OptionDisplayViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } returnself; } - (void)viewDidLoad

Page 26: Household inventory management system

P a g e |

23

{ [superviewDidLoad]; // Do any additional setup after loading the view. } - (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end  

OptionDisplayViewController.h  #import<UIKit/UIKit.h> @interface OptionDisplayViewController : UIViewController @end  

ProductInventoryViewController.m   #import"ProductInventoryViewController.h" #import"ViewController.h" #import"ProductDetailViewController.h" @interfaceProductInventoryViewController () @end @implementation ProductInventoryViewController { NSMutableArray *listofFridgeProducts; NSMutableArray *listofPantryProducts; } @synthesize ProductTableView; @synthesize product; @synthesize tagID; @synthesize unitOfMeasurement; @synthesize amount; @synthesize quantity; @synthesize brand; @synthesize cost; @synthesize productlist; - (void)viewDidLoad { [superviewDidLoad]; // Do any additional setup after loading the view, typically from a nib. listofFridgeProducts = [[NSMutableArrayalloc]init]; listofPantryProducts = [[NSMutableArrayalloc]init];

Page 27: Household inventory management system

P a g e |

24

NSString *productInventoryFile = [[NSBundlemainBundle]pathForResource:@"ProductInventory"ofType:@"plist"]; productlist = [[NSDictionaryalloc]initWithContentsOfFile:productInventoryFile]; product = [productlistobjectForKey:@"Product"]; tagID = [productlistobjectForKey:@"TagID"]; unitOfMeasurement = [productlistobjectForKey:@"UnitofMeasurement"]; amount = [productlistobjectForKey:@"Amount"]; quantity = [productlistobjectForKey:@"Quantity"]; brand = [productlistobjectForKey:@"Brand"]; cost = [productlistobjectForKey:@"Cost"]; [ProductTableViewsetDataSource:self]; [ProductTableViewsetDelegate:self]; NSString *productString = [productobjectAtIndex:0]; NSString *string1 = [productobjectAtIndex:1]; NSString *string3 = [productobjectAtIndex:2]; NSString *string4 = [productobjectAtIndex:3]; NSString *string5 = [productobjectAtIndex:4]; NSString *string6 = [productobjectAtIndex:5]; NSString *string7 = [productobjectAtIndex:6]; NSString *string8 = [productobjectAtIndex:7]; NSString *string9 = [productobjectAtIndex:8]; NSString *string10 = [productobjectAtIndex:9]; [listofFridgeProductsaddObject:productString]; [listofFridgeProductsaddObject:string1]; [listofFridgeProductsaddObject:string3]; [listofFridgeProductsaddObject:string4]; [listofFridgeProductsaddObject:string5]; [listofFridgeProductsaddObject:string6]; [listofFridgeProductsaddObject:string7]; [listofFridgeProductsaddObject:string8]; [listofFridgeProductsaddObject:string9]; [listofFridgeProductsaddObject:string10]; NSString *string11 = [productobjectAtIndex:10]; NSString *string12 = [productobjectAtIndex:11]; NSString *string13 = [productobjectAtIndex:12]; NSString *string14 = [productobjectAtIndex:13]; NSString *string15 = [productobjectAtIndex:14]; NSString *string17 = [productobjectAtIndex:15]; NSString *string16 = [productobjectAtIndex:16]; NSString *string18 = [productobjectAtIndex:17]; NSString *string19 = [productobjectAtIndex:18]; NSString *string20 = [productobjectAtIndex:19]; [listofPantryProductsaddObject:string11]; [listofPantryProductsaddObject:string12]; [listofPantryProductsaddObject:string13];

Page 28: Household inventory management system

P a g e |

25

[listofPantryProductsaddObject:string14]; [listofPantryProductsaddObject:string15]; [listofPantryProductsaddObject:string16]; [listofPantryProductsaddObject:string17]; [listofPantryProductsaddObject:string18]; [listofPantryProductsaddObject:string19]; [listofPantryProductsaddObject:string20]; NSLog(@"%@",listofPantryProducts); } - (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark - Table View - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return2; //return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // return [product count]; switch (section) { case0: return [listofFridgeProductscount]; break; case1: return [listofPantryProductscount]; break; default: break; } return0; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { switch (section) { case0: return@"Refrigerator Inventory"; break; case1: return@"Pantry Inventory"; break;

Page 29: Household inventory management system

P a g e |

26

default: break; } return0; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { staticNSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil) { cell = [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:CellIdentifier]; } //NSString *brandName = [brand objectAtIndex:indexPath.row]; NSString *brandName = [brandobjectAtIndex:indexPath.row]; // cell.detailTextLabel.text =[NSString stringWithFormat:@"Product Brand: %@",brandName]; //cell.textLabel.text = [product objectAtIndex:indexPath.row]; //cell.detailTextLabel.text = [NSString stringWithFormat:@"Product Brand: %@",brandName]; switch (indexPath.section) { case0: cell.textLabel.text = [listofFridgeProductsobjectAtIndex:indexPath.row]; break; case1: cell.textLabel.text = [listofPantryProductsobjectAtIndex:indexPath.row]; break; default: break; } return cell; } - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the specified item to be editable. returnYES; } /* // Override to support rearranging the table view. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { } */

Page 30: Household inventory management system

P a g e |

27

/* // Override to support conditional rearranging of the table view. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the item to be re-orderable. return YES; } */ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { //create an instance of detail view controller ProductDetailViewController *detail = [[ProductDetailViewControlleralloc]init]; //set detail to the destinationviewcontroller property of the seque detail = [segue destinationViewController]; //get the index path NSIndexPath *path = [self.ProductTableViewindexPathForSelectedRow]; NSString *productstring = [productobjectAtIndex:path.row]; NSString *tagIDstring = [tagIDobjectAtIndex:path.row]; NSString *productAmount = [amountobjectAtIndex:path.row]; NSString *quantitystring = [quantityobjectAtIndex:path.row]; NSString *brandstring = [brandobjectAtIndex:path.row]; NSString *coststring = [costobjectAtIndex:path.row]; NSString *unitString = [unitOfMeasurementobjectAtIndex:path.row]; detail.detailItem = [NSStringstringWithFormat:@"Product: %@ \nRFID Tag#: %@ \nProduct Amount: %@ \n Quantity: %@\n Product Brand: %@\n Product Cost: $%@\n Unit of Measurment: %@ ", productstring, tagIDstring,productAmount, quantitystring, brandstring,coststring,unitString]; } @end

ProductInventoryViewController.h  #import<UIKit/UIKit.h> @interface ProductInventoryViewController : UIViewController<UITableViewDelegate, UITableViewDataSource> @property (weak, nonatomic) IBOutletUITableView *ProductTableView; //arrays for products descriptions @property (nonatomic, strong)NSDictionary *productlist; @property (nonatomic, strong)NSArray *product; @property (nonatomic, strong)NSArray *tagID;

Page 31: Household inventory management system

P a g e |

28

@property (nonatomic, strong)NSArray *amount; @property (nonatomic, strong)NSArray *quantity; @property (nonatomic, strong)NSArray *brand; @property (nonatomic, strong)NSArray *cost; @property (nonatomic, strong)NSArray *unitOfMeasurement; @end

 

ProductViewController.m  #import"ProductViewController.h" #import"ProductInventoryViewController.h" #import"ProductDetailViewController.h" @interfaceProductViewController () @end @implementation ProductViewController { NSMutableArray *productSearchArray; NSMutableArray *filterProduct; BOOL isFiltered; } @synthesize productSearch; @synthesize productSearchTable; @synthesize product; @synthesize tagID; @synthesize unitOfMeasurement; @synthesize amount; @synthesize quantity; @synthesize brand; @synthesize cost; @synthesize productlist; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } returnself; } - (void)viewDidLoad { [superviewDidLoad]; //get data from property list NSString *productInventoryFile = [[NSBundlemainBundle]pathForResource:@"ProductInventory"ofType:@"plist"]; productlist = [[NSDictionaryalloc]initWithContentsOfFile:productInventoryFile]; product = [productlistobjectForKey:@"Product"]; tagID = [productlistobjectForKey:@"TagID"];

Page 32: Household inventory management system

P a g e |

29

unitOfMeasurement = [productlistobjectForKey:@"UnitofMeasurement"]; amount = [productlistobjectForKey:@"Amount"]; quantity = [productlistobjectForKey:@"Quantity"]; brand = [productlistobjectForKey:@"Brand"]; cost = [productlistobjectForKey:@"Cost"]; [[selfproductSearchTable]setDataSource:self]; [[selfproductSearch]setDelegate:self]; self.productSearch.delegate = self; [self.productSearchreloadInputViews]; // Do any additional setup after loading the view. } -(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { if(searchText == 0) { isFiltered = NO; } else { isFiltered = YES; filterProduct = [[NSMutableArrayalloc] init]; for (NSString *str inproduct) { NSRange stringRange = [str rangeOfString:searchTextoptions:NSCaseInsensitiveSearch]; if (stringRange.location != NSNotFound) { [filterProductaddObject:str]; } } } [self.productSearchTablereloadData]; } - (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. if (isFiltered) { return [filterProductcount]; } return [productcount];

Page 33: Household inventory management system

P a g e |

30

} -(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { [self.productSearchresignFirstResponder]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { staticNSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(!cell) { cell = [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:CellIdentifier]; } if(!isFiltered) { cell.textLabel.text = [productobjectAtIndex:indexPath.row]; } else { cell.textLabel.text = [filterProductobjectAtIndex:indexPath.row]; } NSString *brandName = [brandobjectAtIndex:indexPath.row]; cell.detailTextLabel.text = [NSStringstringWithFormat:@"Product Brand: %@",brandName]; // cell.textLabel.text = [productSearchArray objectAtIndex:indexPath.row]; return cell; } - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { //create an instance of detail view controller ProductDetailViewController *detail = [[ProductDetailViewControlleralloc]init]; //set detail to the destinationviewcontroller property of the seque detail = [segue destinationViewController]; //get the index path NSIndexPath *path = [self.productSearchTableindexPathForSelectedRow]; NSString *productstring = [productobjectAtIndex:path.row]; NSString *tagIDstring = [tagIDobjectAtIndex:path.row]; NSString *productAmount = [amountobjectAtIndex:path.row]; NSString *quantitystring = [quantityobjectAtIndex:path.row]; NSString *brandstring = [brandobjectAtIndex:path.row]; NSString *coststring = [costobjectAtIndex:path.row]; NSString *unitString = [unitOfMeasurementobjectAtIndex:path.row]; detail.detailItem = [NSStringstringWithFormat:@"Product: %@ \nRFID Tag#: %@ \nProduct Amount: %@ \n Quantity: %@\n Product Brand: %@\n Product Cost: $%@\n Unit of Measurment: %@ ", productstring, tagIDstring,productAmount, quantitystring, brandstring,coststring,unitString]; }

Page 34: Household inventory management system

P a g e |

31

@end

ProductViewController.h  #import<UIKit/UIKit.h> @interface ProductViewController : UIViewController<UITableViewDataSource,UITableViewDelegate, UISearchBarDelegate> @property (weak, nonatomic) IBOutletUISearchBar *productSearch; @property (weak, nonatomic) IBOutletUITableView *productSearchTable; @property (nonatomic, strong)NSDictionary *productlist; @property (nonatomic, strong)NSArray *product; @property (nonatomic, strong)NSArray *tagID; @property (nonatomic, strong)NSArray *amount; @property (nonatomic, strong)NSArray *quantity; @property (nonatomic, strong)NSArray *brand; @property (nonatomic, strong)NSArray *cost; @property (nonatomic, strong)NSArray *unitOfMeasurement; @end

ProductDetailViewController.m  #import"ProductDetailViewController.h" @interfaceProductDetailViewController () -(void)configureView; @end @implementation ProductDetailViewController @synthesize detailItem = _detailItem; @synthesize detailDescriptionLabel = _detailDescriptionLabel; - (void)setDetailItem:(id)newDetailItem { if (_detailItem != newDetailItem) { _detailItem = newDetailItem; // Update the view. [selfconfigureView]; } } - (void)configureView { // Update the user interface for the detail item. if (self.detailItem) { self.detailDescriptionLabel.text = [self.detailItemdescription]; } } - (void)viewDidLoad { [superviewDidLoad]; // Do any additional setup after loading the view, typically from a nib.

Page 35: Household inventory management system

P a g e |

32

[selfconfigureView]; } - (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end

ProductDetailViewController.h  #import<UIKit/UIKit.h> @interface ProductDetailViewController : UIViewController @property (strong, nonatomic) id detailItem; @property (weak, nonatomic) IBOutletUILabel *detailDescriptionLabel; @end

ShoppingListViewController.m  #import"ShoppingListViewController.h" #import"ViewController.h" #import"OptionDisplayViewController.h" @interfaceShoppingListViewController () @end @implementation ShoppingListViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } returnself; } - (void)viewDidLoad { [superviewDidLoad]; // Do any additional setup after loading the view. } - (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (IBAction)homeButton:(id)sender { }

Page 36: Household inventory management system

P a g e |

33

@end

ShoppingListViewController.h  #import<UIKit/UIKit.h> #import"OptionDisplayViewController.h" @interface ShoppingListViewController : UIViewController // @property (weak, nonatomic) IBOutlet UIBarButtonItem *homeButton; - (IBAction)homeButton:(id)sender; @end

ChickenTableViewController.m   #import"ChickenTableViewController.h" #define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0) #define kjsonURL [NSURL URLWithString: @"http://www.recipepuppy.com/api/?i=&q=chicken&p=2/json"] @interfaceChickenTableViewController () @end @implementation ChickenTableViewController { NSMutableArray *chickenRecipeTableArray; NSMutableArray *productInventoryArray; NSMutableArray *ingredientsArray; NSIndexPath *Tableindexpath; } @synthesize backbutton; @synthesize productDictionarys; @synthesize productplistarray; int number = 2; // @synthesize chickenTableView; - (id)initWithStyle:(UITableViewStyle)style { self = [superinitWithStyle:style]; if (self) { // Custom initialization } returnself; } - (void)viewDidLoad { [superviewDidLoad]; dispatch_async(kBgQueue, ^{ NSData *data = [NSDatadataWithContentsOfURL:kjsonURL]; [selfperformSelectorOnMainThread:@selector(fetchedData:) withObject:data

Page 37: Household inventory management system

P a g e |

34

waitUntilDone:YES]; }); UIRefreshControl *refreshControl = [[UIRefreshControlalloc] init]; [refreshControladdTarget:selfaction:@selector(refresh) forControlEvents:UIControlEventValueChanged]; self.refreshControl = refreshControl; productInventoryArray = [[NSMutableArrayalloc]init]; ingredientsArray = [[NSMutableArrayalloc]init]; //load plist into file NSString *productInventoryFile = [[NSBundlemainBundle]pathForResource:@"ProductInventory"ofType:@"plist"]; //put file into dictionary productDictionarys = [[NSDictionaryalloc]initWithContentsOfFile:productInventoryFile]; //put dictionary into an array for products //productInventoryArray = [productDictionarys objectForKey:@"Products"]; //ingredient Test productInventoryArray = [productDictionarysobjectForKey:@"Product"]; NSLog(@"Product Result: %@",productInventoryArray); } -(void)fetchedData:(NSData *)responseData { NSError *error; NSDictionary *json = [NSJSONSerializationJSONObjectWithData:responseDataoptions:kNilOptionserror:&error]; chickenRecipeTableArray =[json objectForKey:@"results"]; [self.tableViewreloadData]; } -(void)refresh { number++; if (number>=1) { self.navigationItem.rightBarButtonItem.enabled = YES; } NSString *pageString = [NSStringstringWithFormat:@"%d",number]; NSString *formatString = [NSStringstringWithFormat:@"http://www.recipepuppy.com/api/?i=&q=chicken&p=%@/json",pageString]; NSURL *url = [NSURLURLWithString:formatString]; dispatch_async(kBgQueue, ^{ NSData *data = [NSDatadataWithContentsOfURL:url]; [selfperformSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES]; }); [self.refreshControlendRefreshing];

Page 38: Household inventory management system

P a g e |

35

} - (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(void) viewDidUnload { [superviewDidUnload]; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { // Return the number of sections. return1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Return the number of rows in the section. return [chickenRecipeTableArraycount]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { staticNSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(!cell) { cell = [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefaultreuseIdentifier:CellIdentifier]; } // Configure the cell... NSDictionary *recipeDictionary = [chickenRecipeTableArrayobjectAtIndex:indexPath.row]; NSString *recipeTitle = [recipeDictionary objectForKey:@"title"]; NSString *recipeIngredients = [recipeDictionary objectForKey:@"ingredients"]; productplistarray = [recipeDictionary objectForKey:@"ingredients"]; //NSString *ingredientstring = [productplistarray objectAtIndex:5]; [ingredientsArrayaddObject:recipeIngredients]; // [ingredientsArray objectAtIndex:1]; NSLog(@"results: %@",ingredientsArray); NSURL *recipeImage = [NSURLURLWithString:[recipeDictionary objectForKey:@"thumbnail"]]; NSData *imageData = [NSDatadataWithContentsOfURL:recipeImage]; UIImage *imageLoad = [[UIImagealloc] initWithData:imageData]; cell.textLabel.text = [NSStringstringWithFormat:@"Name: %@",recipeTitle]; //cell.textLabel.text = [recipeDictionary objectForKey:@"title"]; cell.textLabel.font =[UIFontsystemFontOfSize:13.0]; cell.detailTextLabel.text = [NSStringstringWithFormat:@"Ingredients: %@",recipeIngredients];

Page 39: Household inventory management system

P a g e |

36

cell.detailTextLabel.numberOfLines = 0; cell.imageView.image = imageLoad; return cell; } /* // Override to support conditional editing of the table view. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the specified item to be editable. return YES; } */ /* // Override to support editing the table view. - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { if (editingStyle == UITableViewCellEditingStyleDelete) { // Delete the row from the data source [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; } else if (editingStyle == UITableViewCellEditingStyleInsert) { // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view } } */ /* // Override to support rearranging the table view. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { } */ /* // Override to support conditional rearranging of the table view. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { // Return NO if you do not want the item to be re-orderable. return YES; } */ #pragma mark - Table view delegate

Page 40: Household inventory management system

P a g e |

37

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { // if ([productInventoryArray objectAtIndex:1] == [ingredientsArray objectAtIndex:1]) if ([productInventoryArrayisEqualToArray:ingredientsArray]) { Tableindexpath = indexPath; UIAlertView *ingredientsAlert = [[UIAlertViewalloc]initWithTitle:@"Congrats"message:@"You have enough ingredients to make this recipe"delegate:selfcancelButtonTitle:@"Continue"otherButtonTitles:nil, nil]; [ingredientsAlertshow]; //NSDictionary *recipeDictionary = [chickenRecipeTableArray objectAtIndex:indexPath.row]; //NSString *recipeURL = [recipeDictionary objectForKey:@"href"]; //[[UIApplication sharedApplication] openURL:[NSURL URLWithString:recipeURL]]; [tableViewdeselectRowAtIndexPath:indexPath animated:YES]; } else { Tableindexpath = indexPath; UIAlertView *noMatch = [[UIAlertViewalloc]initWithTitle:@"Sorry"message:@"you dont have enough ingredients to make this recipe"delegate:selfcancelButtonTitle:@"GoBack"otherButtonTitles:@"See Recipe", nil]; // noMatch.tag = [indexPath row]; [noMatchshow]; } [tableViewdeselectRowAtIndexPath:indexPath animated:YES]; } -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { NSString *buttontitle = [alertView buttonTitleAtIndex:buttonIndex]; if ([buttontitle isEqualToString:@"See Recipe"]) { NSDictionary *recipeDictionary = [chickenRecipeTableArrayobjectAtIndex:Tableindexpath.row]; NSString *recipeURL = [recipeDictionary objectForKey:@"href"]; [[UIApplicationsharedApplication] openURL:[NSURLURLWithString:recipeURL]]; } if ([buttontitle isEqualToString:@"Continue"]) { NSDictionary *recipeDictionary = [chickenRecipeTableArrayobjectAtIndex:Tableindexpath.row]; NSString *recipeURL = [recipeDictionary objectForKey:@"href"]; [[UIApplicationsharedApplication] openURL:[NSURLURLWithString:recipeURL]];

Page 41: Household inventory management system

P a g e |

38

} } - (IBAction)goBackToPreviousPage:(id)sender { number --; if (number == 1) { UIAlertView *alertcrap = [[UIAlertViewalloc]initWithTitle:@"Sorry!"message:@"There are no more recipes to be viewed"delegate:nilcancelButtonTitle:@"ok"otherButtonTitles:nil, nil]; [alertcrapshow]; self.navigationItem.rightBarButtonItem.enabled = NO; } else { NSString *recipeString = [NSStringstringWithFormat:@"%d",number]; NSString *formatString = [NSStringstringWithFormat:@"http://www.recipepuppy.com/api/?i=&q=chicken&p=%@/json",recipeString]; NSURL *url = [NSURLURLWithString:formatString]; dispatch_async(kBgQueue, ^{ NSData *data = [NSDatadataWithContentsOfURL:url]; [selfperformSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES]; }); } } @end

ChickenTableViewController.m   #pragma mark - Table view delegate //- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath //{ // [self performSegueWithIdentifier:@"tableViewSegway" sender:self]; //} //-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender //{ // if ([segue.identifier isEqualToString:@"tableViewSegway"]) // { // RecipeDetailViewController *detailView = segue.destinationViewController; // detailView.delegate = self; // NSLog(@"tableViewSegway"); // }

Page 42: Household inventory management system

P a g e |

39

//}

ChickenTableViewController.m   #import<UIKit/UIKit.h> @interface ChickenTableViewController : UITableViewController<UIAlertViewDelegate> //- (IBAction)moreRecipes:(id)sender; // @property (weak, nonatomic) IBOutlet UITableViewCell *chickenTableView; - (IBAction)goBackToPreviousPage:(id)sender; @property (weak, nonatomic) IBOutletUIBarButtonItem *backbutton; @property (nonatomic, strong)NSDictionary *productDictionarys; @property (nonatomic, strong)NSArray *productplistarray; @end

RecipieDetailViewController.m  #import"RecipeDetailViewController.h" @interfaceRecipeDetailViewController () @end @implementation RecipeDetailViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } returnself; } - (void)viewDidLoad { [superviewDidLoad]; // Do any additional setup after loading the view. } - (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end

RecipieDetailViewController.h  #import<UIKit/UIKit.h> @classRecipeDetailViewController;

Page 43: Household inventory management system

P a g e |

40

@protocol RecipeDetailViewControllerDelegate<NSObject>; @end @interface RecipeDetailViewController : UIViewController @property (nonatomic, weak) id<RecipeDetailViewControllerDelegate> delegate;

@end

AddItemViewController.m  #import"AddItemViewController.h" #import"ProductInventoryViewController.h" @interfaceAddItemViewController () @end @implementation AddItemViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [superinitWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } returnself; } - (void)viewDidLoad { [superviewDidLoad]; // Do any additional setup after loading the view. } - (void)didReceiveMemoryWarning { [superdidReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end

AddItemViewController.h  #import<UIKit/UIKit.h> @interface AddItemViewController : UIViewController @end

Page 44: Household inventory management system

P a g e |

41

Appendix  B  Hardware  Technical  Specs     Impinji  RFID  Reader  

Page 45: Household inventory management system

P a g e |

42

Page 46: Household inventory management system

P a g e |

43

  Laird  S9025P  RFID  Antenna  

 

   

Page 47: Household inventory management system

P a g e |

44

  Netgear  WNCE2001