Raspberry PI Installation Guide
This guide supports you in setting up a wireless acoustic sensor network on Raspberry PIs. To this end we briefly describe the operating system installation and the basic software package setup which is required by MARVELO. An automatic console script for linux is described in the next section, either you do the installation by hand or you try the script in the next section (your choice!). But before you have to download a current Debian Image and burn it to a SD-Card (this basic step is not part of the script!).
- Download a current Linux image from the official Raspberry Pi Website
https://www.raspberrypi.org/downloads/
We suggest to use the "Raspbian Stretch with Desktop" version. - Follow the installation guide on the Raspberry Pi Website to install the image on a 16GB SD-Card
- Grab Marvello from https://github.com/CN-UPB/MARVELO
Preparing Rasperry Pi's to be part of a sensor network
We have created an installation script for setting up a Raspberry Pi Model 3b+. Take a SD card and burn the image on the SD card.
Call: sh piconfigscript.sh /dev/sdb yourpi1 10.0.66.1
The first parameter defines the card reader device (use lsblk to find yours) which should have to parts (e.g., /dev/sdb1 and /dev/sdb2). The second parameter defines the name of your pi (e.g., yourpi1) and the last parameter defines the AD-Hoc wlan address of the pi (e.g., 10.0.66.1).
The script you find here: piconfigscript.sh
- Activate SSH by adding empty file named "ssh" to /boot on mounted SD-Card
- Keep LAN configured with DHCP support, or change it to your needs
- Configure WLAN to AD-Hoc Mode and ESSID "ASN"
Add the following lines to/etc/network/interfaces
Replace YourIP with the IP-Adress of your node
auto wlan0
iface wlan0 inet static
addressYourIP
netmask 255.255.0.0
wireless-channel 1
wireless-essid ASN
wireless-mode ad-hoc
auto eth0
iface eth0inet
dhcp - Create user
asn
(id 1001, group 1000) with home directory/home/asn
- Add YourNode and other hosts to
/etc/hosts
127.0.1.1YourNode
YourIP
YourNode
10.0.1.1 asnupb1
10.0.2.1 asnrub1
10.0.3.1 asnfau1
Project intern we use the following ranges for our nodes
UPB: 10.0.1.1 -> 10.0.1.255
RUB: 10.0.2.1 -> 10.0.2.255
FAU: 10.0.3.1 -> 10.0.3.255
Update the Installation
It is always a good idea to update a new installation to fix recently found bugs. The easiest way is to connect the pi to a network with DHCP server running and serving adresses. The Pi will receive an address and you can update the system. Alternatively, you may connect to the Pi via the AD-HOC network "ASN" and use your Laptop as intermediate system to gain internet access. Again your choice.
Please perform the following steps
- Beomce root on the pi by: sudo -i
- rpi-update
- apt-get update
- apt-get upgrade
Install the following packages via apt-get install
- ansible
- build-essential
- cmake
Use the script Installscripts.zip to install Python3.6.5
Installing Tensorflow on a PI
Installing Tensorflow on a PI last a few hours! We follow the installation guide on github.com/samjabrahams/tensorflow-on-raspberry-pi/blob/master/GUIDE.md and made some changes to get it running. Here a short summary is presented.
Perform the following steps to prepare the Tensorflow installation on your PI.
- apt-get install pkg-config zip g++ zlib1g-dev unzip
apt-get install python-pip python-numpy swig python-dev
- apt-get install libblas-dev liblapack-dev
- apt-get install libhdf5-dev libffi-dev
- apt-get install libsamplerate0 libsamplerate0-dev
- pip3.6 install virtualenv
- pip3.6 install matplotlib
- pip3.6 install Cython
- pip3.6 install scipy
- pip3.6 install pandas==0.19.2
- pip3.6 install git+https://github.com/cournape/samplerate.git
pip install wheel
apt-get install python3-pip python3-numpy swig python3-dev
pip3.6 install wheel
- pip3.6 install numpy
apt-get install gcc-4.8 g++-4.8
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 100
- mkdir tf
- cd tf
Get Bazel by
- wget github.com/bazelbuild/bazel/releases/download/0.12.0/bazel-0.12.0-dist.zip
- unzip -d bazel bazel-0.12.0-dist.zip
- cd bazel
- Modify file: nano scripts/bootstrap/compile.sh
Move down to line 117, where you'll see the following block of code:
run "${JAVAC}" -classpath "${classpath}" -sourcepath "${sourcepath}" \
-d "${output}/classes" -source "$JAVA_VERSION" -target "$JAVA_VERSION" \
-encoding UTF-8 "@${paramfile}"
At the end of this block, add in the -J-Xmx500M flag, which sets the maximum size of the Java heap to 500 MB:
run "${JAVAC}" -classpath "${classpath}" -sourcepath "${sourcepath}" \ -d "${output}/classes" -source "$JAVA_VERSION" -target "$JAVA_VERSION" \ -encoding UTF-8 "@${paramfile}" -J-Xmx500M - Modify another file: nano tools/cpp/lib_cc_configure.bzl
Place the line return "arm" at the beginning of the _get_cpu_value function:
...
"""Compute the cpu_value based on the OS name."""
return "arm"
... - ./compile.sh
Now bazel should be compiled and after an hour of coffee drinking you should get a "successfull" message.
Download Tensorflow ( Version v1.5.0 works with this description)
- git clone --branch v1.5.0 --recurse-submodules github.com/tensorflow/tensorflow.git
- cd tensorflow
- grep -Rl 'lib64' | xargs sed -i 's/lib64/lib/g'
We also tried other versions of tensorflow, e.g., v1.6.0-rc1, but they broke down somewhere with a lot of errors.
Please specify the location of python. [Default is /usr/bin/python]: /usr/local/bin/python3.6
Please input the desired Python library path to use. Default is [/usr/local/lib/python3.6/site-packages]
Do you wish to build TensorFlow with jemalloc as malloc support? [Y/n]: Y
jemalloc as malloc support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Google Cloud Platform support? [Y/n]: N
No Google Cloud Platform support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Hadoop File System support? [Y/n]: N
No Hadoop File System support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Amazon S3 File System support? [Y/n]: N
No Amazon S3 File System support will be enabled for TensorFlow.
Do you wish to build TensorFlow with Apache Kafka Platform support? [y/N]: N
No Apache Kafka Platform support will be enabled for TensorFlow.
Do you wish to build TensorFlow with XLA JIT support? [y/N]: N
No XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with GDR support? [y/N]: N
No GDR support will be enabled for TensorFlow.
Do you wish to build TensorFlow with VERBS support? [y/N]: N
No VERBS support will be enabled for TensorFlow.
Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: N
No OpenCL SYCL support will be enabled for TensorFlow.
Do you wish to build TensorFlow with CUDA support? [y/N]: N
No CUDA support will be enabled for TensorFlow.
Do you wish to build TensorFlow with MPI support? [y/N]: N
No MPI support will be enabled for TensorFlow.
- bazel build -c opt --copt="-mfpu=neon-vfpv4" --copt="-funsafe-math-optimizations" --copt="-ftree-vectorize" --copt="-fomit-frame-pointer" --local_resources 1024,1.0,1.0 --verbose_failures tensorflow/tools/pip_package:build_pip_package
- bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
- pip install /tmp/tensorflow_pkg/tensorflow-1.1.0-cp27-none-linux_armv7l.whl
- Turn of swap: swapoff /dev/XXX
- Finally, remove the line you wrote in /etc/fstab referencing the device
sudo nano /etc/fstab - Then reboot your Raspberry Pi.
Install MARVELO
Download the current MARVELO Code.