-
Notifications
You must be signed in to change notification settings - Fork 0
/
design_spec.tex
2135 lines (1752 loc) · 176 KB
/
design_spec.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[journal,compsoc]{IEEEtran}
%
% If IEEEtran.cls has not been installed into the LaTeX system files,
% manually specify the path to it like:
% \documentclass[journal]{../sty/IEEEtran}
\usepackage{listings} % For code box
\usepackage{array} % For first column bold in table
\usepackage{parskip} % Disable indentation, adds spacing
\usepackage{rotating} % for sideways table
\usepackage{float}
%\usepackage[justification=centering]{caption} % for centering captions
\usepackage{comment} % for block commenting
\usepackage{mathtools} % for using mathematical symbols
\usepackage{lcd} % lcd screen
\usepackage{subcaption} % subfigures
\usepackage{hyperref} % urls
\usepackage{booktabs} % idk
\usepackage{colortbl} % cool tables
% Some very useful LaTeX packages include:
% (uncomment the ones you want to load)
% *** MISC UTILITY PACKAGES ***
%
%\usepackage{ifpdf}
% Heiko Oberdiek's ifpdf.sty is very useful if you need conditional
% compilation based on whether the output is pdf or dvi.
% usage:
% \ifpdf
% % pdf code
% \else
% % dvi code
% \fi
% The latest version of ifpdf.sty can be obtained from:
% http://www.ctan.org/pkg/ifpdf
% Also, note that IEEEtran.cls V1.7 and later provides a builtin
% \ifCLASSINFOpdf conditional that works the same way.
% When switching from latex to pdflatex and vice-versa, the compiler may
% have to be run twice to clear warning/error messages.
% *** CITATION PACKAGES ***
%
%\usepackage{cite}
% cite.sty was written by Donald Arseneau
% V1.6 and later of IEEEtran pre-defines the format of the cite.sty package
% \cite{} output to follow that of the IEEE. Loading the cite package will
% result in citation numbers being automatically sorted and properly
% "compressed/ranged". e.g., [1], [9], [2], [7], [5], [6] without using
% cite.sty will become [1], [2], [5]--[7], [9] using cite.sty. cite.sty's
% \cite will automatically add leading space, if needed. Use cite.sty's
% noadjust option (cite.sty V3.8 and later) if you want to turn this off
% such as if a citation ever needs to be enclosed in parenthesis.
% cite.sty is already installed on most LaTeX systems. Be sure and use
% version 5.0 (2009-03-20) and later if using hyperref.sty.
% The latest version can be obtained at:
% http://www.ctan.org/pkg/cite
% The documentation is contained in the cite.sty file itself.
% *** GRAPHICS RELATED PACKAGES ***
%
\ifCLASSINFOpdf
% \usepackage[pdftex]{graphicx}
% declare the path(s) where your graphic files are
% \graphicspath{{../pdf/}{../jpeg/}}
% and their extensions so you won't have to specify these with
% every instance of \includegraphics
% \DeclareGraphicsExtensions{.pdf,.jpeg,.png}
\else
% or other class option (dvipsone, dvipdf, if not using dvips). graphicx
% will default to the driver specified in the system graphics.cfg if no
% driver is specified.
% \usepackage[dvips]{graphicx}
% declare the path(s) where your graphic files are
% \graphicspath{{../eps/}}
% and their extensions so you won't have to specify these with
% every instance of \includegraphics
% \DeclareGraphicsExtensions{.eps}
\fi
% graphicx was written by David Carlisle and Sebastian Rahtz. It is
% required if you want graphics, photos, etc. graphicx.sty is already
% installed on most LaTeX systems. The latest version and documentation
% can be obtained at:
% http://www.ctan.org/pkg/graphicx
% Another good source of documentation is "Using Imported Graphics in
% LaTeX2e" by Keith Reckdahl which can be found at:
% http://www.ctan.org/pkg/epslatex
%
% latex, and pdflatex in dvi mode, support graphics in encapsulated
% postscript (.eps) format. pdflatex in pdf mode supports graphics
% in .pdf, .jpeg, .png and .mps (metapost) formats. Users should ensure
% that all non-photo figures use a vector format (.eps, .pdf, .mps) and
% not a bitmapped formats (.jpeg, .png). The IEEE frowns on bitmapped formats
% which can result in "jaggedy"/blurry rendering of lines and letters as
% well as large increases in file sizes.
%
% You can find documentation about the pdfTeX application at:
% http://www.tug.org/applications/pdftex
% *** MATH PACKAGES ***
%
%\usepackage{amsmath}
% A popular package from the American Mathematical Society that provides
% many useful and powerful commands for dealing with mathematics.
%
% Note that the amsmath package sets \interdisplaylinepenalty to 10000
% thus preventing page breaks from occurring within multiline equations. Use:
%\interdisplaylinepenalty=2500
% after loading amsmath to restore such page breaks as IEEEtran.cls normally
% does. amsmath.sty is already installed on most LaTeX systems. The latest
% version and documentation can be obtained at:
% http://www.ctan.org/pkg/amsmath
% *** SPECIALIZED LIST PACKAGES ***
%
%\usepackage{algorithmic}
% algorithmic.sty was written by Peter Williams and Rogerio Brito.
% This package provides an algorithmic environment fo describing algorithms.
% You can use the algorithmic environment in-text or within a figure
% environment to provide for a floating algorithm. Do NOT use the algorithm
% floating environment provided by algorithm.sty (by the same authors) or
% algorithm2e.sty (by Christophe Fiorio) as the IEEE does not use dedicated
% algorithm float types and packages that provide these will not provide
% correct IEEE style captions. The latest version and documentation of
% algorithmic.sty can be obtained at:
% http://www.ctan.org/pkg/algorithms
% Also of interest may be the (relatively newer and more customizable)
% algorithmicx.sty package by Szasz Janos:
% http://www.ctan.org/pkg/algorithmicx
% *** ALIGNMENT PACKAGES ***
%
%\usepackage{array}
% Frank Mittelbach's and David Carlisle's array.sty patches and improves
% the standard LaTeX2e array and tabular environments to provide better
% appearance and additional user controls. As the default LaTeX2e table
% generation code is lacking to the point of almost being broken with
% respect to the quality of the end results, all users are strongly
% advised to use an enhanced (at the very least that provided by array.sty)
% set of table tools. array.sty is already installed on most systems. The
% latest version and documentation can be obtained at:
% http://www.ctan.org/pkg/array
% IEEEtran contains the IEEEeqnarray family of commands that can be used to
% generate multiline equations as well as matrices, tables, etc., of high
% quality.
% *** SUBFIGURE PACKAGES ***
%\ifCLASSOPTIONcompsoc
% \usepackage[caption=false,font=normalsize,labelfont=sf,textfont=sf]{subfig}
%\else
% \usepackage[caption=false,font=footnotesize]{subfig}
%\fi
% subfig.sty, written by Steven Douglas Cochran, is the modern replacement
% for subfigure.sty, the latter of which is no longer maintained and is
% incompatible with some LaTeX packages including fixltx2e. However,
% subfig.sty requires and automatically loads Axel Sommerfeldt's caption.sty
% which will override IEEEtran.cls' handling of captions and this will result
% in non-IEEE style figure/table captions. To prevent this problem, be sure
% and invoke subfig.sty's "caption=false" package option (available since
% subfig.sty version 1.3, 2005/06/28) as this is will preserve IEEEtran.cls
% handling of captions.
% Note that the Computer Society format requires a larger sans serif font
% than the serif footnote size font used in traditional IEEE formatting
% and thus the need to invoke different subfig.sty package options depending
% on whether compsoc mode has been enabled.
%
% The latest version and documentation of subfig.sty can be obtained at:
% http://www.ctan.org/pkg/subfig
% *** FLOAT PACKAGES ***
%
%\usepackage{fixltx2e}
% fixltx2e, the successor to the earlier fix2col.sty, was written by
% Frank Mittelbach and David Carlisle. This package corrects a few problems
% in the LaTeX2e kernel, the most notable of which is that in current
% LaTeX2e releases, the ordering of single and double column floats is not
% guaranteed to be preserved. Thus, an unpatched LaTeX2e can allow a
% single column figure to be placed prior to an earlier double column
% figure.
% Be aware that LaTeX2e kernels dated 2015 and later have fixltx2e.sty's
% corrections already built into the system in which case a warning will
% be issued if an attempt is made to load fixltx2e.sty as it is no longer
% needed.
% The latest version and documentation can be found at:
% http://www.ctan.org/pkg/fixltx2e
\usepackage{stfloats}
% stfloats.sty was written by Sigitas Tolusis. This package gives LaTeX2e
% the ability to do double column floats at the bottom of the page as well
% as the top. (e.g., "\begin{figure*}[!b]" is not normally possible in
% LaTeX2e). It also provides a command:
%\fnbelowfloat
% to enable the placement of footnotes below bottom floats (the standard
% LaTeX2e kernel puts them above bottom floats). This is an invasive package
% which rewrites many portions of the LaTeX2e float routines. It may not work
% with other packages that modify the LaTeX2e float routines. The latest
% version and documentation can be obtained at:
% http://www.ctan.org/pkg/stfloats
% Do not use the stfloats baselinefloat ability as the IEEE does not allow
% \baselineskip to stretch. Authors submitting work to the IEEE should note
% that the IEEE rarely uses double column equations and that authors should try
% to avoid such use. Do not be tempted to use the cuted.sty or midfloat.sty
% packages (also by Sigitas Tolusis) as the IEEE does not format its papers in
% such ways.
% Do not attempt to use stfloats with fixltx2e as they are incompatible.
% Instead, use Morten Hogholm'a dblfloatfix which combines the features
% of both fixltx2e and stfloats:
%
% \usepackage{dblfloatfix}
% The latest version can be found at:
% http://www.ctan.org/pkg/dblfloatfix
%\ifCLASSOPTIONcaptionsoff
% \usepackage[nomarkers]{endfloat}
% \let\MYoriglatexcaption\caption
% \renewcommand{\caption}[2][\relax]{\MYoriglatexcaption[#2]{#2}}
%\fi
% endfloat.sty was written by James Darrell McCauley, Jeff Goldberg and
% Axel Sommerfeldt. This package may be useful when used in conjunction with
% IEEEtran.cls' captionsoff option. Some IEEE journals/societies require that
% submissions have lists of figures/tables at the end of the paper and that
% figures/tables without any captions are placed on a page by themselves at
% the end of the document. If needed, the draftcls IEEEtran class option or
% \CLASSINPUTbaselinestretch interface can be used to increase the line
% spacing as well. Be sure and use the nomarkers option of endfloat to
% prevent endfloat from "marking" where the figures would have been placed
% in the text. The two hack lines of code above are a slight modification of
% that suggested by in the endfloat docs (section 8.4.1) to ensure that
% the full captions always appear in the list of figures/tables - even if
% the user used the short optional argument of \caption[]{}.
% IEEE papers do not typically make use of \caption[]'s optional argument,
% so this should not be an issue. A similar trick can be used to disable
% captions of packages such as subfig.sty that lack options to turn off
% the subcaptions:
% For subfig.sty:
% \let\MYorigsubfloat\subfloat
% \renewcommand{\subfloat}[2][\relax]{\MYorigsubfloat[]{#2}}
% However, the above trick will not work if both optional arguments of
% the \subfloat command are used. Furthermore, there needs to be a
% description of each subfigure *somewhere* and endfloat does not add
% subfigure captions to its list of figures. Thus, the best approach is to
% avoid the use of subfigure captions (many IEEE journals avoid them anyway)
% and instead reference/explain all the subfigures within the main caption.
% The latest version of endfloat.sty and its documentation can obtained at:
% http://www.ctan.org/pkg/endfloat
%
% The IEEEtran \ifCLASSOPTIONcaptionsoff conditional can also be used
% later in the document, say, to conditionally put the References on a
% page by themselves.
% *** PDF, URL AND HYPERLINK PACKAGES ***
%
\usepackage{url}
% url.sty was written by Donald Arseneau. It provides better support for
% handling and breaking URLs. url.sty is already installed on most LaTeX
% systems. The latest version and documentation can be obtained at:
% http://www.ctan.org/pkg/url
% Basically, \url{my_url_here}.
% *** Do not adjust lengths that control margins, column widths, etc. ***
% *** Do not use packages that alter fonts (such as pslatex). ***
% There should be no need to do such things with IEEEtran.cls V1.6 and later.
% (Unless specifically asked to do so by the journal or conference you plan
% to submit to, of course. )
% correct bad hyphenation here
\hyphenation{op-tical net-works semi-conduc-tor}
\begin{document}
%
% paper title
% Titles are generally capitalized except for words such as a, an, and, as,
% at, but, by, for, in, nor, of, on, or, the, to and up, which are usually
% not capitalized unless they are the first or last word of the title.
% Linebreaks \\ can be used within to get better formatting as desired.
% Do not put math or special symbols in the title.
\title{
Help Alert --- Home Assistance (HA--HA) Button
}
%
%
% author names and IEEE memberships
% note positions of commas and nonbreaking spaces ( ~ ) LaTeX will not break
% a structure at a ~ so this keeps an author's name from being broken across
% two lines.
% use \thanks{} to gain access to the first footnote area
% a separate \thanks must be used for each paragraph as LaTeX2e's \thanks
% was not built to handle multiple paragraphs
%
\author{Jamielynne~Batugo, Marco~Carmona, Conrad~Christensen, Jake~Lee, Kevin~Lee, Brian~Nichols, Jesus~Soto, August~Valera, and Jeffrey~Zheng
\thanks{The full source of this project is released under the BSD 2-Clause Licence. See Appendix \ref{appendixsource}}%
\thanks{Manuscript received \today}%
}% <-this % stops a space
\begin{comment}
\thanks{Jamielynne~Batugo, Marco~Carmona, Conrad~Christensen, Jake~Lee, Kevin~Lee, Brian~Nichols, Jesus~Soto, August~Valera, and Jeffrey~Zheng were students at the University of California, Santa Cruz}% <-this % stops a space
\thanks{Ali Adabi, Patrick Mantey, Stephen Petersen, and Anujan Varma were professors and mentors at the University of California, Santa Cruz}% <-this % stops a space
\end{comment}
% note the % following the last \IEEEmembership and also \thanks -
% these prevent an unwanted space from occurring between the last author name
% and the end of the author line. i.e., if you had this:
%
% \author{....lastname \thanks{...} \thanks{...} }
% ^------------^------------^----Do not want these spaces!
%
% a space would be appended to the last name and could cause every name on that
% line to be shifted left slightly. This is one of those "LaTeX things". For
% instance, "\textbf{A} \textbf{B}" will typeset as "A B" not "AB". To get
% "AB" then you have to do: "\textbf{A}\textbf{B}"
% \thanks is no different in this regard, so shield the last } of each \thanks
% that ends a line with a % and do not let a space in before the next \thanks.
% Spaces after \IEEEmembership other than the last one are OK (and needed) as
% you are supposed to have spaces between the names. For what it is worth,
% this is a minor point as most people would not even notice if the said evil
% space somehow managed to creep in.
% The paper headers
\markboth{University of California, Santa Cruz --- Senior Design Project 2017}%
{Batugo \MakeLowercase{\textit{et al.}}: HA--HA Button Project}
% The only time the second header will appear is for the odd numbered pages
% after the title page when using the twoside option.
%
% *** Note that you probably will NOT want to include the author's ***
% *** name in the headers of peer review papers. ***
% You can use \ifCLASSOPTIONpeerreview for conditional compilation here if
% you desire.
% If you want to put a publisher's ID mark on the page you can do it like
% this:
%\IEEEpubid{0000--0000/00\$00.00~\copyright~2015 IEEE}
% Remember, if you use this you must call \IEEEpubidadjcol in the second
% column for its text to clear the IEEEpubid mark.
% use for special paper notices
%\IEEEspecialpapernotice{(Invited Paper)}
% make the title area
\maketitle
% As a general rule, do not put math, special symbols or citations
% in the abstract or keywords.
\begin{abstract}
Current senior citizen emergency button systems on the market serve a very specific user base, immediately escalating any request for assistance to emergency services (police, fire, EMS), and require a subscription cost to maintain connectivity to expensive call centers. There is a need for an inexpensive, single upfront cost device which simply calls your friends/neighbors to help you in times of non-critical emergencies. This project aims to build such a system, composed of a series of button wearables and base stations, to be deployed and tested within the De Anza Santa Cruz retirement community.
\end{abstract}
% Note that keywords are not normally used for peerreview papers.
\begin{IEEEkeywords}
assistance, bluetooth, button, elderly, emergency, seniors, Xbee,
\end{IEEEkeywords}
% For peer review papers, you can put extra information on the cover
% page as needed:
% \ifCLASSOPTIONpeerreview
% \begin{center} \bfseries EDICS Category: 3-BBND \end{center}
% \fi
%
% For peerreview papers, this IEEEtran command inserts a page break and
% creates the second title. It will be ignored for other modes.
\IEEEpeerreviewmaketitle
\section{Introduction}
\IEEEPARstart{T}{he} Help Alert --- Home Assistance system is composed of a base station and a wirelessly connected alert button. The base station is wirelessly connected to other base stations to facilitate long-range communications over a mesh network, in order to forgo the requirement of having a preexisting communications infrastructure.
\subsection{Motivation}
One of the primary principles driving this project is cost. It needs be affordable and without subscription fees. As a result, hardware has been chosen primarily to comply with this cost constraint, which in turn required a extensive research into different available hardware platforms.
\subsection{Objectives}
The fundamental idea behind the Home Assistance Help Alert (HA-HA) System is to provide an affordable means of protecting the health, welfare, and safety of elderly people through an active ad-hoc wireless network estimated to have a working range of 300 meters, specifically for residents of the De Anza Santa Cruz Senior Citizen Community. The final design should consider environmental conditions of the location (interference, transmission range) and consist of parts which can be obtained or reproduced by a third party at scale. The final design must be affordable and enjoyable for the end user to wear. A detailed design document will be made publicly available for non-profit entities who would like to expand upon the project. The source code and all schematics with PCB layout files will be published open-source on github.com
\section{Hardware Selection}
\subsection{Base Station}
% combine base station and button here into super-section, 'Hardware Selection'
%\subsubsection{Microcontroller}
% There isn't any content for this section?
\begin{table*}[H]
\centering
\begin{tabular}{>{\bfseries}l|l l l l}
Device & TI CC430 & Kinetis KW30Z & TI CC2510/11DK & Atmel SAMB11 \\
\hline
Datasheet & Link & Link & Link & Link \\
DevBoard Price & \$149 for 2 & \$145 for 2 & \$220 for 2 & \\
Chip Price (x50) & \$6.64 & \$4.72 & \$4.16 & \$3.51 \\
915 MHz Antenna & 2 (no Zigbee) & No & No & No, but integrates with \\
2.4 GHz Antenna & No & Yes (Bluetooth, Zigbee) & Yes CC2500 & Yes \\
Flash & 32 kB & 128-512 kB & 8/16/32 kB & 256 kB \\
RAM & 4 kB & 64 kB & 1/2/4 kB & 128 kB \\
Supply & 2.0-3.6 V & 3.6 V & 2.0-3.6 V & 2.3-3.6 V
\end{tabular}
\caption{Base Station Microcontroller Costs and Specifications}
\end{table*}
\subsubsection{Base Station Interconnect}
Wireless interconnection is a critical component governing the performance of the system. A communication link between the button and the base station allows for a help alert signal to be transmitted locally within a small home environment, while the link between multiple base stations allows the signal to propagate further throughout a larger neighborhood.
\begin{LaTeXdescription}
\item[315 US/433 EU MHz] Garage door opener/FOB, may be subject to FCC violations, very low bandwidth
\item[915 US/868 EU MHz] ZigBee, unlicensed, free (mostly)
\item[2.4 GHz] Wi-Fi, Bluetooth, Zigbee, unlicensed, free (mainly), limited range
\end{LaTeXdescription}
Selection in broadcast frequency considers the limitations of transmitted power as well as form factors of potential antennas. FCC regulations described in Title 47 Part 15 dictate the limitations of low-power, non-licensed, signal transmissions in the United States air space. While most frequency bands are very limited for public use, there are several bands which are set aside as free for anyone to use under specific constraints; in comparison, broadcasts in “free” frequencies are allowed much greater transmission power to their restricted counterparts. Additionally, electromagnetic waves are governed by an inverse relation between its frequency and length; a wave of increasing frequency has a decreasing wavelength and vice-versa. As a rule of thumb, an antenna’s size grows as the wavelength is increased for a given signal of interest. Higher frequency signals also tend to have channels with larger bandwidths, allowing for more data to be sent with each transmission. Due to the simple nature of the application, the high data rate is not critical.
Communication between the button and base station is projected to be at least 50 feet, while distances between base stations should be able to reach at least 300 meters (approximately 1000 feet). To meet these specifications while keeping within FCC regulations, the “free” frequency bands will be used. Two of the most popular frequency bands include the 915 MHz band and the 2.4 GHz band.
\textbf {Radio Frequencies:}
\begin{LaTeXdescription}
\item [2.4 GHz] will be used for the button-to-base communication. This band is hugely populated by many mainstream applications such as WiFi and Bluetooth, but the small distance between the button and base will hopefully not be heavily affected by other traffic. Additionally, antennas in the 2.4 GHz range can be made compact, which is an essential attribute for a miniscule, wearable button.
\item[915 MHz] will be used for base-to-base communications. Antennas in this band can be slightly larger than the corresponding 2.4 GHz antennas and since the base stations are designed to be stationary in a user’s home, antenna size is no longer a limiting factor. Furthermore, air space in the 915 MHz band is not as congested as it is in the 2.4 GHz band so the reduction in potential interference allows for longer transmissions.
\end{LaTeXdescription}
\textbf {Base-to-Base Protocols:}
\begin{LaTeXdescription}
\item [DigiMesh] DigiMesh is a proprietary protocol which implements a variant of the AODV routing algorithm. Includes network self-configuration, self-healing, and sleep synchronization.
\item [802.15.4 (Custom Protocol)] The team is writing its own mesh protocol on top of the 802.15.4 standard, which on its own only provides point to point connections (possibly with reliability, depending on implementation). This choice would be difficult and take significant amounts of time to accomplish in the time that the group has.
\item [ZigBee] A ZigBee device will come with a full stack implementation of a mesh networking protocol which will allow the team to concentrate on the implementation of the actual device. It will also allow the team to have the time to extensively test the platform to see the limits of the protocol.
\item [Bluetooth Low Energy] Bluetooth Low Energy (BLE) is a point-to-point wireless communication technology. Its power efficiency allows the user to implement a variety of services, making feedback possible such as when the button’s battery is low or detecting if the button is located near the base station. These services allow the button to be smart and flexible when communicating.
\end{LaTeXdescription}
\textbf {DigiMesh features the following:}
\begin{LaTeXdescription}
\item[Self-healing] any node may enter or leave the network at any time without causing the network as a whole to fail.
\item[Peer-to-peer architecture] no hierarchy and no parent-child relationships are needed.
\item[Quiet Protocol] routing overhead will be reduced by using a reactive protocol similar to AODV.
\item[Route Discovery] rather than maintaining a network map, routes will be discovered and created only when needed.
\item[Selective acknowledgments] only the destination node will reply to route requests.
\item[Reliable delivery] reliable delivery of data is accomplished by means of acknowledgements.
\item[Sleep Modes] low power sleep modes with synchronized wake up are supported, with variable sleep and wake up times.
\end{LaTeXdescription}
The DigiMesh protocol is a proprietary protocol and uses a variant of the AODV routing algorithm. Routing tables are built only for the immediate destinations required by a node. Like wirelessHART, all nodes can be routers and have the option to sleep and wake on a synchronized schedule[6].
Routers for the network are determined as needed which results in routing table entries only for those routes in use. Unlike the other protocols there is no central coordinator and synchronization is accomplished through an election process. Routing to nodes not directly connected to the sending node is accomplished by sending to destination specified in the routing table, which if does not exist the route is discovered through AODV and stored.
If a packet on its way to a destination encounters a node that was present in the routing table but no longer is failing at the time of sending, an AODV discovery is initiated and if the correct route if found through an alternate path the routing tables of all affected nodes will be updated and the packet will be delivered[6]. All packets are acknowledged with messages sent to the receiver.
Because every node has the ability to be a sleeping node power can be saved in between routed packets[6]. AODV discoveries are only initiated when needed and so additional network traffic is not present. This feature also presents a limitation causing high latency when changing network conditions cause routes to be invalidated and rediscovered. It also affects network throughput by limiting the amount of packets that can be sent when routes are not known.
Digi International, the company behind DigiMesh claims that networks with around 500 nodes are possible and within the limitations of the standard. Due to the system's limited network traffic needs this limit should not be a concern. Any latency introduced by route discoveries on large networks would not be a concern because the time constraint for the product’s users is measured in minutes, and the network delay introduced being measured in hundreds of milliseconds.
The power consumption of the Digi modules can be reduced by configuring the routing nodes to be sleeping. This setting is configurable and each device will be synchronized to a automatically elected time coordinating node. With the system's network measuring user response time in minutes, a sleeping schedule of 1/20 or 1/30 seconds would not likely cause problems. Sleeping for these time scales would increase runtime by a nonlinear inverse of the fraction. This group estimates a 1/20 seconds schedule would decrease power by 57\%.
The DigiMesh protocol, while proprietary, meets all the team's requirements for client-device communication. With claimed scalability to 500+ nodes it will provide the scalability the group intends to support. The 900 MHz frequency range is expected to provide the needed coverage range and allow for a network of connected routing-capable and self-healing end nodes to provide maximum coverage by allowing distant end nodes to connect while within range of at least a single node.
\subsection{Button}
\subsubsection{Summary of User-End Functional Considerations}
The main user-end functional requirements of the HA-HA Button System are to allow a user to press a worn button which in turn transmits a distress signal to a paired base station, and then relays this signal to members of a prioritized list who will immediately respond to the distress call. This can be more succinctly broken down into configuring the base station, responding to alerts, wearing the button, and using the button. Designing such a device must consider cost, power efficiency, user interface, and reliability.
\begin{LaTeXdescription}
\item[Configuring the Base Station] User interaction with the base station must be simple and intuitive, so each base station needs to contain some form of display and keypad. Setup for a user's priority list requires alphanumeric character entry from at minimum four simple buttons that interact with an integrated LCD display. These peripheral devices also require a microcontroller with enough available I/O pins and processing power to establish a functional hardware interface. While the display must be large and clear enough to be read by elderly users, larger displays are expensive and therefore a balance between cost and clarity of display must be found. While the base station can be powered by a standard electrical outlet, it must also be able to function on some minimum level for 24 hours during emergencies.
\item[Responding to Alerts] The base station must contain an integrated alert system that is robust enough to reach both hearing and visually impaired users. Thus, when a distress signal is received by a base station, a bright light will strobe while accompanied by a loud alarm sound from a speaker. These peripheral components require large amounts of power relative to the other components of the base station, and they necessitate the design of a specially-taylored power system to lie within the base station unit. After a distress message is received, the responding user must first confirm his/her response before leaving to provide aid. To do this, the location of the user who initiated the distress call must be displayed on the LCD unit with a single button press constituting a confirmed response.
\item[Wearing the Button] A user must be able to wear the button unobtrusively and comfortably, so the button must be designed to be as physically small and weigh as little as possible. However, wearer must also be able to continuously wear the button for as long as possible. These largely constrain the choice of battery and antenna for the button, so for the battery a compromise between large capacity, small size, and ease of replacement must be found. Since a smaller battery translates to shorter battery capacity and system life, special considerations must be made to maximize battery life\footnote{See section 3 for more in depth power analyses}. The small size of the button also increases interference between different high-frequency and high-speed components through a noisier common ground plane.
\item[Pressing/Responding to the Button] A user must be able to send his/her distress signal only when the button is deliberately pressed and the button should have functionality to cancel this distress call with ease. Most importantly, a distress signal must be transmit and received with great accuracy and high security. The button must also provide a user with feedback regarding the wearer's successful button presses and when another user answers the wearer's distress call. Both types of feedback can take the form of a simple flashing, low-energy LED, but the confirmation of the reception of a wearer's distress signal must be triggered by some logical device. Therefore, the HA-HA Button must be able to process basic logic and output appropriate feedback flashes as well as reliably delivering data to/from its paired base station. These constraints together necessitate the button possess a microcontroller and an integrated Bluetooth LE module, as mentioned previously in Section 2.1.1.
\end{LaTeXdescription}
\subsubsection{Microcontroller Evaluation}
Design of both the button and the base station was heavily influenced by choice of microcontroller. Research into required functionalities yielded three major candidate low-cost, low-power microcontrollers:
the \textbf{ST BlueNRG-1},
the \textbf{NXP Kinetis KW30Z}, and
the \textbf{Atmel SAMB11}.
Each of these microcontrollers was weighed based on development board price, price per 10 units, ease of integration with Bluetooth LE, flash and RAM sizes, voltage ranges of operation, and average power consumption in mWh. Other factors that affected decisions of microcontrollers include ease-of-use, availability of documentation, and number of I/O pins. A summary of these data can be viewed in Table \ref{mcuchoice}.
The microcontroller used for the base station needed to be Bluetooth LE compatible as well as have sufficient data memory and processign abilities. Of these three examined microcontrollers, the Atmel SAMB11 and the Kinetis KW30Z stick out as capable for these criteria. While the Kinetis comes with an integrated PCB antenna, its documentation leaves much to be wanted. The Atmel SAMB11, however, is both better documented and better supported. The SAMB11 is also less expensive than its competition, as well as providing access to an active development community. Therefore, the Atmel SAMB11 was a natural choice for the microcontroller on the base.
Since the button is tightly constrained by maximized battery life-span, the BlueNRG-1 presented itself as a clear choice for the button. The SAMB11 was also an appealing option for use in the button, as it is still very low-power and sticking with a single microcontroller may have allowed for an expedited development process. However, the difference in average powers drawn by the two devices is significant enough to expand the life of the button by days (nearly one week). Ultimately, the BlueNRG-1 was chosen as the microcontroller for the button.
\begin{table*}[t]
\centering
\begin{tabular}{>{\bfseries}l|l l l}
Device & ST BlueNRG-1 & NXP Kinetis KW30Z & Atmel SAMB11 \\
\hline
DevBoard Price & \$111.25 & \$72.50 & \$49.22 \\
Chip Price (per 10) & \$3.67 & \$5.40 & \$3.51 \\
2.4 GHz Antenna & No & Yes (Bluetooth, Zigbee) & No \\
Flash & 160 kB & 128-512 kB & 256 kB \\
RAM & 24 kB & 64 kB & 128 kB \\
Supply Voltage Range & [ 1.7, 3.6 ] V & [ 0.9, 4.2 ] V & [ 2.3, 4.3 ] V \\
Power Consumption (avg) & 0.3592 mWh & 0.5779 mWh & 0.4579 mWh
\end{tabular}
\caption{Microcontroller Costs and Specifications}\label{mcuchoice}
\end{table*}
\section{General Specifications}
\subsection{Evaluation of Available Components}
\subsubsection{Button Microcontroller}
\textbf {Hardware:} STMicroelectronics BlueNRG-1
\begin{itemize}
\item Core and Memory
\begin{itemize}
\item 16 or 32 MHz ARM Cortex-M0
\item 160 KB Flash
\item 24 KB RAM with retention (two 12 KB
\item banks)
\end{itemize}
\item Bluetooth Low Energy Radio Features
\begin{itemize}
\item Bluetooth specification compliant master,
\item slave and multiple roles simultaneously,
\item single-mode Bluetooth low energy system-on-chip
\item Battery voltage monitor and temperature sensor
\end{itemize}
\item Power
\begin{itemize}
\item Operating supply voltage: from 1.7 to 3.6 V
\item Integrated linear regulator and DC-DC stepdown converter
\item Operating temperature range: -40 °C to 105°C
\item Down to 1µuA current consumption with active BLE stack (sleep mode)
\end{itemize}
\item Interfaces
\begin{itemize}
\item 1 x UART interface
\item 1 x SPI; 2 x I2C interface
\item 14 or 15 GPIO
\item 2 x multifunction timer
\item 10-bit ADC
\item Watchdog and RTC
\item DMA controller
\item PDM stream processor
\end{itemize}
\item Operational Modes
\begin{itemize}
\item Preactive state
\item Active state
\item Standby state
\item Sleep state
\end{itemize}
\end{itemize}
\subsubsection{Base Station Microcontroller}
\textbf {Hardware:} Atmel SAMB11
\begin{itemize}
\item Core and Memory
\begin{itemize}
\item 26 MHz ARM® Cortex®-M0+ core
\item 256 KB Stacked Flash memory
\item 128 KB Embedded ROM
128 KB Embedded RAM
\end{itemize}
\item Low Power Consumption and Operating Voltage Ranges
\begin{itemize}
\item Nine low-power modes to provide power optimization based on application requirements
\item Typical Rx/Tx Current (DC/DC Enabled): 6.8/6.1 mA
\item $1.1\mu A$ sleep current (8K RAM retention and RTC running)
\item 3.0mA peak TX current (0dBm, 3.6V)
\item 4.2mA peak RX current (3.6V, -93dBm sensitivity)
\item Bypass Voltage: 1.71V to 3.6V
\item DCDC Converter Buck Configuration: 2.1V to 4.2V
\item DCDC Converter Boost Configuration: 0.9V to 1.795V
\item Analog modules
\item 11-bit 4 Channel Analog-to-Digital (ADC)
\item 6-bit High Speed Analog Comparator (CMP)
\end{itemize}
\item Bluetooth Low Energy Radio Features
\begin{itemize}
\item 2.4 GHz Bluetooth Low Energy version 4.2 Compliant
\item Typical Receiver Sensitivity (BLE) = -95 dBm
\item Programmable Transmitter Output Power up to +3.5 dBm
\end{itemize}
\end{itemize}
\subsubsection{Base Station Interconnect}
\textbf {Hardware:} Digi ZigBee-PRO 900HP RF Module
\begin{itemize}
\item Transceiver Info
\begin{itemize}
\item North American ISM band from 902 to 928 MHz
\item 3.3 V UART communication
\item DigiMesh Mesh Network protocol with self-healing, auto-configuration of nodes, and synchronized sleep.
\end{itemize}
\item Spectrum and Data Rates
\begin{itemize}
\item RF Data Rate 10 Kbps or 200 Kbps
\item Indoor/Urban Range 10 Kbps: up to 2000 ft (610 m); 200 Kbps: up to 1000 ft (305 m)
\item Outdoor/ Line-Of-Sight Range 10 Kbps: up to 9 miles (14 km); 200 Kbps: up to 4 miles (6.5 km) ( w/ 2.1 dB dipole antennas)
\item Transmit Power up to 24 dBm (250 mW) software selectable
\item Receiver Sensitivity -101 dBm @ 200 Kbps, -110 dBm @ 10 Kbps
\end{itemize}
\item Current Consumption
\begin{itemize}
\item SLEEP = 2.5 µA
\item IDLE/RX\_ON = 29 mA typical at 3.3 V (35 mA max)
\item BUSY\_TX = 215 mA typical for +24 dBm, 250 mW (290 mA max)
\end{itemize}
\end{itemize}
\subsubsection{Display}
Crystalfontz CFAH1604A-TMI-JT Character LCD Module
16x4 Parallel Character LCD with backlight
\subsubsection{Power Budget}
\textbf{Base Station}
\begin{table*}[t]
\centering
\begin{tabular}{>{\bfseries}l|l l l l l}
Device & $V_{CC} (V)$ & $I_{CC}$ (mA) & $P$ (mW) & Duty Cycle & Energy (mWh) \\
\hline
Atmel SAMB11 uC only & 3.3 & 0.85 & 2.805 & 0.6 & 1.683 \\
Atmel SAMB11 RX & 3.3 & 4.5 & 14.85 & 0.2 & 2.97 \\
Atmel SAMB11 TX & 3.3 & 3 & 9.9 & 0.2 & 1.98 \\
Atmel SAMB11 Standby & 3.3 & 0.00125 & 0.004125 & 0 & 0 \\
XBee-Pro 900HP 900MHz Antenna RX & 3.3 & 29 & 95.7 & 0.1 & 9.57 \\
XBee-Pro 900HP 900MHz Antenna TX & 3.3 & 120 & 396 & 0.1 & 39.6 \\
XBee-Pro 900HP 900MHz Antenna Standby & 3.3 & 0.0025 & 0.00825 & 0.8 & 0.0066 \\
TI LM8330 Keypad & 3.3 & 0.03 & 0.054 & 0.05 & 0.0027 \\
Crystalfontz CFAH1604A-YYH-JT LCD Controller & 3.3 & 1.2 & 3.96 & 0.05 & 0.198 \\
Crystalfontz CFAH1604A-YYH-JT LCD Backlight & 5 & 220 & 1100 & 0.05 & 46.2 \\
Audio Speaker & 12 & 16 & 192 & 0.01 & 1.92 \\
\hline
Max & & 394.58375 & & & \\
Total & & & 1815.281375 & & 112.9303
\end{tabular}
\caption{Base Station Power Budget}
\end{table*}
The power budget for the base station is derived from a typical use case. Each component is detailed with its individual power consumption, and in combination with the estimated time spent on relative to an hour’s time, the total energy consumed by the system per hour can be estimated. Alarm hardware uses the most power of the components of the base station. However, since this system is designed as a safety product that may go off no more than once every month, the audio speaker should contribute minimally to power usage. The LCD display will most likely be used more often then other peripheral components, as it will display more useful information, such as status updates and neighbor information. Beyond the initial setup, the LCD should also not be in use for most of the time.
Given the on-time percentage depicted in the table, the system uses about 112.93 mWh of energy in one hour. Assuming a 700 mAh rechargeable NiMH backup battery, the base station can last about 23 hours without wall power. Because the percentages used are generously estimated and software functionality has not yet been optimized for maximum power savings, an even better battery life could be achieved in future revisions.
\textbf{Button}
\begin{table*}[t]
\centering
\begin{tabular}{>{\bfseries}l|l l l l l}
Device & $V_{CC} (V)$ & $I_{CC}$ (mA) & $P$ (mW) & Duty Cycle & Energy (mWh) \\
\hline
2.4GHz BTLE Tx & 3 & 15.1 & 45.3 & 0.00028 & 0.1258 \\
2.4GHz BTLE Rx & 3 & 7.7 & 23.1 & 0.00028 & 0.0647 \\
GPIO Driving LEDs [x2] & 3 & 0.67 & 0.02 & 0.00056 & 0.0111\\
CPU, Flash, and RAM & 3 & 1.9 & 5.7 & 0.00056 & 0.00319 \\
24KB RAM retention & 3 & 0.0005 & 0.0015 & 0.994 & 0.00149 \\
GPIO Leakage [x1] & 3 & 0.004 & 0.012 & 0.9944 & 0.012 \\
\hline
Max & & 21.4 & & & \\
Total & & & & & 0.359
\end{tabular}
\caption{Button Power Budget}\label{buttpwr}
\end{table*}
The button power budget (shown in Table~\ref{buttpwr})~was calculated using theoretically agreed-upon estimates of a typical user case. These values were agreed upon by the HA-HA Button team.
The final average energy expended by the button is roughly \textbf{0.359 mWh}. The functional units drawing the most energy are the BlueNRG-1's Bluetooth LE transmitter and quiescent current drawn by I/O while in its low-energy 'Sleep' mode. This energy figure is quite small, but how long would the capacity of a standard coin cell battery last? The maximum capacity of a standard CR2032 20mm coin cell is 240mAh, rated at 3V, which translates to 720mWh of energy capacity per battery. By dividing this energy by the average energy required by the button, it can be found that the proposed button will operate for roughly 2005 hours, or about \textbf{85.5 days}~of usage. While this amount of time is considerably less than the team's initial goal of multiple years of sustained operation, it is clear that in order to achieve this goal, some button functionality must be forfeited. There is also potential for power consumption optimization by decreasing transmit/reception power\footnote{Power budget calculated using maximum TX/RX powers.}, but at this time the contribution of I/O pin leakage appears to already be optimized.
\subsubsection{Trade Studies}
Trade studies were conducted as a tool for the decision-making process for both the button and base station microcontrollers. Our research was assimilated, evaluation criteria developed, and the different options were then graded. The evaluation criteria for the button microcontroller were cost, power, transmission range, integrability, and schedule. The evaluation criteria for the base station microcontroller were cost, memory, functionality, integrability, and schedule. Each criterion was assigned a weighted percentage according to its significance to the project using a grading scale of five, with the lowest score representing the optimum choice.
\begin{figure}[ht] % Several different modifiers can be used
\centering
\includegraphics[width=0.4\textwidth]{ButtonTS.png}
\caption{ \space Button Trade Study Results}
\label{HaHa Button TS}
\end{figure}
\begin{figure}[ht] % Several different modifiers can be used
\centering
\includegraphics[width=0.4\textwidth]{BaseTS.png}
\caption{ \space Base Station Trade Study Results}
\label{HaHa Base TS}
\end{figure}
\section{System Overview}
\subsection{Product Perspective}
The base station and button will be separate hardware devices which facilitate the communication of a “help request” when a user presses the button on either the base station or the remote button. The base station will contain a priority list of contacts who will be contacted in an order set by the user. Alerted users will respond to the help request through use of their own base station. If a user does not respond to a help request, the next person on the list is contacted. If none of the people on the help list respond, any station in the nearby vicinity is contacted.
\subsubsection{Design Method}
The software design portion of the product will utilize the C-programming language.
\subsubsection{User Interfaces}
The base station is equipped with an LCD display, which will facilitate user interaction with the device, in addition to showing critical information during emergency situations. Configuration of the device shall be done using a series of menus displayed on the LCD display. The exception to this are several dedicated switches/buttons that control the contrast of the display, reset device power, and trigger the help request functionality. The rest of the device functionality shall be accessed through the menu system, and facilitating this is a set of four directional buttons, as shown in Figure \ref{dev buttons}. These buttons shall have the following functionality:
\begin{LaTeXdescription}
\item[Up] Scroll up in the list of choices
\item[Down] Scroll down in the list of choices
\item[Left] Move back/cancel, exiting a submenu
\item[Right] Select, selecting the current item (that which is listed at the top of the screeu) or open the corresponding submenu
\end{LaTeXdescription}
\begin{figure}
\centering
\includegraphics[width=0.48\textwidth]{dev_buttons.jpg}
\caption{Directional Buttons on the Development Board}
\label{dev buttons}
\end{figure}
The base station also allows an external device (such as a lamp) to be plugged directly into it. This device will be toggled on and off during emergency situations.
The button is equipped with a single button to trigger the emergency response system. Different inputs (such as a single press, three successive presses, and a hold) serve different functionality. It also has LED indicators for periodic synchronization pulses, confirmations that the help request has been received, and to confirm another user has answered the distress call.
\subsubsection{Hardware Interfaces}
The hardware of the base station and the remote button will be designed and developed by the team.
\subsubsection{Operations}
The user of the base station will be required to setup a priority contact list. The system will have the option of scanning for all available network nodes which will display the name of nearby users and their node number. Configuring of a user to contact can also be done via a pre-shared ID number which each base station user can obtain through the user interface.
When a help request is sent, the initiating user will be able to cancel the request by long-pressing the help button either on the base station or remote button.
\subsection{Product Functions}
\begin{LaTeXdescription}
\item[Send Help Request] This function will send a help request beginning with the first base station in the user’s contact list. Functionality for this will be present on both the remote button and the base station.
\item[Cancel Help Request] This function cancels a help request alert. In the event a user has already responded to a help request, an additional signal will be sent to the box of the responder to inform them of the canceled request.
\item[Setup Contact List] This set of functions will facilitate configuring the user’s contact list. Users can either enter ID numbers of the neighbors they wish to add or they can scan the network for them.
\item[Scan Network] This function scans the network for available users and provides user contact details. It will interface directly with the Setup Contact List.
\end{LaTeXdescription}
\subsubsection{Software}
\subsubsection{Application Networking Protocols}
This section is an overview of the networking protocols which must be determined. Specific information such as packet design will be fleshed out in the next section, System Architecture.
\begin{itemize}
\item Button to Box
\begin{itemize}
\item Base station reads button battery level using Bluetooth API. (performed frequently)
\item Button activates “Help Alert” state on the base station. (button pressed for 3 sec)
\item Button activates “Immediate Help Alert” state on the base station. (button pressed for 6 sec)
\end{itemize}
\item Base Station to Base Station
\begin{itemize}
\item Discovering neighbors. (broadcast)
\item Sends help request to specific and possibly distant neighbor. (ACK’d)
\item Sends help alert received signal back to requester. (broadcast)
\item Sends help alert resolved signal to all neighbors requested. (broadcast)
\end{itemize}
\end{itemize}
\subsection{System Diagram}
To meet the desired functions of our product, we generated a high-level block diagram that contains all of the parts that are required for the implementation of the system.
\begin{figure}[ht] % Several different modifiers can be used
\centering
\includegraphics[width=0.4\textwidth]{system_diagram.png}
\caption{Block diagram of the system}
\label{Ha-Ha System Diagram}
\end{figure}
\subsection{Network Simulation}
NS3 is a discrete-event network simulator. A discrete-event are those events which occur in a sequence over time. Each event occurs at a particular instant in time and marks a change of state in the system. NS3 facilitates the defining of this system and mechanisms to view and record the state of every mechanism within the system.
Our goal with NS3 is to simulate the network as closely as possible to the DigiMesh protocol using the AODV algorithm as a basis. Packet broadcasts that approximate our own application layer packets will be configured and the number of nodes scaled such that the network performance can be analyzed as the number of nodes or amount of network traffic increases. This will allow us to realize with some level of certainty the level at which our network will be deployable. It also will provide us with a basis for any future troubleshooting of the network that we might encounter a need for.
In its current form, the simulator creates a configurable number of nodes a random x-y-z distance apart and has the two furthest nodes communicate packets. The communications regarding the AODV algorithm are traced and logged to the screen along with the communication packets. As state above, this will be modified in the coming quarter to be more representative of our system.
Below is an example output:
\begin{lstlisting}
Creating 10 nodes 100 m apart.
x=80.7772, y=45.6102, z=0.458782
x=48.6495, y=72.3938, z=0.448497
x=22.2484, y=53.5658, z=0.513956
x=26.1946, y=19.7807, z=0.446207
x=68.3362, y=54.6383, z=0.830643
x=92.0653, y=28.9132, z=0.773134
x=54.4156, y=93.372, z=0.662756
x=14.7075, y=19.3661, z=0.662903
x=46.9031, y=68.3726, z=0.521647
x=53.8059, y=83.5943, z=0.0441295
Starting simulation for 10 s ...
[node 0] Starting at time 36ms
[node 1] Starting at time 32ms
[node 2] Starting at time 73ms
[node 3] Starting at time 53ms
[node 4] Starting at time 95ms
[node 5] Starting at time 95ms
[node 6] Starting at time 99ms
[node 7] Starting at time 22ms
[node 8] Starting at time 11ms
[node 9] Starting at time 27ms
PING 10.0.0.10 56(84) bytes of data.
[node 0] Valid Route not found
[node 0] Send RREQ with id 1 to socket
[node 6] Starting at time 99ms
[node 7] Starting at time 22ms
[node 8] Starting at time 11ms
[node 9] Starting at time 27ms
PING 10.0.0.10 56(84) bytes of data.
[node 0] Valid Route not found
[node 0] Send RREQ with id 1 to socket
on 10.0.0.10
[node 9] AODV node 0x1bf5760 received
a AODV packet from 10.0.0.1 to 10.0.0.10
[node 9] Send reply since I am the
destination
[node 9] Exist route to 10.0.0.1 from
interface 10.0.0.10
[node 9] Updating VALID route
[node 9] Updating VALID route
\end{lstlisting}
\section{System Architecture}
\subsection{Button Software}
The button and base station are paired together to form a master/slave relationship where the button is the slave and the base station the master. The button transmits signals to the base station in the form of packets. After receiving a packet, the base station processes the information accordingly to either forward the message to other base stations or back to the button. The button is usually in sleep mode and only wakes up if a button event occurs. The following cases are envisioned requirements to be fulfilled by the respective hardware component’s libraries.
\begin{LaTeXdescription}
\item[Case 1]: Initial connection established between button and base station.
\begin{itemize}
\item The button device is initially in standby mode waiting to be paired. The button is pressed on the base station to establish the initial connection process. The button on the button device is then pressed and held for a several seconds until a message appears on the base station confirming successful connection. This initial process only occurs once when a single button device is registered to a base station.
\end{itemize}
\item[Case 2]: The button is pressed within range of the base station.
\begin{itemize}
\item The button can either send a help alert signal or cancel a help alert packet.
\item If the button is pressed and held down for 3 seconds, it will transmit a help alert packet to the base station. After acknowledging a help alert packet was received, the base station will transmit the help alert to the contacts listed in the requester’s network list. If the first person on the list does not respond within a certain timeframe, it will timeout and go to the next contact on the list. If no one on the list responds, then the packet is sent to additional neighbors. If none of these additional neighbors respond, the packet is then sent through a certain number of network hops which will be calculated according to the density of base stations existing base stations. If no one still responds, then the packet is sent through the entire network of base stations as a final pass.
\item If the button is pressed 3 times consecutively, then it will transmit a cancellation of the help request packet. After receiving and acknowledging this type of packet was indeed received, it will cancel the help request. There will be a help request cancellation message displayed on the base station.
\end{itemize}
\item[Case 3]: The button is pressed when out of range of the base station.
\begin{itemize}
\item If the button is out of range of the base station, it will disconnect and won’t be able to transmit or receive any packets. Once it is back within range of the base station, it will automatically connect to it and a successful connection message will be displayed on the base station.
\end{itemize}
\item[Case 4]: The button is not pressed but wakes up to send notifications to the base stations within range.
\begin{itemize}
\item The base station continually polls information from the button. The percentage of the button’s battery life is polled by the base station for a given amount of time. Another query occurs every 6 hours to determine if the button is still connected to the base station. If base station does not receive a signal from the button within 12 hours, it will notify the user there is an issue with the button by displaying this information on the base station.
\item When the battery is drained under a certain percentage, it would notify the user the battery is low. A message will be displayed on the base station informing the user to replace the button battery. The LED on the button will also become a solid red color to signal the low battery life and it will eventually begin blinking if the battery life is critically low and in need of immediate replacement.
\end{itemize}
\item[Case 5]: The button is not pressed but wakes up to send notifications to base stations not within range.
\begin{itemize}
\item Same conditions as Case 3.
\end{itemize}
\end{LaTeXdescription}
\subsection{Base Station Software}
\begin{figure}[ht] % There are several different modifiers that can be used in [].
\centering
\includegraphics[width=0.4\textwidth]{hahamap.png}
\caption{ \space Software map.}
\label{HaHa Application}
\end{figure}
\subsubsection{Application Modules}
As can be seen by the UML layout in Fig. \ref{HaHa Application}, our application will be a series of modules meant to interconnect and provide the needed functionality. By creating modules for each portion of software it will be possible for modifications to be easily implemented by replacing the relevant modules. This project is being developed as an open-source project and as such it is our endeavor to allow modifying the system easy and straightforward.
Chief among this modularity is the “network device” layer we are developing to utilize a Digi ZigBee module. This layer and its modules will be responsible for receiving data in the form of a character string from the upper application and converting it as necessary to be sent as an XBee network frame. On the receiving end it will do the reverse operation and provide the upper layer with a character string. In the event that a different transceiver wished to be used, creating and implementing similar functions would allow the majority of the application layer to remain unmodified.
\subsection{Graphical User Interface}
\subsubsection{Display}
The base station was equipped with a Crystalfontz CFAH1604A-TMI-JT 16x4 LCD display. A 4 line display was a requirement for the project, as the device would be used during high stress situations, in which users would want to see all necessary information on one screen without having to interact with the device interface. The Crystalfontz display was the cheapest 4 line display available find on the market, and had the added benefit of being based off of the Hitachi HD44780U, a widely used and well documented component.
Similar to other software components in the project, we abstracted the display drivers into two separate modules, a device specific component and a generic component:
\begin{LaTeXdescription}
\item[lcd\_device] holds device specific code and macros, such as the display size (\lstinline[columns=fixed]{LCD_ROWS=4, LCD_COLS=16}), and facilitates the communication with the physical device, which in this case means writing to specific registers
\item[lcd] abstracts the physical device, by buffering the output to the LCD screen with arrays implemented in software. A single \lstinline[columns=fixed]{lcd_update} function updates the entire LCD screen contents.
\end{LaTeXdescription}
There were some complications with implementing the LCD driver. First is the subtle differences between the Crystalfontz display and the Hitachi specification. After the initial version of the driver was implemented, we noticed that the display would only work correctly if the delay in between commands was set to more than 90 ms. This was unusual, as the datasheet only required a delay of around 40 ms in between commands during the initialization phase, and then 3 ms when writing to the screen. We eventually discovered that this was due to the Crystalfontz controller expecting a specific initialization command to be sent twice, which was only briefly mentioned on their datasheet and was not part of the Hitachi specification at all. This forced us to use the Crystalfontz datasheet for the rest of development, which was overall not as intuitively laid out as the one given by Hitachi.
Another design decision in integrating the LCD display was to use 4 bit mode, as opposed to 8 bit mode. 8 bit mode is standard, in which each character is specified in 8 bits, which is standard ASCII. 4 bit mode sets the controller to read in only 4 bits of data at a time, thus requiring two register writes per character/command to 8 bit mode's 1 write. The justification for doing so was to free up pins on the microcontroller, which had many components to interface to. In addition to the 4 data pins, the LCD display already required 3 pins for control, making it the largest component in terms of pin usage. However, this had some drawbacks, in both development and performance. The Crystalfontz datasheet had minimal examples for operating in 4 bit mode, which meant that each 8 bit command had to be "translated" into 4 bit commands, which was tedious and hindered the progress of debugging. On the performance side, since each command took twice as many writes, when compounded with the mandatory delay between commands, this produced noticeable lag when communicating
Besides the obvious benefit of being able to swap out the device specific code as necessary, there was a very specific reason the \lstinline[columns=fixed]{lcd} module needed to buffer the LCD output, having to do with the way the LCD controller operated specifically for a 16x4 display. In a standard 16x2 display, the controller would read in 16 characters corresponding to the top line of the display. It would then expect a command to change the write address to the second row, and take in an additional 16 characters. However, for a 16x4 display, the same controller was adapted to work in a similar way. In order to accomplish this, the third and fourth rows are simply extensions of the first and second rows, resulting in the following unusual behavior: writing 16 characters for the first row, then 16 characters for the third row, followed by the address command and following 16 characters for the second then fourth rows respectively. What this means in practice is that the LCD display cannot support writing characters in order, which makes buffering necessary in order to implement functions such as \lstinline[columns=fixed]{lcd_set_line()}.
\subsubsection{User Interface}
The user interface of the base station is composed of a tree of menu items, a data structure defined in the \lstinline[columns=fixed]{menu} software module (included in Appendix \ref{MenuItem Code}). Each menu item has reference to it's parent, it's next and previous sibling, and it's first child, all of which are also menu items. These four references relate to the four cardinal directions given in the user interface:
\begin{LaTeXdescription}
\item[Up] Scrolls up in the current list of menus, setting the cursor as the previous sibling of the current item (or if current is the first sibling, to it's last sibling), and then calling it's \lstinline[columns=fixed]{onView()} method.
\item[Down] Scrolls down in the current list of menus, setting the cursor as the next sibling of the current item (or if current is the last sibling, to it's first sibling), and then calling it's \lstinline[columns=fixed]{onView()} method.
\item[Left] Moves back (up) in the menu tree, setting the current item as the parent and then calling it's \lstinline[columns=fixed]{onView()} method.
\item[Right] Selects the current item, calling it's \lstinline[columns=fixed]{onClick()} method. By default, this sets the cursor to the child of the current item, if it exists.
\end{LaTeXdescription}
Referenced above, each menu item also has two function callbacks assigned to it, which are referred to as the \lstinline[columns=fixed]{onView()} and \lstinline[columns=fixed]{onClick()} methods. These functions are called throughout the menu navigation process, and are what allow the menu to dynamically alter both itself and the other software modules of the base station.
The \lstinline[columns=fixed]{onView()} method is called whenever a menu is viewed. By default, this takes form of printing the current menu item's string \lstinline[columns=fixed]{value} on the top line of the LCD screen, with it's next siblings shown on the following lines, as seen in Figure \ref{menu view default}. This gives the user context as to what they are currently selecting, and what is available to be selected should the user choose to move up/down. However, there are some cases where this is not ideal, such as in the User Info submenu. Because some fields of user information typically span more than one line (the address field specifically is a good example of this), each child of the User Info menu item has a custom \lstinline[columns=fixed]{onView()} callback, which takes up the entire screen. Pressing up and down for this submenu still navigates between items, but overwrites the entire screen, like shown in Figure \ref{menu view user info}. In addition, the second line of the LCD screen is populated with user info taken from a datastructure defined in another software module. Another custom \lstinline[columns=fixed]{onView()} method is used in the text input feature, which will be discussed in greater detail later.
\begin{figure}
\begin{subfigure}{0.48\textwidth}
\centering
\LCD{4}{16} |Friends List >|
|User Info |
|Device Settings |
| |
\caption{Default View}
\label{menu view default}
\end{subfigure}
\begin{subfigure}{0.48\textwidth}
\centering
\LCD{4}{16} |USER ADDRESS: |
|1157 High St. Sa|
|nta Cruz, CA |
|vMore Edit>|
\caption{User Info Custom View}
\label{menu view user info}
\end{subfigure}
\caption{\lstinline[columns=fixed]{onView()} methods}
\end{figure}
As mentioned in the table, by default, the \lstinline[columns=fixed]{onClick()} method of a menu item should navigate to it's corresponding submenu (it's first child). However, there are some situations where it is necessary to do more. For example, every time the Friends List menu item is clicked, it's children are regenerated based on the current state of the software friend list. The end result is the same (the cursor being set as the first friend in the list, which is the first child of the Friends List menu item), but because other actions are going on in the background to produce these children, the \lstinline[columns=fixed]{onClick()} method had to be overwritten. Another good example is again the User Info items mentioned previously. Selecting them starts the text input feature, which creates a large subtree below the current item.
The Help Request and Friend Request features use a combination of the \lstinline[columns=fixed]{onView()} and \lstinline[columns=fixed]{onClick()} methods to provide a cohesive message. When a request is received over the network, the cursor is forcibly set to the menu item Help Response, with the view method producing a screen like that shown on Figure \ref{menu view help}. This method, similar to the User Info menu item, takes in a name (this time from a network packet) and displays it on the screen. The resultant menu tree after this process is completed looks like this:
\begin{itemize}
\item Help Response Root
\begin{LaTeXdescription}
\item[child] Help Response Deny
\begin{LaTeXdescription}
\item[onClick] NULL
\item[onView] Send "Cannot help you" packet, set current to root
\item[child] Help Response
\begin{LaTeXdescription}
\item[onClick] Send "Help is on the way" packet, set current to root
\item[onView] Show information on the person who needs help (see Figure \ref{menu view help})
\end{LaTeXdescription}
\end{LaTeXdescription}
\end{LaTeXdescription}
\end{itemize}
\begin{figure}
\begin{subfigure}{0.48\textwidth}
\centering
\LCD{4}{16} |! HELP REQUEST !|
|Donald Wiberg |
| |
|<BACK RESPOND>|
\caption{Help Request Text}
\end{subfigure}