zing-relay

1.3.2 • Public • Published

Setup a ZING Relay on Raspberry Pi

The following instructions has been extensively tested on Raspberry Pi 3 Model B and Pi Zero Wireless, both using the embedded WiFi & Bluetooth hardware. This should also work on older models with supported external wireless adapters.

Step-by-Step Instructions

  1. Install Raspbian Jessie Lite
    (as of this writing, the latest available is kernel version 4.4)

  2. Boot & Login
    default username: pi
    default password: raspberry

  3. Perform Basic Setup

     pi@raspberrypi:~ $ sudo raspi-config
     
    1. Update localization settings to your specific region, e.g. from GB to US

      • locale
      • keyboard
      • wifi
      • etc...
    2. Reboot then verify locale settings, e.g. if symbols on keyboard work as expected

    3. Change default password for user pi
      (make sure you do this after changing the keyboard locale)

    4. Enabled SSH Server

  4. Setup Wifi

    • Edit the WPA supplicant configuration file

        pi@raspberrypi:~ $ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
        
    • Add your wifi credentials to the end of the file, in the form of

        network={
        	ssid="<YOUR SSID>"
        	psk="<YOUR PSK>"
        }
        
    • Reboot then verify network connectivity

  5. New a single line script to install everything below:

     wget -qO- https://raw.githubusercontent.com/zingdom/zing-relay/master/scripts/install.sh | sudo bash
     
  6. Update Installed Packages & Firmware

     pi@raspberrypi:~ $ sudo apt update
     pi@raspberrypi:~ $ sudo apt full-upgrade
     pi@raspberrypi:~ $ sudo apt install -y rpi-update
     pi@raspberrypi:~ $ sudo rpi-update
     
    • Reboot
      (the Pi may hang at this point -- black screen with flashing green ACTI led, simply power cycle if that happens)
  7. Install bluez from source

    • Install dependencies first

        pi@raspberrypi:~ $ sudo apt install -y libusb-dev \
                                               libdbus-1-dev \
                                               libglib2.0-dev \
                                               libudev-dev \
                                               libical-dev \
                                               libreadline-dev
        
    • Download the latest version of bluez (v5.44) from http://www.bluez.org/download/

        pi@raspberrypi:~ $ wget http://www.kernel.org/pub/linux/bluetooth/bluez-5.44.tar.xz
        pi@raspberrypi:~ $ tar xvf bluez-5.44.tar.xz
        pi@raspberrypi:~ $ cd bluez-5.44
        pi@raspberrypi:~ $ ./configure --disable-systemd --enable-deprecated
        pi@raspberrypi:~ $ make
        pi@raspberrypi:~ $ sudo make install
        
    • Enable full Bluetooth LE support by editing bluetooth.service and add –experimental flag to bluetoothd service

        pi@raspberrypi:~ $ sudo nano \
            /etc/systemd/system/bluetooth.target.wants/bluetooth.service
        
    • the edited line should look like:

        ...
        ExecStart=/usr/local/libexec/bluetooth/bluetoothd --experimental
        ...
        
    • reindex the systemd units and reboot

        pi@raspberrypi:~ $ sudo systemctl daemon-reload
        pi@raspberrypi:~ $ sudo reboot
        
  8. Install Node.js

    • Install nvm (node version manager)
      nvm is a "simple bash script to manage multiple active node.js versions." More importantly, it's an easy way to compile node from source on platforms without prebuilt binaries, i.e. Pi Zero Wireless (ARMv6hf). Another bonus, it'll allows us to do npm install -g later without requiring root/sudo.

        pi@raspberrypi:~ $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
        
        => Downloading nvm from git to '/home/pi/.nvm'
        => Cloning into '/home/pi/.nvm'...
        ...
        => Close and reopen your terminal to start using nvm or run the following to use it now:
        export NVM_DIR="$HOME/.nvm"
        [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
        

      As stated, you'll need to log out and back in to see the environment variables take effect, do that now.

        pi@raspberrypi:~ $ nvm install --lts node
        
    • Alternative method:
      If you are on a Pi 3, you can install prebuild binaries directly from node.

        pi@raspberrypi:~ $ curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
        pi@raspberrypi:~ $ sudo apt install -y nodejs
        
    • verify node is installed

        pi@raspberrypi:~ $ node -v
        v7.7.2
        pi@raspberrypi:~ $
        
    • by default, escalated privileges are required to start/stop bluetooth advertising; to avoid having to run node programs as root or sudo each time, grant cap_net_raw privileges to the node binary:

        pi@raspberrypi:~ $ sudo setcap cap_net_raw+eip $(eval readlink -f `which node`)
        
  9. Install zing-relay

     pi@raspberrypi:~ $ sudo npm install -g zing-relay
     

Readme

Keywords

none

Package Sidebar

Install

npm i zing-relay

Homepage

www.zing.fm

Weekly Downloads

2

Version

1.3.2

License

GPL-3.0

Last publish

Collaborators

  • ddwang