Installing the on-board Server
This section describes the steps to install the Vinophonics on-board server.
These are the specifications for the server:
Raspberry Pi 4 - 4GB
SANdisk Extreme 64GB
HiFiBerry DAC+ADC
Arduino Mega
Configuring Raspberry Pi
Install and configure Raspbian
Follow the instructions for installing raspbian, similar to these. The Weather Station
sudo apt-get install python-pip
python -m pip install --upgrade pip setuptools wheel
sudo apt-get install python3-pip
create users and ssh access
Install and configure PyFirmata
From Knight-of-pi.org:
PyFirmata by Tino de Bruijn is an amazing tool for combining the powers of the Raspberry Pi (full operating system, python, …) and the Arduino (high time precision, …). This will allow us to control the Arduino Mega from the Raspberry Pi. This is important, because of two reasons:
The Raspberry Pi has the input data from the ethereum node script.
If we want to use 16 PWM pins, the Arduino Mega only has 14 (or 15), but we could use one (or 2) of the RPI PWM pins.
sudo apt-get -y install arduino python-serial mercurial
git clone https://github.com/tino/pyFirmata
cd pyFirmata
sudo python setup.py install
Using the Arduino IDE, upload the default PyFirmata firmware on the arduino (file → Examples → Firmata → Standard Firmata)
Test using PyFirmata "Hello World"
Download the script from GitHub:
wget https://github.com/JoBergs/RaspiContent/raw/master/pyfirmata_pwm.py
Set the USB port in the following line to match the output from
Edit pyfirmata_pwm.py to match the device name
Then, connect the pin D3 of the Arduino to a LED and a 270Ω resistor on the breadboard.
Now, start the script by typing:
python pyfirmata_pwm.py
The glow of the LED will increase slowly until the full capacity is reached:
Configure static wifi IP address
Edit the file:
Add to the file /etc/dhcpcd.conf the following lines:
mbarrow@vinophonics:~ $ sudo systemctl disable dhcpcd
mbarrow@vinophonics:~ $ sudo systemctl enable networking
Configure VPN
mbarrow@vinophonics:/etc/openvpn$ ls -la
total 48
drwxr-xr-x 4 root root 4096 Jul 11 12:15 .
drwxr-xr-x 146 root root 12288 Jul 11 00:07 ..
-rw-r--r-- 1 root root 17 Jul 11 12:08 auth.txt
drwxr-xr-x 2 root root 4096 Sep 5 2018 client
-rw-r--r-- 1 mbarrow mbarrow 657 Dec 21 2018 mdv-clofw01-TCP4-1195-india-tls.key
-rw-r--r-- 1 root root 371 Jul 11 12:14 mdv-clofw01-TCP4-1195-india.conf
lrwxrwxrwx 1 root root 32 Jul 11 12:15 mdv-clofw01-TCP4-1195-india.ovpn -> mdv-clofw01-TCP4-1195-india.conf
-rw-r--r-- 1 mbarrow mbarrow 4101 Dec 21 2018 mdv-clofw01-TCP4-1195-india.p12
drwxr-xr-x 2 root root 4096 Sep 5 2018 server
-rwxr-xr-x 1 root root 1301 Sep 5 2018 update-resolv-conf
Setup Dual Network access
To enable configuration of the Vinophonics wifi interface, a default bluetooth networking interface is configured to assure that when MTBMBP is available as a bluetooth interface, a network connection is plumbed. This way, from MTBMBP, an ssh connection is always available, regardless of wifi availability.
After a secure X connection si performed, the itinerant wifi connection can be established:
MTBMBP:~ mbarrow$ xhost +
mbarrow@vinophonics:~$ export DISPLAY=192.168.1.39:0.0
mbarrow@vinophonics:~$ nm-connection-editor
Installing CIFS/Samba support
By default, Raspbian does not include CIFS/Samba support, but this can easily be added. The following commmands will install all the required components for using Samba as a server or a client.