Page tree
Skip to end of metadata
Go to start of metadata

Assembling (List)

To assemble the system we need:


Raspberry pi model 3 B+35,30 €
Heatsink and fan pack5,99 €
MicroSDXC Card17,59 €
DHT224,20 €
MicroUSB Charger9,99 €
LCD 16x02 Display2,95 €
Potentiometer2,75 €
Total78,77 €

PoC Assembling (List)

For the PoC assemble we'll need:


Protoboard4,50 €
Dupont wires2,45 €
Pin headers3,24 €
Tin welder9,95 €
Tin8,79 €
Total28,93 €

PoC Assembling

The first step we should take on is to place the heatsink and the fan. To do so we unpack following parts (raspberry pi, DHT22, heatsink and fan):

Once we have the parts prepared to install we can install the DHT22 taking into account the following gpio pin description from

GPIO layout

So we going to connect the input to pin 1, the output to pin 4 and the ground to pin 5 as follows. In our case the orange wire is the voltage input one, the red one the output pin and the brown one representing ground. In this image we can also see how we've placed the heatsinks.

Finally we have have to assemble the fan. To do so and  just for this PoC (this will change in a future assembling method as the box will be changed) we have attached it to a raspberry box as follows and we have connected its cables to pin 13 and 14:

To end the assembling procedure we just close the box used (remember this is just for the PoC, so no documentation of the box is given) with the 4 screws given by the provider. The final result is:

Install and init the OS

Download the Raspbian Stretch Lite OS as zip file from: or use the following command

computer$ wget
computer$ unzip raspbian_lite_latest 

Introduce the micro sd on the computer and check its identifier:

computer$ diskutil list

Unmount the disk to prepare it for the image installation:

computer$ diskutil unmountDisk /dev/disk2

Install the latest raspbian image that you have unzipped:

computer$ sudo dd bs=1m if=2019-07-10-raspbian-buster-lite.img of=/dev/disk2

(Extra possibility) To work directly with ssh we can create a ssh file in the boot directory and it will allow ssh connections:

computer$ touch /Volumes/boot/ssh

Eject the micro sd safely:

computer$ diskutil eject /dev/disk2

Ensure that your RPi is powered off. Insert the SD card on you RPi, connect the ethernet cable and power on the device. Your RPi will boot the image. Log in the RPi with the default credential is (Alternatively you can connect directly to the raspberry pi in case you don't have access to an ethernet cable but you'll need a screen and a keyboard) :

computer$ ssh pi@ [password: raspberry]

The RPi needs to be configured:

  • Change the keyboard layout (if required)
  • Set the timezone: required to allow a blockchain synchronisation between nodes
  • Enable SSH: securely access your RPi from your computer.

pi$ sudo raspi-config 
1) Timezone can be changed from the option "Internationalisation Options" and "Change Timezone".
2) Keyboard layout can be changed from the option "Internationalisation Options" and "Change Keyboard Layout". 
3) SSH can be enabled from the option "Advanced Options" then "SSH". 

When everything has been modified, reboot the raspberry to apply changes:

pi$ sudo reboot

Finally when the system has rebooted, change the password for the user pi:

pi$ passwd

(Only if using Wi-Fi) Setup your Wi-Fi interface:

pi$ sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

(Only if using Wi-Fi)  Change the country code to set yours and add the following lines at the end of the file:

 ssid="SSID of you network"
 psk="Password of your network"

When everything has been modified, reboot the raspberry to apply changes:

pi$ sudo reboot

Find the private ip of your raspberry pi to connect via ssh to it.

pi$ ifconfig
computer$ ssh pi@"ip of your raspberry"

Finally to change the root password we just use the following command:

pi$ sudo passwd root

Update apt-get

Before starting to set up everything we'll make sure we have the last version of apt-get installed by:

pi$ sudo apt-get update
pi$ sudo apt-get upgrade

Install npm and nodejs

We'll also need to install the javascript npm package manager and installer:

pi$ sudo apt-get install nodejs npm

Install git

In order to be able to clone git repositories we must install the git toolkit, to do so:

pi$ sudo apt-get install git

Install geth

To run a local node connected to the Costaflores private network an Ethereum client is necessary. In this case we'll use geth to set it up, other clients such as Parity can be used too. To install it we need to know the type of cpu we are using:

pi$ cat /proc/cpuinfo
model name : ARMv7 Processor rev 4 (v7l)

Select the geth instance you want to install from and retrieve the package from the raspberry:

pi$ wget
pi$ tar zxvf geth-linux-arm7-1.8.20-24d727b6.tar.gz

Copy the Geth application to the /usr/local/bin folder:

pi$ sudo cp geth-linux-arm7-1.8.20-24d727b6/geth /usr/local/bin
pi$ rm -rf g*

Check it was installed correctly:

pi$ geth version

Install node-red

To implement the front-end of the temperature dashboard we will use nodered and its dht22 contributions, to do so, firstly we must install nodered by:

pi$ sudo apt-get install build-essential
pi$ sudo apt-get install nodered

Now that we have installed nodred we will use npm to install the dht22 contributions:

pi$ wget 
pi$ tar zxvf bcm2835-1.58.tar.gz
pi$ cd bcm2835-1.58
pi$ ./configure
pi$ make
pi$ sudo make check
pi$ sudo make install
pi$ sudo npm install --unsafe-perm -g node-dht-sensor
pi$ sudo npm install --unsafe-perm -g node-red-contrib-dht-sensor
pi$ sudo npm install node-red-node-mysql

Finally we test it works by using:

pi$ node-red-start

Once we've checked everything is working correclty we can enable it to run on boot:

pi$ sudo systemctl enable nodered.service

Install MariaDB

In order to have a working database in the raspberry pi we've selected the mariadb sql one. To install it we must:

pi$ sudo apt-get install mariadb-server

Once installed we have to initialise following the instructions displayed when using:

pi$ sudo mysql_secure_installation

Finally we can test it by using:

pi$ sudo mysql -u root

Install python3 package manager and packages

Python comes already installed in the raspbian image so we can use it directly. To work with its packages we'll install the pip3 package manager. To install it:

pi$ sudo apt-get install python3-pip
pi$ sudo python3 -m pip install --upgrade pip setuptools wheel

Once we have python3 and pip3 installed we have to download the following packages:

pi$ sudo pip3 install adafruit-circuitpython-dht
pi$ sudo pip3 install adafruit-circuitpython-charlcd
pi$ sudo pip3 install --upgrade adafruit_blinka
pi$ sudo pip3 install mysql-connector-python
pi$ sudo pip3 install web3

Install and connect to OpenVPN

In order to be able to assure secure communications between nodes, just nodes inside the VPN can connect via HTTP, to do so, we'll install openvpn:

pi$ sudo apt-get install openvpn

Once we have installed openvpn, we must get the vpn config files from the admin. Once received we just have to:

pi$ mkdir vpn
computer$ scp openvino-openvpn.tar pi@
pi$ cd vpn
pi$ tar -xvf openvino_openvpn.tar
pi$ sudo cp * /etc/openvpn/
pi$ sudo openvpn --config /etc/openvpn/mdv-clofw01-TCP4-1195-mbarrow.conf
pi$ sudo systemctl enable openvpn@mdv-clofw01-TCP4-1195-mbarrow

Finally we reboot the system to enable everything we have installed.

pi$ sudo reboot

  • No labels