24
THERMAL HOME MONITORING By Jayanth Alangar Gene Shiue Tam Tran Final Report for ECE 445, Senior Design, Spring 2015 TA: Ankit Jain 7 May 2015 Project No. 28

Group 28 Final Paper (1)

Embed Size (px)

DESCRIPTION

Group 28 Final Paper (1)

Citation preview

Page 1: Group 28 Final Paper (1)

   

 

   

THERMAL  HOME  MONITORING  

By  

Jayanth  Alangar  

Gene  Shiue  

Tam  Tran  

Final  Report  for  ECE  445,  Senior  Design,  Spring  2015  

TA:  Ankit  Jain  

7  May  2015  

Project  No.  28  

Page 2: Group 28 Final Paper (1)

ii    

Abstract  

The  Thermal  Home  Monitoring  project  provides  homeowners  with  a  surveillance  system  that  will  involve  a  thermal  live  feed,  human  counting  and  an  Android  application  for  use.  Home  owners  will  be  able  to  view  (on  their  Android  phone)  how  many  people  are  in  each  room,  what  the  room  will  look  like  on  a  thermal  camera  and  will  only  need  one  outlet  to  power  the  system.  In  this  project,  we  find  that  this  thermal  home  monitoring  project  can  count  up  to  two  people  within  a  room  at  a  time,  and  the  data  and  camera  live  feed  can  be  viewed  on  an  Android  application.      

   

Page 3: Group 28 Final Paper (1)

iii    

Table  of  Contents    

1.  Introduction  .............................................................................................................................................  1  

1.1   System  Block  Diagram  ....................................................................................................................  1  

1.2   Block  Descriptions  ..........................................................................................................................  2  

1.2.1   Power  Supply  ..........................................................................................................................  2  

1.2.2   Thermal  Camera  ......................................................................................................................  2  

1.2.3   myRIO  ......................................................................................................................................  2  

1.2.4   Raspberry  Pi  ............................................................................................................................  2  

1.2.5   Android  Application  ................................................................................................................  2  

2     Design  ...................................................................................................................................................  3  

2.1   Power  Supply  .................................................................................................................................  3  

2.1.1   Schematics  ..............................................................................................................................  3  

2.1.2   Calculations  .............................................................................................................................  4  

2.1.3   Simulations  ..............................................................................................................................  5  

2.2   Thermal  Camera  .............................................................................................................................  6  

2.3   DSP  .................................................................................................................................................  6  

2.3.1   Training  the  Classifier  ..............................................................................................................  6  

2.3.2   Alternative  Method  for  Human  Detection  ..............................................................................  6  

2.3.3   Detection  Implementation  ......................................................................................................  6  

2.4   Raspberry  Pi  ...................................................................................................................................  7  

2.5   Android  App  ...................................................................................................................................  8  

3.     Design  Verification  ............................................................................................................................  11  

3.1   Power  Supply  ...............................................................................................................................  11  

3.2   myRIO  ...........................................................................................................................................  11  

3.3   Raspberry  Pi  .................................................................................................................................  12  

3.4   Android  App  .................................................................................................................................  12  

4.     Costs  ..................................................................................................................................................  13  

4.1   Parts  .............................................................................................................................................  13  

4.2   Labor  ............................................................................................................................................  13  

4.3   Total  Cost  .....................................................................................................................................  14  

5.     Conclusion  .........................................................................................................................................  15  

Page 4: Group 28 Final Paper (1)

iv    

5.1     Accomplishments  ........................................................................................................................  15  

5.2     Uncertainties  ...............................................................................................................................  15  

5.3     Future  work  .................................................................................................................................  15  

5.4   Ethical  Considerations  ..................................................................................................................  15  

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

Appendix  A   Requirement  and  Verification  Table  ..................................................................................  18  

Appendix  B   LabVIEW  Front  Panel  and  Block  Diagram  ..........................................................................  19  

Appendix  C   Image  and  Text  Acquisition  Code  .......................................................................................  20  

Page 5: Group 28 Final Paper (1)

1      

1.  Introduction  Current  home  monitoring  systems  lack  capabilities  of  providing  meaningful  data  to  the  user  

other  than  them  just  looking  at  a  camera  feed.    With  the  use  of  a  thermal  camera  in  a  home  monitoring  system  along  with  an  application  of  human  detection  algorithms,  a  user  can  get  information  that  they  find  useful,  such  as,  where  their  children  are  and  what  they  are  doing.    The  way  the  user  can  access  this  data  via  the  Internet  is  through  an  Android  developed  phone  application.    

1.1   System  Block  Diagram  

 

Figure  1:  Block  Diagram  of  Implemented  System  

 

Page 6: Group 28 Final Paper (1)

2      

1.2   Block  Descriptions     The  project  consists  of  several  modules,  with  each  of  these  modules  integrated  together  to  form  the  final  product.    This  section  describes  each  of  the  individual  modules.  

1.2.1   Power  Supply     The  power  circuit  consists  of  AC/DC  and  DC/DC  converters  to  provide  a  steady  voltage  source  at  different  levels  for  the  thermal  camera.    Isolation  was  included  as  a  protection  mechanism.  

1.2.2   Thermal  Camera     This  module  serves  as  the  image  capture  for  the  project.  It’s  responsible  for  capturing  thermal  images  of  a  room.  The  camera  will  capture  an  image  and  send  it  to  the  Raspberry  Pi,  which  will  be  sent  to  the  myRIO  for  processing.  The  camera  will  be  powered  by  the  power  supply.    

1.2.3   myRIO     This  block  serves  to  perform  the  human  detection  algorithms.  The  myRIO’s  tasks  are  to  receive  an  image  from  the  Raspberry  Pi,  process  the  image  to  detect  any  humans,  and  then  to  output  a  text  file  stating  how  many  humans  are  in  the  image.    

1.2.4   Raspberry  Pi  This  module  works  as  a  server  of  the  project.  It  is  responsible  for  transferring  images  taken  from  

the  thermal  camera  to  our  Android  app  and  myRIO,  storing  computed  data  from  the  myRIO,  keeping  track  of  user  settings  specified  from  the  Android  app,  and  sending  out  email  notifications  to  users  if  needed.    

1.2.5   Android  Application  This  block  is  the  user  interface  of  the  project.  It  allows  our  users  to  add  and  remove  rooms,  set  

thresholds  for  different  rooms,  specify  users’  email  addresses  to  receive  notifications,  and  most  importantly  view  information  about  users’  rooms.  The  users  will  be  able  to  use  these  functionalities  over  the  Internet.      

Page 7: Group 28 Final Paper (1)

3      

2     Design     This  section  will  discuss  the  design  procedures  that  were  taken  throughout  the  project.    Once  again,  the  sections  will  be  split  into  each  module  that  was  described  in  the  block  diagram.      

2.1   Power  Supply  An  integral  part  of  the  power  supply  design  is  converting  the  120  Vac  from  a  wall  outlet  to  the  

different  DC  voltage  levels  that  the  camera  needs.    This  section  will  discuss  the  mechanism  by  which  this  was  solved.    

2.1.1   Schematics  In  order  to  begin  producing  the  necessary  voltage  levels,  a  wall  adapter  was  used  to  convert  the  

120  Vac  to  5  Vdc  to  remove  current  spikes  [1].    From  this  5  Vdc  level,  a  buck  converter  was  used  to  take  the  voltage  down  to  the  necessary  level  of  3.3  V  [2].    The  buck  converter  is  shown  in  Figure  2.    

Figure  2:  Buck  Converter  for  Camera  Input  Power

  Figure  2  shows  the  generic  components  for  the  passives  within  the  buck  converter.    We  will  discuss  the  true  values  of  these  components  in  the  following  section.    Also  in  Figure  2,  the  MOSFET  is  treated  as  a  switch,  used  to  connect  5  V  to  rest  of  the  circuit.    We  were  able  to  control  the  MOSFET  through  the  signal  that  was  sent  to  the  gate.    Figure  3  shows  the  circuit  we  used  to  provide  this  control.  

Figure  3:  Gate  Driver  Circuit

Page 8: Group 28 Final Paper (1)

4      

  The  gate  signal  was  produced  with  a  pulse-­‐width  modulation  (PWM)  IC.    In  order  to  produce  the  signal,  an  isolated  12  V  input  source  was  needed.    Not  only  does  this  circuit  provide  a  square  wave  output  signal,  designated  as  the  “Gate  Signal”  in  Figure  3,  but  provided  us  external  control  over  the  frequency  and  duty  ratio  of  the  square  wave.    This  can  be  seen  in  the  top  left  corner  of  Figure  3.    The  components  labeled  as  “Frequency”  and  “Duty  Ratio”  are  potentiometers  that  allowed  us  to  adjust  in  order  to  provide  the  correct  output  voltage.      

2.1.2   Calculations     In  order  to  ensure  that  the  voltage  and  current  specifications  of  the  camera  were  met,  we  had  to  perform  calculations  for  individual  passive  components.    Sample  calculations  are  performed  here  for  the  5  V  to  3.3V  DC/DC  converter.    As  seen  in  the  schematic,  the  buck  converter  that  was  used  has  an  inductor  and  capacitor.    These  values  control  the  variability  of  the  current  and  voltage.           Overall,  there  were  four  parameters  we  had  to  control  for.    These  parameters  were  frequency,  duty  ratio,  inductance,  and  capacitance.    There  were  three  equations  that  we  used  to  evaluate  each  of  the  four  parameters  so  one  had  to  be  fixed.    For  the  purposes  of  our  power  supply,  the  value  we  chose  to  fix  was  the  frequency.    We  chose  a  value  of  50  kHz  (a  value  greater  than  the  human  auditory  threshold  of  20  kHz)  for  our  circuit,  primarily  because  this  value  is  typically  used  in  power  applications.        

The  first  parameter  that  needed  to  be  set  was  the  duty  ratio  of  the  MOSFET  that  was  used.    For  a  buck  converter,  Equation  1  sets  the  duty  ratio.  

𝐷 =     !!"#!!"

( 1 )

𝐷 =    3.35= 0.66

Using  the  duty  ratio,  the  passives  can  be  evaluated.    The  first  is  the  capacitor  of  the  system.    The  

capacitor  controls  the  output  voltage.    Equation  2  shows  the  relationship  of  capacitance  to  voltage.    To  evaluate  for  the  capacitance  needed,  constants  were  taken  from  the  specifications  and  a  frequency  of  50  kHz  were  assumed.    The  current  through  the  capacitor  is  evaluated  as  the  output  current.  

𝑖! = 𝐶 ∗ !"!"

( 2 )

0.093   =  𝐶   ∗  (2   ∗ 0.150) ∗ 𝑓

𝐷

𝐶   =  (0.093   ∗ 0.66)(0.30   ∗  50,000)

 =  4.1  𝜇𝐹

  The  final  passive  component  is  the  inductor.    The  inductor  provides  a  means  of  controlling  the  variability  of  the  current.    Once  again,  all  constants  are  evaluated  through  the  specifications  and  with  a  frequency  of  50  kHz.    The  voltage  across  the  inductor  is  calculated  to  be  the  difference  between  the  input  and  output  voltages.    Equation  3  shows  this  relationship.    

Page 9: Group 28 Final Paper (1)

5      

𝑉! = 𝐿 ∗ !"

!" ( 3 )

 (5 − 3.3)  =  𝐿   ∗  (2 ∗ 0.017)  ∗  𝑓

𝐷

𝐿   =  (1.7   ∗  0.66)

(0.034   ∗  50,000)=  660  𝜇𝐻

2.1.3   Simulations     Using  values  greater  than  what  we  obtained  with  the  calculations  for  the  buck  converter,  a  Simulink  model  was  created.    This  Simulink  model  was  used  to  provide  us  a  baseline  for  our  future  design  and  to  prove  that  is  a  viable  means  to  produce  the  3.3  V  needed  for  the  FLiR  thermal  camera.    In  addition,  we  added  parasitic  inductances,  capacitances,  and  resistances  (obtained  from  datasheets)  in  order  to  provide  a  more  accurate  Simulink  model.    Figure  4  shows  this  output  voltage.         The  output  at  100  ms  is  marked  on  the  plot  and  is  shown  to  be  3.298  V,  well  within  the  specifications  we  need  for  the  thermal  camera  input.    One  potential  issue  that  arose  was  the  overshoot  seen  at  approximately  7  ms.    However,  because  this  was  a  momentary  voltage,  protection  was  built  into  the  thermal  camera  circuitry  to  handle  this  event.    Because  the  voltage  ripple  was  nearly  zero,  and  the  current  ripple  is  simply  a  resistive  load,  we  were  able  to  meet  the  specifications  provided  for  current  as  well.    Because  the  simulations  were  successful,  the  buck  converter  topology  was  used  for  the  final  circuit.    

 

Figure  4:  Simulink  Simulations  of  Camera  Input  Power  

Page 10: Group 28 Final Paper (1)

6      

2.2   Thermal  Camera     A  FLiR  development  kit  thermal  camera  module  is  used  here  due  to  its  active  technical  support  and  low  cost.    PureEngineering  LLC.  provided  the  protocol  for  communication  used.  [3]  

2.3   DSP     A  DSP  will  be  necessary  for  performing  human  detection.    It  will  need  a  file  I/O  system  to  store  a  trained  classifier  model  and  to  store  the  camera  live  feed  from  the  Raspberry  Pi  for  processing.    The  DSP  will  be  handled  by  the  myRIO,  where  the  Vision  Development  Module  will  be  used.    The  myRIO  runs  on  Linux,  so  file  I/O  can  be  easily  handled  by  SSH  and  SFTP  protocols.    Communication  with  the  Raspberry  PI  will  be  handled  via  SFTP  since  the  myRIO  has  Wi-­‐Fi  capability.    For  human  detection,  we  used  NI’s  particle  classification  trainer  and  the  Vision  Development  Module  VI’s.    

2.3.1   Training  the  Classifier  For  developing  a  classifier,  we  used  sets  of  86  images  with  zero  people  in  a  room,  85  images  of  

one  individual  in  different  positions,  postures,  places  in  a  room,  and  17  images  of  two  individuals.    We  trained  the  classifier  to  have  three  class  labels  of  0,  1  and  2.    The  classifier  performs  feature  extraction  by  analyzing  a  shape  of  bright  pixels  that  denote  a  high  temperature  entity.    This  shape  of  pixels  will  be  used  as  feature  vector  for  the  classifier.    NI  describes  the  feature  vectors  in  [4].  

    The  NI  Particle  Classification  Training  program  outputs  a  trained  classifier  model  file  that  we  send  to  the  myRIO  via  an  SFTP  “put”  command.    Once  the  myRIO  has  the  file  on  its  directory,  we  created  a  VI  to  load  the  classifier  and  to  test  images  against  it  for  human  detection.    

2.3.2   Alternative  Method  for  Human  Detection     Previously,  we  used  HOG  feature  extraction  VI  that  was  developed  to  perform  the  human  detection.    However,  a  third  party  Linear  SVM  VI  [5]  that  was  needed  for  classification  was  not  compatible  with  the  myRIO  because  the  necessary  software  libraries  were  not  on  the  myRIO.      

The  HOG  algorithm  does  an  edge  detection  of  truncated  smaller  pictures  (cells)  of  the  original  picture.    After  edge  detection,  the  gradient  of  the  edges  will  be  calculated.    A  histogram  of  these  edge  directions  will  be  computed  for  these  cells  and  then  by  using  all  the  histograms  generated  by  the  cells  of  the  image,  a  descriptor  can  be  made  to  describe  what  is  human  or  not.    The  HOG  feature  extraction  that  was  implemented  is  shown  in  Figure  5.    

2.3.3   Detection  Implementation  Once  a  classifier  model  is  trained,  images  are  sent  from  the  Raspberry  Pi  using  an  SFTP  “put”  

command,  to  the  myRIO  where  the  myRIO  will  load  the  image,  test  it  against  the  classifier  and  the  classifier  testing  VI  will  output  the  class  label  for  that  image.  For  our  purposes,  the  classifier  will  output  0,  1  or  2,  where  the  integers  denote  the  number  of  people  that  the  myRIO  can  see.  This  output  is  stored  onto  a  text  file  called  “info.txt”.    

 

Page 11: Group 28 Final Paper (1)

7      

 Figure  5:  Approach  for  HOG  Feature  Extraction,  taken  from  [6]

2.4   Raspberry  Pi  The  Raspberry  Pi  needs  to  be  able  to  connect  to  Wi-­‐Fi  to  do  useful  work.  However,  the  module  

itself  does  not  have  built-­‐in  Wi-­‐Fi.  RaspberryPiHQ  suggested  getting  an  Edimax  EW-­‐7811UN,  an  USB  Wi-­‐Fi  adapter,  since  it  is  cheap,  small,  and  compatible  [7].    However,  the  same  USB  Wi-­‐Fi  adapter  was  already  with  the  Raspberry  Pi  when  we  checked  it  out  from  the  lab,  so  we  didn’t  need  to  buy  one.  From  RaspberryPiHQ’s  tutorial,  we  were  able  to  configure  the  Raspberry  Pi  to  connect  to  wireless  Internet.  

 For  the  Raspberry  Pi  to  act  as  a  server,  it  needs  a  static  IP  so  it  can  communicate  with  other  

modules  through  the  same  procedure  every  time.  We  used  Wicd-­‐curses,  a  tool  that  helps  connecting  to  wireless  networks  with  specific  configurations,  to  set  a  static  IP  with  the  help  of  [8].  

 The  final  step  to  set  up  a  web  server  is  to  install  MySQL  and  PHP.  This  will  allow  the  Raspberry  Pi  

to  store  data  and  communicate  with  the  Android  app  with  json  objects  as  parameters.  [9]  explains  how  to  install  MySQL  and  PHP  on  the  Raspberry  Pi  and  make  those  two  parts  interact  with  each  other.  That  website  also  covers  how  to  make  PHP  pages  on  Raspberry  Pi  public  in  order  to  allow  other  subsystems  like  the  Android  app  to  communicate  information  across  the  internet.  

 The  flowchart  of  the  module  is  shown  in  Figure  6.  There  are  two  branches,  receiving  a  query  

from  the  Android  app  or  acquiring  data  from  myRIO.  When  receiving  a  query  from  the  Android  app,  it  executes  the  query  and  returns  the  query  results.  After  acquiring  data  from  myRIO,  it  updates  the  database  and  checks  if  email  notification  needs  to  be  performed  as  well.  

 

Page 12: Group 28 Final Paper (1)

8      

 Figure  6:  Flowchart  of  the  Raspberry  Pi  as  a  server  

To  output  human  detection  data  from  the  myRIO,  the  Raspberry  Pi  will  initiate  an  SFTP  protocol  with  the  myRIO  using  a  Python  script  with  a  Paramiko  library.    Once  this  SFTP  protocol  successfully  connects,  the  Raspberry  Pi  will  continuously  send  an  image  and  retrieve  a  text  file  from  the  myRIO  in  a  while  loop  until  a  break  command  is  sent  as  shown  in  Figure  7.  The  retrieving  process  will  involve  a  “get”  command  for  the  “info.txt”  file  where  the  Raspberry  Pi  will  read  the  text  file  to  see  the  output  of  myRIO.    

 Figure  7:  File  I/O  Flowchart

 

For  the  email  notification,  we  used  a  Python  script  with  SMTP.    [10]  shows  the  exact  code  that  we  needed  to  make  the  protocol  work.

2.5   Android  App   The  main  purpose  of  this  Android  application  is  to  allow  the  user  to  interact  with  the  other  subsystems  without  knowing  many  technical  details.  The  flowchart  is  shown  below  in  Figure  8.  The  app  sends  a  request  to  the  server  (Raspberry  Pi),  waits  for  the  response,  and  displays  the  response.    

The  main  functionalities  of  the  app  include  viewing  rooms,  adding/removing  rooms,  setting  rooms’  thresholds,  and  setting  user’s  email  address.  Each  of  the  mentioned  functionalities  above  has  a  unique  tab  in  the  application.  The  menu  of  the  application  is  shown  in  Figure  9  below.    

Page 13: Group 28 Final Paper (1)

9      

 Figure  8:  Flowchart  of  the  Android  App

 Figure  9:  Android  Application  Menu

The  first  functionality  is  viewing  rooms.    For  each  room  that  the  user  added,  there  is  a  page  like  shown  in  Figure  10.    The  page  shows  the  name  of  the  room,  buttons  to  go  to  the  next/previous  room  (only  available  for  more  than  one  room,  hence  not  shown  in  the  figure),  the  number  of  people  in  the  current  room,  and  a  button  to  show/hide  live  feed.    The  number  of  people  in  the  room  and  the  live  feed  automatically  refresh  themselves  once  every  second.  

 Figure  10:  Example  Page  of  a  Room

Page 14: Group 28 Final Paper (1)

10    

The  second  functionality  is  adding/removing  rooms.    The  user  interface  for  this  functionality  is  shown  in  Figure  11.      This  requires  the  user  to  enter  a  room  name  and  the  IP  address  of  the  Raspberry  Pi  that  corresponds  to  the  room.    We  have  implemented  an  IP  address  check.    The  check  will  make  sure  the  user  has  entered  in  a  valid  IP  address  after  the  user  hits  the  ‘Add’  button.    There  is  also  a  check  that  the  room  name  should  not  exceed  30  characters.  

 

 Figure  11:  Adding/Removing  Rooms

The  next  functionality  is  setting  rooms’  thresholds.    Figure  12  is  an  example  of  how  the  tab  of  this  functionality  looks  like.    This  functionality  is  very  simple;  it  asks  for  a  number  for  each  room  as  the  threshold  for  the  room.  

 

 Figure  12:  Setting  Room  Thresholds

The  final  functionality  is  setting  user’s  email  address.    Figure  13  shows  what  this  tab  looks  like.    

We  implemented  an  email  format  check  for  this  tab  to  make  sure  the  user  entered  a  valid  email  address.    

 Figure  13:  Setting  User's  Email  Address

Page 15: Group 28 Final Paper (1)

11    

3.     Design  Verification  

3.1   Power  Supply  Requirements   Verification   Results  (Y/N)  

Supply  3.3  V  with  a  tolerance  of  5%      

Use  digital  multimeter  to  measure  proper  output  of  3.3  V  with  35  Ω  load  

Y  The  output  of  the  power  supply  had  an  average  voltage  of  3.3  V  with  a  ripple  of  20  mV.  

3.2   myRIO  

Requirements   Verification   Results  (Y/N)  

Can  receive  and  send  signals  to  Raspberry  PI  

Using  an  SFTP  protocol  between  the  myRIO  and  the  Raspberry  PI,  the  myRIO  will  be  sending  a  text  file  to  the  RPI  for  reading  and  the  RPI  will  be  sending  an  image  to  the  myRIO  for  viewing.    

Y  We  confirmed  the  result  by  going  into  the  directories  via  SSH  and  seeing  the  files  were  there.    We  opened  up  the  files  in  both  systems.  

Receives  camera  live  feed  from  Raspberry  PI  within  3  seconds  with  a  5%  tolerance.      

View  the  camera  live  feed  on  both  the  Raspberry  PI  and  the  myRIO,  and  see  that  both  live  feeds  are  similar.  Live  feed  will  be  checked  by  viewing  the  file  on  the  Linux  directory  

Y  We  confirmed  the  live  updates  by  viewing  new  images  on  the  on  the  Front  Panel  display  of  the  myRIO  code.    

Has  a  missed  rate  human  detection  of  less  than  30%  

Run  human  detection  algorithm  on  a  set  of  thermal  images  and  do  statistical  analyses  of  the  false  positives  and  the  passes.  

Y  We  took  a  set  of  15  images  with  0,1,  or  2  people  and  the  myRIO  was  correct  on  12  images  for  a  missed  rate  human  detection  of  20%.  

Outputs  human  detection  data  within  a  5  second  timeframe  with  10%  tolerance.      

Use  a  timing  program  to  record  how  much  time  the  myRIO  will  take  to  output  data,  given  an  input.    

Y  We  timed  the  runthrough  of  taking  a  picture  to  receiving  an  info.txt  file  to  be  3  seconds  on  average.  

Page 16: Group 28 Final Paper (1)

12    

3.3   Raspberry  Pi  

Requirements   Verification   Results  (Y/N)  

Send  data  through  the  Internet    

Ping  Google  and  get  a  response  to  show  that  the  module  is  connected  to  the  Internet  

Y  We  used  a  ping  program  to  ping  google.com  and  received  packets  back  to  verify  the  connection.  

 

3.4   Android  App  

Requirements   Verification   Results  (Y/N)  

Receive  and  display  data  with  an  error  of  no  more  than  ±1  person  

Make  a  dummy  program  on  the  Raspberry  Pi  to  output  3  people  in  the  room,  and  receive/display  3  (±1)  people  on  the  Android  app  

Y  We  created  a  dummy  Python  script  to  output  3  people  in  a  room.    The  stats  page  of  the  room  showed  3  people  in  the  room  after  one  second.  

Send  e-­‐mail  notification  if  number  of  persons  detected  in  room  exceeds  set  threshold  

Make  a  dummy  program  on  the  Raspberry  Pi  to  output  3  people  in  the  room  and  set  the  threshold  to  2  people.  Check  e-­‐mail  to  see  if  e-­‐mail  is  sent.  

Y  We  set  the  e-­‐mail  address  to  our  e-­‐mail  and  set  the  threshold  to  2  people.    After  using  the  same  dummy  program  as  before  to  output  3,  we  received  an  e-­‐mail  saying  the  threshold  was  exceeded.  

 

   

Page 17: Group 28 Final Paper (1)

13    

4.     Costs  

4.1   Parts  Table  1:  Parts  Cost  

Item   Manufacturer   Vendor   Quantity   Cost  

myRIO  National  

Instruments  National  

Instruments   1   $200    

FLiR  Dev  Kit  (Thermal  Camera  Module)   FLiR   Sparkfun     1   $349.95  

Raspberry  Pi  Raspberry  Pi  Foundation   Amazon   1   $30  

Wifi  USB  Adapter   Edimax   Amazon   1   $9  

Inductor:  39  mH   API  Delevan   Mouser   1   $6.50  

Inductor:  2.61  mH   TDK   Mouser   1   $1.76  

Capacitor:  47  uF   Samsung   Digikey   2   $1.54  

Schottky  Diode   MCC   Digikey   2   $0.56  

FETs   Rohm   Digikey   2   $0.80  

Wall  Adapter   Phihong  USA   Digikey   1   $6.38  

Total        14   $606.49  

 

4.2   Labor  Table  2:  Labor  Costs  

Name   Hourly  Rate   Total  Hours  Invested  

Total  =  Hourly  Rate  x  2.5  x  Total  Hours  Invested  

Tam  Tran   $27.50   225   $15,468.75  

Jayanth  Alangar   $27.50   225   $15,468.75  

Gene  Shiue   $8.25   500   $10,312.50  

Total     950   $41,250  

Page 18: Group 28 Final Paper (1)

14    

4.3   Total  Cost  Table  3:  Total  Cost  for  Labor  and  Parts  

Section   Total  

Labor   $41,250  

Parts   $821.49  

Grand  Total   $42,071.49  

 

   

Page 19: Group 28 Final Paper (1)

15    

5.     Conclusion  

5.1     Accomplishments  For  our  project,  we  were  able  to  achieve  all  of  our  goals.  We  managed  to  have  a  missed  rate  

detection  of  below  the  30%  that  we  were  aiming  for.  We  developed  an  Android  application  that  can  interface  with  the  thermal  home  monitoring  system,  where  the  user  can  see  how  many  people  are  in  a  room,  set  a  threshold  and  emailing  system  and  can  even  view  a  live  feed  of  a  room.  We  were  also  able  to  produce  a  power  supply  that  can  be  powered  by  a  home  outlet,  which  will  power  the  thermal  camera,  Raspberry  Pi,  and  the  myRIO.    

5.2     Uncertainties     At  this  time,  we  were  unable  to  fully  integrate  all  of  the  different  modules  for  our  project.    We  found  that  our  project  was  easy  to  access  by  intruders  since  we  lack  encryption  for  the  data  that  we  have.    Another  uncertainty  is  the  limit  of  human  detection,  since  we  were  unable  to  procure  a  large  training  set  with  many  different  numbers  of  people,  we  can  only  count  up  to  2  people.      This  meant  that  the  myRIO  would  just  guess  at  the  number  if  the  image  has  3  or  more  people.    Furthermore,  upon  testing  the  power  supply  on  a  PCB,  we  had  a  blown  part  and  we  had  to  go  back  to  the  breadboard  design.    

5.3     Future  work  The  communication  between  Android  app  and  Raspberry  Pi  would  be  improved  by  having  some  

sort  of  an  authentication  system.  This  would  make  sure  that  the  homeowner’s  data  are  secure.  Also,  texting  notification  can  be  added  on  top  of  email  notification  to  allow  the  user  to  have  more  choices  on  the  notification  method  based  on  their  preference.    

 For  the  human  detection,  the  missed  rate  percentage  can  be  decreased  by  having  a  larger  

training  set  for  each  class  and  as  well  as  having  a  large  training  set  for  3  or  more  people.  Other  hardware  platforms  besides  the  myRIO  should  be  tested  for  human  detection  since  different  software  platforms  besides  LabView  can  be  used  that  are  primarily  used  for  signal  processing  for  example,  using  a  BeagleBone  Black  with  C++.    

    The  power  supply  can  be  improved  by  transferring  the  circuit  onto  a  PCB.    This  would  provide  an  overall  cleaner  product  that  is  less  bulky.    In  addition,  we  would  be  able  to  have  a  product  that  is  easier  to  adjust  if  adjustments  need  to  be  made.  

5.4   Ethical  Considerations  Our  project  followed  the  IEEE  Code  Of  Ethics,  taken  from  [11],  because  it  is  the  law  that  electrical  

engineers  follow.  Below  we  state  the  relevant  clauses  of  the  IEEE  code  of  ethics  that  relate  to  our  project.      

1. To  accept  responsibility  in  making  decisions  consistent  with  the  safety,  health,  and  welfare  of  the  public,  and  to  disclose  promptly  factors  that  might  endanger  the  public  or  the  environment;  o We  will  test  the  power  supply  of  our  circuit  to  make  sure  it  is  functioning  within  spec  and  we  

will  put  warnings  where  necessary.  2. To  be  honest  and  realistic  in  stating  claims  or  estimates  based  on  available  data;      

o Any  claims  made  by  this  project  will  be  verified  through  statistical  analysis  and/or  following  the  requirements  and  verification  table.    

Page 20: Group 28 Final Paper (1)

16    

3. To  reject  bribery  in  all  its  forms;      o We  are  working  on  this  project  out  of  pure  interests  without  any  desire  to  individually  

benefit  ourselves  financially.  We  will  ensure  that  we  will  not  cut  corners  under  the  intention  of  making  money.    

4. To  improve  the  understanding  of  technology;  its  appropriate  application,  and  potential  consequences;      o The  purpose  of  this  project  is  to  build  on  top  of  preexisting  home  monitoring  systems,  but  to  

include  the  use  of  computer  vision  algorithms  and  to  make  use  of  smart  phones  to  add  a  sense  of  security  to  the  user.    

5. To  maintain  and  improve  our  technical  competence  and  to  undertake  technological  tasks  for  others  only  if  qualified  by  training  or  experience,  or  after  full  disclosure  of  pertinent  limitations;      o Everyone  in  this  project  has  taken  relevant  coursework  for  their  role  in  this  project.  If  there  

is  a  gap  in  knowledge  for  this  project,  research  will  be  done.    6. To  seek,  accept,  and  offer  honest  criticism  of  technical  work,  to  acknowledge  and  correct  errors,  

and  to  credit  properly  the  contributions  of  others;      o This  project  already  goes  through  design  reviews  that  will  involve  the  criticisms  of  the  

course  instructor,  TAs,  and  peers.  This  feedback  system  will  help  improve  the  quality  of  this  project.    

7. To  avoid  injuring  others,  their  property,  reputation,  or  employment  by  false  or  malicious  action;      o This  project  is  not  intended  to  harm  individuals  in  anyway  but  to  give  them  a  sense  of  

security.  Any  part  of  the  project  that  seems  potentially  dangerous  will  be  marked  with  explicit  safety  warnings.  

8. To  assist  colleagues  and  co-­‐workers  in  their  professional  development  and  to  support  them  in  following  this  code  of  ethics.  

o From  participating  in  peer  reviews  and  giving  suggestions  in  the  senior  design  lab,  we  as  a  team  can  help  support  others  professionally  and  spread  the  IEEE  code  of  ethics  in  this  way.    

 

 

   

Page 21: Group 28 Final Paper (1)

17    

References    [1]     P.    Krein,  Elements  of  Power  Electronics.  New  York:  Oxford  University  Press,  2015.    [2]     Sparkfun,  'FLIR  LEPTON  Long  Wave  Infrared  (LWIR)  Datasheet',  2014.  [Online].  Available:  

https://cdn.sparkfun.com/datasheets/Sensors/Infrared/FLIR_  Lepton_Data_Brief.pdf.  [Accessed:  12-­‐  Feb-­‐  2015].  

[3]     GitHub,  'PureEngineering/LeptonModule',  2015.  [Online].  Available:  

https://github.com/PureEngineering/LeptonModule.  [Accessed:  09-­‐  Apr-­‐  2015].  

[4]     Zone.ni.com,  'Binary  Particle  Classification  -­‐  NI  Vision  2011  Concepts  Help  -­‐  National  

Instruments',  2015.  [Online].  Available:  http://zone.ni.com/reference/en-­‐XX/help/372916L-­‐

01/nivisionconcepts/binary_particle_classification/.  [Accessed:  26-­‐  Mar-­‐  2015].  

[5]     Decibel.ni.com,  'Community:  LabVIEW  Machine  Learning  Toolkit  -­‐  National  Instruments',  2015.  

[Online].  Available:  https://decibel.ni.com/content/docs/DOC-­‐19328.  [Accessed:  30-­‐  Mar-­‐  2015].  

[6]   N.  Dalal,  Histogram  of  Oriented  Gradients  for  Object  Detection,  1st  ed.  Columbia:  University  of  Missouri,  2015.  

[7]     How-­‐To:  Add  WiFi  to  the  Raspberry  Pi.  Available  at:  http://www.  http://raspberrypihq.com/how-­‐to-­‐add-­‐wifi-­‐to-­‐the-­‐raspberry-­‐pi/.  Accessed  May  2015.  

[8]     Wi-­‐fi  on  Raspberry  Pi,  a  simple  guide.  Available  at:  http://www.raspyfi.com/wi-­‐fi-­‐on-­‐raspberry-­‐pi-­‐a-­‐simple-­‐guide/.  Accessed  May  2015.  

[9]    Get  MySql  and  PHP  to  Work  Together  in  Raspberry  Pi.  Available  at:  http://www.php5dp.com/get-­‐mysql-­‐and-­‐php-­‐to-­‐work-­‐together-­‐in-­‐raspberry-­‐pi/.  Accessed  May  2015.  

 

[10]     Send  Mail  Through  Gmail  with  Python.  Available  at:  http://www.nixtutor.com/linux/send-­‐mail-­‐through-­‐gmail-­‐with-­‐python/.  Accessed  April  2015.  

[11]     IEEE.org,  'IEEE  Code  of  Ethics',  2015.  [Online].  Available:  http://www.ieee.org/about/corporate/governance/p7-­‐8.html.  [Accessed:  22-­‐  Feb-­‐  2015].  

 

 

Page 22: Group 28 Final Paper (1)

18    

Appendix  A   Requirement  and  Verification  Table  Module   Requirements   Verification  Procedure   (Y/N)  

myRIO   Can  receive  and  send  signals  to  Raspberry  PI  

Using  an  SFTP  protocol  between  the  myRIO  and  the  Raspberry  PI,  the  myRIO  will  be  sending  a  text  file  to  the  RPI  for  reading  and  the  RPI  will  be  sending  an  image  to  the  myRIO  for  viewing.    

Y  

Receives  camera  live  feed  from  Raspberry  PI  within  3  seconds  with  a  5%  tolerance.      

View  the  camera  live  feed  on  both  the  Raspberry  PI  and  the  myRIO,  and  see  that  both  live  feeds  are  similar.  Live  feed  will  be  checked  by  viewing  the  file  on  the  Linux  directory  

Y  

Has  a  missed  rate  human  detection  of  less  than  30%  

Run  human  detection  algorithm  on  a  set  of  thermal  images  and  do  statistical  analyses  of  the  false  positives  and  the  passes.  

Y  

Outputs  human  detection  data  within  a  5  second  timeframe  with  10%  tolerance.      

Use  a  timing  program  to  record  how  much  time  the  myRIO  will  take  to  output  data,  given  an  input.    

Y  

Power  Supply  Circuit  

Supply  3.3  V  with  a  tolerance  of  5%      

Use  digital  multimeter  to  measure  proper  output  of  3.3  V  with  35  Ω  load  

Y  

Raspberry  Pi   Send  data  through  the  Internet   Ping  Google  and  get  a  response  to  show  that  the  module  is  connected  to  the  Internet  

Y  

Android  App   Receive  and  display  data  with  an  error  of  no  more  than  ±1  person  

Make  a  dummy  program  on  the  Raspberry  Pi  to  output  3  people  in  the  room,  and  receive/display  3  (±1)  people  on  the  Android  app  

Y  

Send  e-­‐mail  notification  if  number  of  persons  detected  in  room  exceeds  set  threshold  

Make  a  dummy  program  on  the  Raspberry  Pi  to  output  3  people  in  the  room  and  set  the  threshold  to  2  people.  Check  e-­‐mail  to  see  if  e-­‐mail  is  sent.  

Y  

Page 23: Group 28 Final Paper (1)

19    

Appendix  B   LabVIEW  Front  Panel  and  Block  Diagram  

 Figure  14:  Front  Panel  for  Human  Detection

 Figure  15:  Code  Block  Diagram

   

Page 24: Group 28 Final Paper (1)

20    

Appendix  C   Image  and  Text  Acquisition  Code  import  paramiko  import  cmd  import  sys  import  os  import  time    t0  =  time.time()    paramiko.util.log_to_file('/tmp/paramiko.log')    #  Open  a  transport  host  =  '192.168.1.164'  transport  =  paramiko.Transport(host)    #  Auth  password  =  '123'  username  =  'admin'  transport.connect(username  =  username,  password  =  password)    #  Go!  sftp  =  paramiko.SFTPClient.from_transport(transport)  var  =  1  while  var  <=  100:     os.system("./leptgraypng  >temp.png  ;  convert  temp.png  -­‐normalize  -­‐contrast  -­‐sharpen  5  sample.bmp")    #  Download     filepath  =  '../lvuser/info.txt'     localpath  =  '/home/pi/info.txt'     sftp.get(filepath,  localpath)    #  Upload     localpath  =  '/home/pi/Downloads/LeptonModule-­‐master/flirpi/sample.bmp'     filepath  =  '../lvuser/image.bmp'     sftp.put(localpath,  filepath)    #  Break  while  loop  after  100  iterations     var  =  var  +1    #Close  connection  sftp.close()  transport.close()  #Record  timing  of  code    t1  =  time.time()  total  =  t1  -­‐  t0  print  "Total  Time  Is:  %s  seconds"  %  str(total)