-
Notifications
You must be signed in to change notification settings - Fork 3
/
make-a-pi-hub.html
641 lines (636 loc) · 44.3 KB
/
make-a-pi-hub.html
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
<!DOCTYPE HTML>
<html>
<head>
<title>diyActive: Make a Raspberry Pi Hub</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Step-by-step guide to build a Raspberry Pi 3 (or equivalent) Bluetooth sniffer from scratch, with real-time kiosk-mode display.">
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="style/main.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.4/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/2.5.0/ui-bootstrap-tpls.min.js"></script>
<script type="text/javascript" src="js/diyactive.js"></script>
</head>
<body ng-app="diyActive">
<div ng-controller="InteractionCtrl">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle"
ng-init="navCollapsed = true"
ng-click="navCollapsed = !navCollapsed">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://www.reelyactive.com">
<strong>reely</strong>Active
</a>
</div>
<div class="collapse navbar-collapse" ng-class="!navCollapsed && 'in'"
ng-click="navCollapsed = true">
<ul class="nav navbar-nav navbar-right">
<li class="active"><a href="/"> diyActive </a></li>
<li class="dropdown" uib-dropdown on-toggle="toggled(open)">
<a href class="dropdown-toggle" uib-dropdown-toggle role="button"
data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
Quick links <span class="caret"></span>
</a>
<ul class="dropdown-menu" uib-dropdown-menu role="menu">
<li role="menuitem">
<a href="https://github.com/reelyactive/" target="_blank">
reelyActive on GitHub
</a>
</li>
<li role="menuitem">
<a href="https://www.npmjs.com/~reelyactive" target="_blank">
reelyActive on npmjs
</a>
</li>
<li role="separator" class="divider"></li>
<li role="menuitem">
<a href="https://www.reelyactive.com" target="_blank">
reelyActive website
</a>
</li>
<li role="menuitem">
<a href="https://getpareto.com" target="_blank">
Pareto by reelyActive
</a>
</li>
<li role="separator" class="divider"></li>
<li role="menuitem">
<a href="https://shop.reelyactive.com" target="_blank">
Our online store
</a>
</li>
<li role="menuitem">
<a href="https://reelyactive.com/blog/" target="_blank">
Our blog
</a>
</li>
</ul>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-xs-0 col-sm-1 col-md-2 col-lg-3"></div>
<div class="col-xs-12 col-sm-10 col-md-8 col-lg-6">
<h1> Make a Raspberry Pi hub </h1>
<p> The Raspberry Pi 3 is the first in its family to natively support Bluetooth. Since at <a href="http://www.reelyactive.com" target="_blank">reelyActive</a> we're passionate about <a href="http://www.reelyactive.com/advertise/" target="_blank">the endless possibilities of detecting "advertising" Bluetooth Low Energy (BLE) devices</a>, we were excited to make the Pi 3 into a sniffer using <a href="https://github.com/reelyactive/pi-suite" target="_blank">our open source code</a>. In this tutorial we'll take you step-by-step through building a reliable, standalone BLE sniffer from a virgin Pi 3 <i>(or a Pi Zero W)</i>. </p>
<div class="well">
<div class="row">
<div class="col-xs-12 col-sm-4">
<a href="http://hackaday.com/2016/08/01/sniffing-bluetooth-devices-with-a-raspberry-pi/">
<img src="images/hackaday-pi-ble.jpg"
class="img-responsive center-block">
</a>
</div>
<div class="col-xs-12 col-sm-8">
<h2> As presented on Hackaday </h2>
<p> At the Eleventh HOPE conference, we showed off a standalone <b>Raspberry Pi 3 Bluetooth Low Energy (BLE) sniffer</b> to the Hackaday crew, which they found cool enough to share with their readers. </p>
<p> You'll find instructions below to replicate the setup and more, making use of the integrated BLE radio. Just add power and network and you have yourself a versatile sub-$100 tool/toy! </p>
<a class="btn btn-primary" href="http://hackaday.com/2016/08/01/sniffing-bluetooth-devices-with-a-raspberry-pi/"
role="button"> Read the Hackaday Post </a>
</div>
</div>
</div>
<div class="well">
<h2> There's an <em>updated</em> version of this tutorial! </h2>
<p> With the rollout of <b>Pareto Anywhere</b> (our version 1.x software), we've created the following two new tutorials for preparing a Pi and then installing our open source suite: </p>
<ul class="media-list">
<li class="media">
<div class="media-left">
<img class="media-object" src="diy/pi-prep/images/icon.jpg">
</div>
<div class="media-body">
<h4 class="media-heading">
<a href="diy/pi-prep/">
Prepare a Raspberry Pi from scratch
</a>
</h4>
<p> Our step-by-step guide to prepare a lean yet versatile SD card image for the Pi. </p>
</div>
</li>
<li class="media">
<div class="media-left">
<img class="media-object" src="diy/pareto-anywhere-pi/images/icon.png">
</div>
<div class="media-body">
<h4 class="media-heading">
<a href="diy/pareto-anywhere-pi/">
Run Pareto Anywhere on a Raspberry Pi
</a>
</h4>
<p> Our step-by-step guide to install and run Pareto Anywhere on a Raspberry Pi to make any physical space context-aware. </p>
</div>
</li>
</ul>
<p> If you prefer to continue with the <b>version 0.x software</b>, instead follow the instructions below. </p>
</div>
<h2> <del>Hears</del> Here's what you'll get<br>
<small> Access any of these pages by browsing to the Pi </small> </h2>
<div uib-carousel interval="4000">
<div uib-slide index="0">
<img ng-src="images/piHub-dashboard.png"
class="img-responsive">
<div class="carousel-caption">
<h1> Dashboard </h1>
</div>
</div>
<div uib-slide index="1">
<img ng-src="images/piHub-barterer.png"
class="img-responsive">
<div class="carousel-caption">
<h1> Infrastructure APIs </h1>
</div>
</div>
<div uib-slide index="2">
<img ng-src="images/piHub-chickadee.png"
class="img-responsive">
<div class="carousel-caption">
<h1> Contextual APIs </h1>
</div>
</div>
<div uib-slide index="3">
<img ng-src="images/piHub-bubblescape.jpg"
class="img-responsive">
<div class="carousel-caption">
<h1> The bubblescape </h1>
</div>
</div>
</div><br>
<p> You'll also have access to REST APIs and a real-time data stream over websockets. </p>
<h2> Hardware Prerequisites </h2>
<p> You'll need a <b>Raspberry Pi 3</b> or <b>Raspberry Pi Zero W</b> (or equivalent) with native Bluetooth capability in order to make a <i>standalone</i> sniffer. </p>
<p> If you have a non-Bluetooth Pi, do not despair! You can connect a purpose-built reelyActive starter kit to your Pi via USB for even-better sniffage! </p>
<img src="images/piHub-connected.jpg"
class="img-responsive center-block">
<p> Both items can be purchased by following the links below. If you prefer to get your hands dirty with the reelyActive kit, you can also <a href="build-your-own-hub.html#usb-hub" target="_blank">Build your own USB Hub</a> and purchase <a href="https://shop.reelyactive.com/products/ra-r436" target="_blank">the reelceiver</a>.
</p>
<p class="text-center">
<a class="btn btn-primary" role="button"
href="https://www.raspberrypi.org/products/raspberry-pi-3-model-b/">
Buy a Pi 3 </a>
<a class="btn btn-primary" role="button"
href="https://shop.reelyactive.com/products/starterkit-min">
Buy a Starter Kit </a>
</p>
<h2> Preparing the Pi </h2>
<p> Does your Pi already have an operating system (Raspbian/NOOBS) installed and is connected to the Internet? </p>
<p class="text-center" ng-hide="showPrep">
<button type="button" class="btn btn-default"
ng-click="showPrep = !showPrep">No, I need to do this!</button>
</p>
<uib-tabset uib-collapse="!showPrep">
<p> Choose from one of the three options below: </p>
<uib-tab heading="Quickest">
<blockquote> Setup your SD card from a disk image that <i>already</i> has Stretch Lite, Node.js and our software installed. This is the <i>same</i> setup as in the <b>From Scratch</b> option, except we did most of the work for you so that you can skip ahead for instant gratification! </blockquote>
<h3> SD Card </h3>
<p> Download our compressed disk image which is pre-configured as follows. </p>
<p class="text-center">
<a href="https://reelyactive.com/downloads/2018-07-19-reelyactive-pi.tar.xz" class="btn btn-default">Download disk image</a>
</p>
<table class="table table-striped table-reelyactive">
<caption> REELYACTIVE-PI DISK IMAGE CONFIGURATION </caption>
<thead>
<tr>
<th> Parameter </th>
<th> Value </th>
</tr>
</thead>
<tbody>
<tr>
<td> Disk Image Version </td>
<td> 2018-07-19-reelyactive-pi </td>
</tr>
<tr>
<td> Raspbian Version </td>
<td> Stretch Lite (2018-06-27) </td>
</tr>
<tr>
<td> Node.js Version </td>
<td> 8.11.3 </td>
</tr>
<tr>
<td> Pre-installed software </td>
<td> <a href="https://github.com/reelyactive/pi-suite" target="_blank">pi-suite</a>, <a href="https://www.npmjs.com/package/generable" target="_blank">generable</a> </td>
</tr>
<tr>
<td> Pre-configured Ethernet </td>
<td> DHCP client with fallback to DHCP server, IP: <i>10.0.50.100</i> </td>
</tr>
<tr>
<td> Hostname </td>
<td> reelyactive-pi </td>
</tr>
<tr>
<td> SSH </td>
<td> Enabled. Username: <b>pi</b>, password: <b>berryinsecure</b>. </td>
</tr>
<tr>
<td> Serial </td>
<td> Hardware enabled. Login disabled. </td>
</tr>
<!--<tr>
<td> I2C </td>
<td> Enabled </td>
</tr>-->
</tbody>
</table>
<p> Unzip <i>2018-07-19-reelyactive-pi.tar.xz</i> to obtain the 4.0GB disk image: <i>2018-07-19-reelyactive-pi.img</i> </p>
<p> Transfer the image to an SD card of at least 4GB. There's finally a friendly, cross-platform way to do this using <a href="https://etcher.io/">Etcher</a>:</p>
<img src="images/piHub-etcher.png"
class="img-responsive center-block">
<h3> First Connection </h3>
<p> Complete the following in order: </p>
<ol>
<li> insert the SD card in the Pi
<li> connect the Pi to your PC via a network cable
<li> apply power to the Pi
<li> wait about one minute for the Pi to boot
</ol>
<p> From the command line, ssh into the Pi as follows: </p>
<pre>ssh pi@10.0.50.100</pre>
<p> The default password will be <i>berryinsecure</i>. You're now connected to the Pi. </p>
<h3> raspi-config </h3>
<p> Configure the Pi by running the following from the command line: </p>
<pre>sudo raspi-config</pre>
<p> From the text-based menu, complete the following: </p>
<ol>
<li> Select the option to <i>Change User Password</i>. Choose a password that cannot be easily guessed, but is nonetheless straightforward to enter from the command line next time you'll ssh in. </li>
<li> Select the option to <i>Expand Filesystem</i> under Advanced Options. This will ensure that all of the available space on the SD card is available. </li>
</ol>
<p> Select <i>Finish</i>, then select <i>Yes</i> when asked to reboot. </p>
<p> SSH back into the Pi once the reboot is complete (using the new password). <i>The Pi is ready!</i> <b> Skip ahead to <a href="make-a-pi-hub.html#startsniffing">Start Sniffing!</a> </b> </p>
</uib-tab>
<uib-tab heading="From Scratch">
<blockquote> This is the <i>same</i> setup as in the <b>Quickest</b> option, only starting from scratch using the latest Stretch Lite image and the most recent versions of Node.js and our software. </blockquote>
<h3> SD Card </h3>
<p> Download the latest Raspbian Stretch Lite image from <a href="https://www.raspberrypi.org/downloads/raspbian/" target="_blank">www.raspberrypi.org/downloads/raspbian/</a>. </p>
<p> Transfer the image to an SD card of at least 4GB. There's finally a friendly, cross-platform way to do this using <a href="https://etcher.io/">Etcher</a>:</p>
<img src="images/piHub-etcher.png"
class="img-responsive center-block">
<h3> Basic settings </h3>
<p> Enable SSH (it is disabled by default) by browsing to the root of the /boot folder of the SD card and running from the command line: </p>
<pre>sudo touch ./ssh</pre>
<p> Disable consistent network device naming (introduced in Stretch) by editing the cmdline.txt file in the same /boot folder: </p>
<pre>sudo nano /boot/cmdline.txt</pre>
<p> Paste the following to the end of the first line of the file and save: </p>
<pre> net.ifnames=0</pre>
<p> Enable Ethernet static fallback so that you can directly connect the Pi to your PC and SSH in to a known IP address. Browse to the root of the / folder of the SD card and, from the command line open the dhcpcd.conf file for editing: </p>
<pre>sudo nano /etc/dhcpcd.conf</pre>
<p> Paste the following lines at the bottom of the file and save: </p>
<pre>
# Define static profile
profile static_eth0
static ip_address=10.0.50.100/24
static routers=10.0.50.1
static domain_name_servers=10.0.50.1
# Fallback to static profile on eth0
interface eth0
fallback static_eth0
</pre>
<p> This will configure the Pi to use IP address <b>10.0.50.100</b> when it is connected to Ethernet without DHCP. </p>
<h3> First Connection </h3>
<p> Complete the following in order: </p>
<ol>
<li> insert the SD card in the Pi
<li> connect the Pi to your PC via a network cable
<li> apply power to the Pi
<li> configure your PC's Ethernet adapter to use an address in the same subnet as the Pi (ex: 10.0.50.101)
</ol>
<p> From the command line, ssh into the Pi as follows: </p>
<pre>ssh pi@10.0.50.100</pre>
<p> The default password will be <i>raspberry</i>. You're now connected to the Pi. </p>
<h3> dnsmasq </h3>
<p> Configure the Pi to act as a DHCP server on the Ethernet port when no external DHCP server is available. From the command line, run the following: </p>
<pre>
sudo apt-get install dnsmasq
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.default
</pre>
<p> This will install the dnsmasq software. Configure the DHCP server by creating and editing the new dnsmasq.conf file: </p>
<pre>sudo nano /etc/dnsmasq.conf</pre>
<p> Paste in the following lines and save: </p>
<pre>
interface=eth0
dhcp-range=10.0.50.2,10.0.50.99,255.255.255.0,12h
</pre>
<p> This will configure the Ethernet interface to serve IP addresses in the range from 10.0.50.2-99 using DHCP, with a 12-hour lease. Restart the service from the command line for changes to take effect: </p>
<pre>sudo service dnsmasq restart</pre>
<h3> raspi-config </h3>
<p> Configure the Pi by running the following from the command line: </p>
<pre>sudo raspi-config</pre>
<p> From the text-based menu, complete the following: </p>
<ol>
<li> Select the option to <i>Change User Password</i>. Choose a password that cannot be easily guessed, but is nonetheless straightforward to enter from the command line next time you'll ssh in. </li>
<li> Select the option to <i>Expand Filesystem</i> under Advanced Options. This will ensure that all of the available space on the SD card is available. </li>
<li> Select the option for <i>Serial</i> under Interfacing Options. Select <i>No</i> to a login shell being accessible over serial. Select <i>Yes</i> to enable the serial port hardware. </li>
<li> Select the option for <i>I2C</i> under Interfacing Options. Select <i>Yes</i> to enable the ARM I2C interface. </li>
</ol>
<p> Select <i>Finish</i>, then select <i>Yes</i> when asked to reboot. </p>
<p> SSH back into the Pi once the reboot is complete (using the new password). <i>The Pi is ready!</i> </p>
</uib-tab>
<uib-tab heading="NOOBS with GUI">
<blockquote> Take this beginner-friendly route if you intend to run your Pi as a multi-purpose computer with mouse and keyboard attached. Otherwise we highly recommend the other options which are optimised for performance. </blockquote>
<h3> SD Card </h3>
<p> The Pi's filesystem resides on an SD card. If your Pi came with a prepared SD card, lucky you, you get to skip this step! </p>
<p> The <a href="https://www.raspberrypi.org/help/quick-start-guide/" target="_blank">Quick Start Guide</a> suggests an 8GB class 4 SD card, which we encourage you to purchase from an established vendor. If the card doesn't come formatted as FAT32, you'll need to do so (read the INSTRUCTIONS-README.txt included in the NOOBS ZIP file). </p>
<p> <a href="https://www.raspberrypi.org/downloads/" target="_blank">Download NOOBS</a> and unzip the contents to the root folder of the SD card. You're all set! </p>
<h3> Initial Boot </h3>
<p> Connect the following to your Pi:
<ul>
<li> the prepared SD card in its slot
<li> a USB keyboard in one of the USB ports
<li> a USB mouse in another USB port
<li> a monitor via the HDMI port
</ul>
</p>
<p> Then power the Pi through a <u>high-quality</u> USB power source (ex: phone charger). Follow the instructions on screen to install the Raspbian operating system. This procedure will take some time. Perhaps enjoy a slice or two of delicious raspberry pie while you wait? </p>
<h3> Connect to Network </h3>
<p> After Raspbian boots, connect the Pi to the Internet via either WiFi or Ethernet using the on-screen tools. <i>The Pi is ready!</i> </p>
</uib-tab>
</uib-tabset>
<hr collapse="!showPrep">
<h3> Update packages </h3>
<p> It is good practice to ensure that the software on the Pi is up to date before proceeding with any software installation. From the command line on the Pi, execute the following in order: </p>
<pre>
sudo apt-get update
sudo apt-get upgrade
</pre>
<h2> Install Node.js and forever </h2>
<p> Do you have <b>Node.js</b> (version 8) and <b>forever</b> installed? </p>
<a ng-class="node === true ? 'btn btn-warning' : 'btn btn-default'"
ng-click="node = true"> Yes </a>
<a ng-class="node === false ? 'btn btn-warning' : 'btn btn-default'"
ng-click="node = false"> No </a>
<a class="btn btn-default" ng-click="node = null"> Unsure </a>
<!----- Node.js installed ----->
<div ng-show="node === true">
<h3> You're all set! </h3>
<p> Proceed to install pi-suite </p>
</div>
<!----- Install Node.js ----->
<div ng-show="node === false">
<h3> Install Node.js </h3>
<p> Raspbian will likely include an old version of Node.js. Here we'll provide the instructions for installing a <i>known working version</i> of <b>Node.js 8</b> for different variants of the Pi. </p>
<div class="well">
<h4> Why Node.js version 8? </h4>
<p> The <a href="https://www.npmjs.com/package/bluetooth-hci-socket" target="_blank">hci-bluetooth-socket package</a>, which is key to accessing the Bluetooth radio in the Pi, is no longer maintained by its original author and does not support more recent versions of Node.js. </p>
<p> If you wish to proceed with the <i>latest</i> version of Node.js, consider instead following <a href="https://reelyactive.github.io/diy/pi-suite/" target="_blank">the current version of this tutorial</a> which overcomes this by using the <a href="https://www.npmjs.com/package/@abandonware/bluetooth-hci-socket" target="_blank">@abandonware/hci-bluetooth-socket</a> package. Otherwise expect things to break on the <code>npm install</code> below...</p>
</div>
<table class="table">
<tr>
<th> Raspberry Pi 3 </th>
<td> node-v8.11.3-linux-armv7l </td>
<td> <a href="https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-armv7l.tar.xz"> URL </a> </td>
</tr>
<tr>
<th> Raspberry Pi Zero (W) </th>
<td> node-v4.8.2-linux-armv6l </td>
<td> <a href="https://nodejs.org/dist/v4.8.2/node-v4.8.2-linux-armv6l.tar.xz"> URL </a> </td>
</tr>
</table>
<p> From the command line on the Pi, execute the following in order, substituting the URL and Node version as per the table above: </p>
<pre>
cd ~/Downloads
wget https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-armv7l.tar.xz
tar -xf node-v8.11.3-linux-armv7l.tar.xz
sudo mv node-v8.11.3-linux-armv7l /usr/local/node
cd /usr/local/bin
sudo ln -s /usr/local/node/bin/node node
sudo ln -s /usr/local/node/bin/npm npm
</pre>
<p> Confirm that v8.11.3 (or the version you installed) appears when you run <code>node --version</code>. Node.js is now installed. </p>
<h3> Install forever </h3>
<pre>
cd /usr/local/bin
sudo npm install forever -g
sudo ln -s /usr/local/node/bin/forever forever
</pre>
</div>
<!----- Test for Node.js ----->
<div ng-show="node === null">
<h3> Verify if you have Node.js installed </h3>
<p> <a href="https://nodejs.org" target="_blank">Node.js</a> is a JavaScript runtime which runs libraries (such as our own) from the largest ecosystem of open source libraries in the world. The <a href="https://www.npmjs.com/package/forever" target="_blank">forever</a> package is one of these libraries, and it will keep our programs running forever, even if they crash. </p>
<p> Open a terminal or command prompt, type <code>node --version</code> and press Enter. </p>
<img src="images/node-version.gif"
class="img-responsive center-block"><br>
<p> If the output is something like <b>vx.x.x</b>, you do indeed have Node.js installed. Repeat the test with <code>forever --version</code>. If both are installed, click <a ng-click="node = true"><i>Yes</i></a> above. Otherwise click <a ng-click="node = false"><i>No</i></a> above. </p>
</div>
<h2> Install pi-suite </h2>
<p> The <b>pi-suite</b> is a collection of <a href="open-source-software.html" target="_blank">reelyActive open source software</a> which allows your Pi to: </p>
<ul>
<li> listen for BLE devices by itself (Raspberry Pi 3 or Zero W)
<li> listen for BLE devices via a reelyActive starter kit
<li> interpret the packets of these BLE devices
<li> host webpages displaying the interpreted data
<li> display these webpages via HDMI
<li> forward the live data stream to a remote server
</ul>
<p> If you're running the <i>Lite</i> version of Raspian Stretch or Jessie, you'll first need to install git by running <tt>sudo apt-get install git-core</tt> from the command line. </p>
<p> From the command line on the Pi, execute the following in order: </p>
<pre>
mkdir ~/reelyActive
cd ~/reelyActive
git clone https://github.com/reelyactive/pi-suite.git
cd pi-suite
<b>git checkout release-0.2</b>
npm install
</pre>
<h2 id="startsniffing"> Start Sniffing! </h2>
<p> Choose your configuration below and get up and running in an instant. </p>
<uib-tabset>
<uib-tab heading="I have a Pi 3">
<h3> Run pi-suite </h3>
<p> From the command line on the Pi, where you should still be in the ~/reelyActive/pi-suite folder, execute the following: </p>
<pre>sudo node pi-suite</pre>
<p> The console output should include a line that says <b>Browse to your Pi at http://xxx.xxx.xxx.xxx</b> with the IP address of your Pi in place of the x values. Copy the link and open it in your browser. </p>
<img src="images/piHub-hlc-server.gif"
class="img-responsive center-block"><br>
<h3> Become a bubble! </h3>
<p> The <i>bubblescape</i> is a visualisation of all the BLE devices sniffed by your Pi. <i>Fancy yourself as a bubble?</i> Install <a href="http://www.reelyactive.com/reelyapp/">reelyApp</a> on your Android or iOS device to experience the following: </p>
<div class="embed-container"><iframe src="https://www.youtube.com/embed/eamCXiNkUuE?rel=0&controls=0&showinfo=0&modestbranding" frameborder="0" allowfullscreen></iframe></div><br>
<p> Once you've finished your initial exploration of the various webpages displaying the live data, press Ctrl-C to terminate the execution of pi-suite before proceeding with the next steps. </p>
</uib-tab>
<uib-tab heading="I have a Reel-Pi HAT">
<h3> What's a Reel-Pi HAT? </h3>
<p> A HAT is Hardware Attached on Top. We've created, as open hardware, a HAT which connects to the Pi header and provides a <a href="reel-overview.html">direct interface to our reel</a>, allowing you to daisy-chain our reelceivers. </p>
<p class="text-center">
<a class="btn btn-default" role="button" target="_blank"
href="https://upverter.com/reelyActive/006d92d0aafec138/pi-reel-module/"> Check it out on Upverter </a>
</p>
<h3> Enable serial port hardware </h3>
<p> The Reel-Pi HAT communicates using the Pi's hardware serial port, which is disabled by default, but can easily be enabled with raspi-config. From the command line on the Pi, run <code>sudo raspi-config</code> and then configure as follows: </p>
<ul>
<li> Select <i>Interfacing Options</i> — <i>Serial</i>
<li> Select <b>No</b> to disable the login shell over serial
<li> Select <b>Yes</b> to enable the serial port hardware
<li> Accept to reboot the Pi
</ul>
<h3> Run pi-suite-reel </h3>
<p> From the command line on the Pi, where you should still be in the ~/reelyActive/pi-suite folder, execute the following: </p>
<pre>sudo node pi-suite-reel</pre>
<p> The console output should include a line that says <b>Browse to your Pi at http://xxx.xxx.xxx.xxx</b> with the IP address of your Pi in place of the x values. Copy the link and open it in your browser. </p>
<img src="images/piHub-hlc-server.gif"
class="img-responsive center-block"><br>
<h3> Become a bubble! </h3>
<p> The <i>bubblescape</i> is a visualisation of all the BLE devices sniffed by your Pi. <i>Fancy yourself as a bubble?</i> Install <a href="http://www.reelyactive.com/reelyapp/">reelyApp</a> on your Android or iOS device to experience the following: </p>
<div class="embed-container"><iframe src="https://www.youtube.com/embed/eamCXiNkUuE?rel=0&controls=0&showinfo=0&modestbranding" frameborder="0" allowfullscreen></iframe></div><br>
<p> Once you've finished your initial exploration of the various webpages displaying the live data, press Ctrl-C to terminate the execution of pi-suite before proceeding with the next steps. </p>
</uib-tab>
<uib-tab heading="I have a starter kit">
<h3> Connect your starter kit </h3>
<p> Connect your starter kit to any free USB port on the Pi taking care to respect the reelceiver directionality, as shown in the video. </p>
<div class="embed-container"><iframe src="https://www.youtube.com/embed/bbwgdcXSs5M?rel=0&controls=0&showinfo=0&modestbranding" frameborder="0" allowfullscreen></iframe></div>
<h3> Run pi-suite-pareto </h3>
<p> From the command line on the Pi, where you should still be in the ~/reelyActive/pi-suite folder, execute the following: </p>
<pre>sudo node pi-suite-pareto</pre>
<h3> View the data in Pareto </h3>
<p> Browse to <a href="https://pareto.reelyactive.com" target="_blank">pareto.reelyactive.com</a> and log in with the credentials provided when you purchased the starter kit. </p>
<h3> View the data on your Pi </h3>
<p> The console output should include a line that says <b>Browse to your Pi at http://xxx.xxx.xxx.xxx</b> with the IP address of your Pi in place of the x values. Copy the link and open it in your browser. </p>
<img src="images/piHub-hlc-server.gif"
class="img-responsive center-block"><br>
<h3> Become a bubble! </h3>
<p> The <i>bubblescape</i> is a visualisation of all the BLE devices sniffed by your Pi. <i>Fancy yourself as a bubble?</i> Install <a href="http://www.reelyactive.com/reelyapp/">reelyApp</a> on your Android or iOS device to experience the following: </p>
<div class="embed-container"><iframe src="https://www.youtube.com/embed/eamCXiNkUuE?rel=0&controls=0&showinfo=0&modestbranding" frameborder="0" allowfullscreen></iframe></div><br>
<p> Once you've finished your initial exploration of the various webpages displaying the live data, press Ctrl-C to terminate the execution of pi-suite-pareto before proceeding with the next steps. </p>
</uib-tab>
<uib-tab heading="I have neither">
<p> Unfortunately that means you have no Bluetooth Low Energy radio on which to listen, as indicated in the Hardware Prerequisites section. May we suggest you purchase a <a href="http://shop.reelyactive.com/products/starterkit-min" target="_blank">starter kit</a>? </p>
</uib-tab>
</uib-tabset>
<hr>
<p> </p>
<h2> Configure run-on-boot with kiosk display </h2>
<p> Would you like to do this? </p>
<a ng-class="kiosk === true ? 'btn btn-warning' : 'btn btn-default'"
ng-click="kiosk = true"> Yes </a>
<a ng-class="kiosk === false ? 'btn btn-warning' : 'btn btn-default'"
ng-click="kiosk = false"> No </a>
<a class="btn btn-default" ng-click="kiosk = null"> Unsure </a>
<!----- Configure kiosk ----->
<div ng-show="kiosk === true">
<h3> Install kiosk display packages </h3>
<p> In order for the Pi to display a webpage in kiosk mode, we'll need the Chromium browser (which handles JavaScript much better than the default Epiphany browser) and a window manager. From the command line, execute the following: </p>
<pre>
sudo apt-get install chromium-browser
sudo apt-get install matchbox-window-manager xautomation unclutter
</pre>
<h4> Install Xorg (special case) </h4>
<p> This step applies <u>only</u> if your Pi is running the <i>Lite</i> version of Raspbian Stretch or Jessie which doesn't have a GUI pre-installed. If you're already able to boot into a friendly desktop environment, <i> skip this step </i>. From the command line, execute the following: </p>
<pre>
sudo apt-get install --no-install-recommends xserver-xorg
sudo apt-get install --no-install-recommends xinit
sudo apt-get install --no-install-recommends x11-xserver-utils
</pre>
<h3> Configure run-on-boot </h3>
<p> Here we'll specify what programs to run on boot via the <a href="https://www.raspberrypi.org/documentation/linux/usage/rc-local.md" target="_blank">rc.local</a> file. From the command line, open the file for editing with the command <code>sudo nano /etc/rc.local</code> and paste the following line <u>above</u> the <i>exit 0</i> line: </p>
<pre>
sudo forever start /home/pi/reelyActive/pi-suite/pi-suite.js
</pre>
<p> Press Ctrl-X to save and exit the editor. Note that if you're using the Pi as a hub for a <a href="https://shop.reelyactive.com/products/starterkit-min" target="_blank">reelyActive starter kit</a> that should forward the real-time data to <a href="https://getpareto.com" target="_blank">Pareto</a>, you'll need to change the first line to instead run <b>pi-suite-pareto.js</b>. </p>
<p> Unfortunately, it's tricky to get Chromium to run (as normal user) from the rc.local file, but a workaround is to boot it from the pi user's <a href="https://www.raspberrypi.org/documentation/linux/usage/bashrc.md" target="_blank">.bashrc</a> file. From the command line, open the file for editing with the command <code>sudo nano ~/.bashrc</code> and paste the following line at the end: </p>
<pre>
xinit /home/pi/reelyActive/pi-suite/display-chromium -- vt$(fgconsole)
</pre>
<h3> Configure console autologin </h3>
<p> Now that the Pi is configured to run-on-boot with a kiosk display, there's no reason for it to load the desktop and waste valuable computing and memory resources. Instead we'll configure the Pi to boot to the console and log in automatically. From the command line, run <code>sudo raspi-config</code> and from the <i>Boot Options</i> menu, select <i>Console Autologin</i> (which may be under a Desktop/CLI sub-menu). </p>
<h3> Reboot </h3>
<p> Reboot the Pi with the command <code>sudo reboot now</code> or with a power cycle. Confirm that after a minute or so you can browse to the Pi and observe the webpage decoding BLE devices. Also confirm that the webpage is projected on an HDMI-connected monitor (connect the monitor <i>before</i> the reboot so that the resolution can be detected). </p>
</div>
<!----- Don't configure kiosk ----->
<div ng-show="kiosk === false">
<h3> You can always do it later if you like! </h3>
<p> Check out the other optional features below. </p>
</p>
</div>
<!----- Should I configure kiosk? ----->
<div ng-show="kiosk === null">
<h3> It's up to you! </h3>
<p> This final <u>OPTIONAL</u> step configures the Pi to run pi-suite automatically on boot, as well as display its webpage on any monitor via the HDMI port. </p>
<p> If that's what you'd like to do, click <a ng-click="kiosk = true"><i>Yes</i></a> above. </p>
</div>
<h2> Optional features </h2>
<p> Consider implementing the following optional features. </p>
<uib-tabset>
<uib-tab heading="WiFi networks">
<p> The Pi can easily be pre-configured to connect to multiple WiFi networks. This feature is useful if the Pi is moved to different locations, each with their own WiFi credentials. To pre-configure WiFi credentials, from the command line, open the wpa_supplicant.conf file for editing with the command <code>sudo nano /etc/wpa_supplicant/wpa_supplicant.conf</code> and paste the following block of code, once for each network, at the bottom of the file. </p>
<pre>
network={
ssid="ENTER_SSID_HERE"
psk="ENTER_PASSWORD_HERE"
key_mgmt=WPA-PSK
}
</pre>
<p> Don't forget to enter the SSID and password for each network with much care! Although networks commonly use a pre-shared key (PSK) for authentication, as specified in the example above, it may be necessary to tweak the settings as discussed in details <a href="https://wiki.archlinux.org/index.php/WPA_supplicant" target="_blank">here</a>. </p>
</uib-tab>
<uib-tab heading="Ethernet fallback">
<p> Ethernet fallback ensures that you can always directly connect to your Pi at a known static IP. The Pi will assume the static IP on its Ethernet port in the absence of a DHCP server. To enable Ethernet fallback, from the command line, open the dhcpcd.conf file for editing with the command <code>sudo nano /etc/dhcpcd.conf</code> and paste the following lines of code at the bottom of the file. </p>
<pre>
# Define static profile
profile static_eth0
static ip_address=10.0.50.100/24
static routers=10.0.50.1
static domain_name_servers=10.0.50.1
# Fallback to static profile on eth0
interface eth0
fallback static_eth0
</pre>
<p> When all else fails, to log on to the Pi, directly connect your computer to the Pi via Ethernet, set your computer's IP address to 10.0.50.101, and <code>ssh pi@10.0.50.100</code> </p>.
</uib-tab>
<uib-tab heading="Scheduled reboots">
<p> Scheduled reboots ensure that the Pi will eventually recover from any soft failure. To force daily reboots via a cron job, from the command line, open the crontab file for editing with the command <code>sudo nano /etc/crontab</code> and paste the following line of code <u>above</u> the closing #. </p>
<pre>
0 5 * * * root reboot
</pre>
<p> The 5 signifies 5am. Adjust this and the other parameters as your application requires. </p>
</uib-tab>
<uib-tab heading="More">
<p> Enable additional features such as data logging by editing <a href="https://github.com/reelyactive/pi-suite/blob/master/pi-suite.js" target="_blank">pi-suite.js</a> with the command <code>nano ~/reelyActive/pi-suite/pi-suite.js</code> or <a href="https://github.com/reelyactive/pi-suite/blob/master/pi-suite-pareto.js" target="_blank">pi-suite-pareto.js</a> with the command <code>nano ~/reelyActive/pi-suite/pi-suite-pareto.js</code>.</p>
<p> Simply comment or uncomment the desired options by adding or removing two backslashes at the start of each concerned line. Press Ctrl-X to save the file and exit. </p>
</uib-tab>
</uib-tabset>
<p> </p>
<h2> Prefer Software-as-a-Service? </h2>
<img src="images/pareto-by-reelyactive.jpg"
class="img-responsive center-block"><br>
<p> Our Pareto platform combines even more features and functionality with the convenience of SaaS. You can even use your Raspberry Pi as a gateway. </p>
<p class="text-center">
<a class="btn btn-primary" href="https://getpareto.com"
target="_blank" role="button"> Visit getpareto.com </a>
</p>
<hr>
<h2> What's next? </h2>
<p> Create a beautiful dashboard to display on your kiosk screen! Follow our <a href="build-web-apps-with-beaver.html">Build web apps with beaver.js</a> tutorial to tap into the live socket.io data feed from our open source software running on the Pi. </p>
<p> Convert your Pi into the heart of a <a href="experience-generative-art.html">generative art station</a> with our GeneraBLE project! </p>
<p> Connect your BLE-sniffing Pi to openHAB by following <a href="https://community.openhab.org/t/reelyactive-smart-spaces/12910" target="_blank">this thread</a>. </p>
<p> If you build your own unique hub and would like to share your project, <a href="http://www.reelyactive.com/contact/" target="_blank">please get in touch</a>! </p>
<p class="text-center">
<a class="btn btn-default" href="build-web-apps-with-beaver.html"
role="button"> Build web apps with beaver.js </a>
<a class="btn btn-default" href="experience-generative-art.html"
role="button"> Make generative art </a>
<a class="btn btn-success" href="/"
role="button"> Return to diyActive </a>
</p>
</div>
<div class="col-xs-0 col-sm-1 col-md-2 col-lg-3"></div>
</div>
</div>
<footer class="footer">
<a href="/"
uib-tooltip="Do-it-yourself with reelyActive"
tooltip-placement="left"> diyActive </a> |
<a href="https://www.reelyactive.com"
uib-tooltip="We believe in an open Internet of Things"
tooltip-placement="right">
© reelyActive 2016-2018
</a>
</footer>
</div>
</body>
</html>