Our step-by-step guide to install and run Pareto Anywhere on a Raspberry Pi to make any physical space context-aware.
Learn how we at reelyActive run our Pareto Anywhere open source middleware on a Pi.
The Raspberry Pi will transform ambient wireless data into real-time context: who/what is where/how.
A Raspberry Pi (or equivalent) with Raspberry Pi OS Lite installed.
Clone our pareto-anywhere repository on GitHub and install all dependencies using npm.
Both the Pi and the computer used for its configuration must be on the same network, with which they can access the Internet.
With the prepared micro SD card inserted into the Pi, complete the following:
ssh pi@xxx.xxx.xxx.xxx
replacing the x values with the Pi's IP address If you're still using the default password, this is as good a time as any to change it. Simply run sudo raspi-config
First create a reelyActive folder under the home folder.
mkdir ~/reelyActive
cd ~/reelyActive
Next, install Pareto Anywhere under this folder.
git clone --recurse-submodules https://github.com/reelyactive/pareto-anywhere.git
cd pareto-anywhere
npm install
1 min It is possible that some dependencies produce warnings or errors. Do not despair: in most cases these have no impact on functionality.
Confirm that everything works!
From the same terminal connected to the Pi via SSH, and from the pareto-anywhere folder:
Start the middleware and browse to the Pi to confirm that it is running as follows:
npm start
Observe the Pareto Anywhere landing page. It is normal not to observe any real-time data as a source has yet to be connected.
The software can be stopped by entering Ctrl+C from the command line.
Should a source of ambient data be available (see the tabs below), it is possible to validate its integration with Pareto Anywhere, replacing xxx.xxx.xxx.xxx with the Pi's IP address, where required.
Pareto Anywhere will automatically listen for ambient Bluetooth Low Energy data forwarded from reelyActive Owl-in-Ones and Minew G1 gateways. Follow the step-by-step tutorials below to forward data from these gateways.
Pareto Anywhere will automatically listen for ambient Bluetooth Low Energy data forwarded from compatible Aruba and Huawei APs. Follow the step-by-step tutorials below to forward data from these access points.
Forward UDP packets from the Huawei AP to the Pi on port 50010
Pareto Anywhere will automatically listen for ambient Bluetooth Low Energy data from its onboard radio provided an instance of barnowl-hci is running and forwarding the data. Follow the instructions below to install and run automatically each time the Pi boots.
From the same terminal connected to the Pi via SSH, complete the following:
cd ~/reelyActive
git clone https://github.com/reelyactive/barnowl-hci.git
cd barnowl-hci
npm install
1 min Allow Node.js programs the privilege to initiate scans with the command sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
Run barnowl-hci once to confirm that it can listen for ambient data:
npm start
will output radio decodings (raddecs) to the console for quick-and-dirty testing npm run forwarder
will forward raddecs to a local Pareto Anywhere instance Enter Ctrl+C to stop either program.
Configure systemd to run the barnowl-hci-forwarder service by completing the following:
sudo cp units/barnowl-hci-forwarder-pi.service /lib/systemd/system
sudo systemctl enable barnowl-hci-forwarder-pi.service
sudo systemctl start barnowl-hci-forwarder-pi.service
The Pi will now automatically and continuously scan for ambient devices each time it boots, forwarding the data to Pareto Anywhere.
If necessary, it is possible to disable the service with the command sudo systemctl disable barnowl-hci-forwarder-pi.service
.
Pareto Anywhere will automatically listen for ambient Bluetooth Low Energy data forwarded from reelyActive reelceivers on UDP port 50000.
Pareto Anywhere will automatically listen for ambient RAIN RFID data forwarded from compatible Impinj and RF Controls readers. See the barnowl-impinj and barnowl-rfcontrols modules, respectively, for additional details.
Pareto Anywhere will automatically listen for ambient EnOcean Wireless Standard data from a connected USB dongle provided an instance of barnowl-enocean is running and forwarding the data. Follow the instructions below to install and run automatically each time the Pi boots.
From the same terminal connected to the Pi via SSH, complete the following:
cd ~/reelyActive
git clone https://github.com/reelyactive/barnowl-enocean.git
cd barnowl-enocean
npm install
1 min Include the pi user in the dialout group to facilitate serial access to the USB dongle with the command sudo usermod -a -G dialout pi
Run barnowl-enocean once to confirm that it can listen for ambient data:
npm start
will output radio decodings (raddecs) to the console for quick-and-dirty testing npm run forwarder
will forward raddecs to a local Pareto Anywhere instance Enter Ctrl+C to stop either program.
Configure systemd to run the barnowl-enocean-forwarder service by completing the following:
sudo cp units/barnowl-enocean-forwarder-pi.service /lib/systemd/system
sudo systemctl enable barnowl-enocean-forwarder-pi.service
sudo systemctl start barnowl-enocean-forwarder-pi.service
The Pi will now automatically listen to a connected EnOcean USB dongle each time it boots, forwarding the data to Pareto Anywhere.
If necessary, it is possible to disable the service with the command sudo systemctl disable barnowl-enocean-forwarder-pi.service
.
Pareto Anywhere now #RunsAtTheEdge on your Pi!
Our cheatsheet details the raddec and dynamb JSON output from the Pareto Anywhere open source middleware.
Configure a systemd service to run Pareto Anywhere each time the Pi boots.
From the same terminal connected to the Pi via SSH, and from the pareto-anywhere folder:
Configure systemd to run the pareto-anywhere service by completing the following:
sudo cp units/pareto-anywhere-pi.service /lib/systemd/system
sudo systemctl enable pareto-anywhere-pi.service
sudo systemctl start pareto-anywhere-pi.service
Observe the Pareto Anywhere landing page.
This optional step applies only if custom environment variable configuration is required.
To configure the Pi to forward data to the Elastic Cloud, first follow this tutorial to retrieve the Node URL which will serve as the ELASTICSEARCH_NODE environment variable.
Should your configuration require any environment variables to be set differently than the defaults, for example to connect to a remote Elasticsearch database, these variables can be added to .conf files associated with the pareto-anywhere-pi.service as follows:
sudo systemctl edit pareto-anywhere-pi.service
[Service]
Environment="ELASTICSEARCH_NODE=https://user:pass@server.com"
The environment variables from this .conf file will be observed each time the service runs.
Reboot and again observe the Pareto Anywhere landing page as follows:
sudo reboot now
1 min Once again observe the Pareto Anywhere landing page. The middleware will indeed run each time the Pi boots.
If necessary, it is possible to disable the service with the command sudo systemctl disable pareto-anywhere-pi.service
.
Pareto Anywhere is now installed and will run on each boot. The Pi can now optionally be configured as a kiosk display, which is the subject of the following tutorial:
Configure mDNS and route port 80 for discoverability as http://pareto.local
From the command prompt on the Pi , enter the command sudo raspi-config
which will open a text-based menu.
Update the configuration as per the following table where the settings are indicated in [ ].
# | Option | Action(s) |
---|---|---|
1 | System Options |
S4 Hostname
|
Upon completing the above, select <Finish> and select <Yes> when prompted to reboot. Once rebooted, try SSHing back into the Pi from your computer with the command ssh pi@pareto.local
in preparation for Part 2 below.
Because mDNS is not supported by all networks and operating systems, SSHing to pi@pareto.local may fail. In this case, revert to ssh pi@xxx.xxx.xxx.xxx where the x values are the Pi's IP address.
By default, Pareto Anywhere runs on port 3001, which makes it accessible to a web browser at pareto.local:3001. By default, web (HTTP) traffic is served on port 80, which can be accessed by simply browsing to pareto.local (the :80 is implicit).
To serve Pareto Anywhere on pareto.local, from a terminal, update iptables to redirect traffic from port 80 to port 3001 with the command sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3001
From a computer on the same network as the Pi, browse to pareto.local and observe the Pareto Anywhere web page.
To make this redirection persistent (i.e. every time the Pi boots), install the iptables-persistent package with the command sudo apt-get install iptables-persistent
and when prompted, select <Yes> to save the current IPV4 rules.
Validate the redirect rule at any time with the command sudo iptables -t nat -L
and observe the REDIRECT in the PREROUTING chain.
Because mDNS is not supported by all networks and operating systems, browsing to pareto.local may fail. Pareto Anywhere will nonetheless be accessible at http://xxx.xxx.xxx.xxx where the x values are the Pi's IP address.
Any time you visit a context-aware physical space, try browsing to pareto.local while connected to the local WiFi—imagine what you can discover!
Tutorial prepared with ♥ by jeffyactive.
You can reelyActive's open source efforts directly by contributing code & docs, collectively by sharing across your network, and commercially through our packages.Continue exploring our open architecture and all its applications.