HowTo Setup Sensor and IOT Gateway

Agenda

  • List of Hardware
  • Install SlapOS on Olimex Hardware
  • Configure Envioremental Sensor

 

This tutorial teaches how to setup streaming hardware using two Olimex boards.

One board will be connected to the sensor and the second one will serve as an IoT-Gateway.

Note :  If the name of the slide starts with '2 *' do the action on both boards.

 

Shopping List

Item
Quantity
Required
2
Yes
1
Yes
2
Yes
Micro SD Card >= 16GB
2
Yes
LAN Switch
1
Yes
LAN Cables
3
Yes
Keyboard
1
Yes
HDMI cable + monitor
1
Yes

 

List of required and recommended hardware. 

Item
Quantity
Required
Wireless Router
1
No
2
No
External USB hub – to split the USB_HOST mounted on the board; you need that to connect more USB devices
1
No
USB-SERIAL-CABLE-F – for Android/Linux debugging on UART0
1
No
CABLE-IDC40-15cm – cable used for LCD_CON ↔ Olimex LCD display
1
No

 

2 * A20-OLinuXino-LIME2

You can order the boards from here.

The first board will be connected to the sensor and the second one will be served as IoT-Gateway. Data from the sensor will be sent to IoT-Gateway and from there to Wendelin. 

Follow instructions in User's Manual to connect to the board and after that follow SlapOS Tutorial - Installing SlapOS Node (Comp-123) to install SlapOS on the boards. Installation process is the same for both boards. 

2 * Prepare microSD Card

Download the latest Debian-based image to both microSD cards.

At the time of writing this tutorial the latest Debian-based image we used is bullseye.

Using p7zip unzip the downloaded Image


p7zip -d A20-OLinuXino-bullseye-base-20211130-145129.img.7z

After that use Etcher or any other software to burn the image to the microSD cards. 

2 * Login to Board

Insert microSD card to in the corresponding slot of the board. 

Connect LAN cable, keyboard and HDMI cable. When all the components are connected plug in the power supply. 

You will be asked to login to system. Use the login and password provided in the documentation of the board. 

At the time of writing this tutorial it is olimex olimex (in case this doesn't work it may have changed already: please consult the Olimex documentation).

If login is successful you will be asked to change the password. 

To check if you are connected to internet do 

ping google.com

Install Re6st, SlapOS and other dependencies on the boards

Now we will install the software dependencies. Until this point all the actions were the same for both boards. As it was mentioned before, one board serves as an IoT Gateway and the other one is used as a sensor. Both boards need slightly different software. 

Note: If during installation you realize you want to have more information regarding the installation of Re6st or SlapOS you can consult this tutorial which explains more broadly how to install a SlapOS node.

Install software dependencies for IoT gateway

Run the following commands on the board which will be your IoT Gateway:

sudo su -
wget https://deploy.erp5.net/wendelin-olimex.iot.gateway && bash wendelin-olimex.iot.gateway

This will install Re6st and SlapOS on your board. During the installation you will be asked several questions:

What is the url to the Re6st registry? (Ignore if you are using a FREEFIB Token from rapid.space) [http://re6stnet.gnet.erp5.cn/]:

In case you want to use a free token you can simply ignore this.

Please insert your re6stnet token: [notoken]:

If you want to use a free token you can get one in the rapid.space panel by clicking on "Get Re6st Token!". Wait few minutes until the connection parameters appear and then enter the provided token.

The next two question can also be ignored if you want to use rapid.space as your SlapOS master (simply press enter):

What is the url to the SlapOS Master API?  (ignore if you already have a configured re6st and slapos): [https://slap.vifib.com/]:

What is the url to the SlapOS Master Website?  (ignore if you already have a configured re6st and slapos): [https://panel.rapid.space/]:

In this question you can enter the name for your computer. This is the name which will appear in the SlapOS Master panel. You may want to choose a name which makes it easy for you to recognize the respective board (for example "Wendelin-Olimex-IoT-Gateway"):

Name your computer (ignore if you already have a configured re6st and slapos or if you don't want to register your computer to SlapOS Master): [noname]:

To answer this question you can go to the "Servers" tab in the panel of your SlapOS Master (e.g. rapid.space) and click on "Token". Then enter the received token in the terminal.

Input your slapos token (ignore if you already have a configured slapos) [notoken]:

You can ignore the next question (because you will use Re6st):

Which interface will provide IPv6? (ignore if you already have a configured re6st) [lo]:

The last setting can also be left to the default value (simply press enter):

How many SlapOS computer partitions would you like? [10]:

Now you will have to wait until the installation is finished.

To ensure the installation was successful you can run:

slapos node status

This should return something similar to:

watchdog                         RUNNING   pid 8936, uptime 0:02:36

Your IoT Gateway is ready now

Install software dependencies for Sensor

Run the following commands on the board which will be your Sensor:

sudo su -
wget https://deploy.erp5.net/wendelin-olimex.sensor && bash wendelin-olimex.sensor

The script will ask you the same questions as previously. You will have to create new tokens.

Connect MOD_ENV sensor to the Board

You can order the sensor from here.

Connect MOD_ENV sensor to the Board Cont.

Connect the sensor to the board on which you installed the sensor software dependencies. You can see in the image where to plug in your sensor.

2 * Prepare SlapOS configuration for fast installation of Fluentd

Before continuing to the installation of Fluentd we have to adjust SlapOS to ensure it will download Fluentd from shacache instead of compiling it by itself. You should do this step on both of your boards, the sensor and the IoT gateway.

Open the file /etc/opt/slapos/slapos.cfg. Go down until you find the following section:

#download-from-binary-cache-force-url-list =
#  https://lab.nexedi.com/nexedi/slapos/raw/1.0.
#  https://lab.node.vifib.com/nexedi/slapos/raw/1.0.

Uncomment these three lines, so that it looks like this:

download-from-binary-cache-force-url-list =
  https://lab.nexedi.com/nexedi/slapos/raw/1.0.
  https://lab.node.vifib.com/nexedi/slapos/raw/1.0.

Then save the file and proceed to the next tutorial in the learning track.

Note: The reason why this change is necessary is because shacache runs only 8 threads. So when all threads all already occupied, SlapOS is not able to download binaries and decides to compile everything. This behaviour is quite acceptable for most cases but not for Single Board Computers so you should force SlapOS to retry to download binaries from shacache until it succeeds (or find that the SR is not available in shacache).

Troubleshooting

 

In case you run into an error during the software installation (or when installing Fluentd in the next step), you can try the following solutions: deactivate firewall, restart re6stnet

 

Deactivate firewall

The deploy scripts which install all necessary software dependencies will activate a firewall to ensure that only the necessary connections are allowed. When making a mistake during the installation and when trying to redo the installation process it may be necessary to first disable the firewall in order to make a successful installation. You can run the following script to deactivate all firewall settings.

#!/usr/bin/bash

# Set default policy to accept
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT

ip6tables -P INPUT ACCEPT
ip6tables -P OUTPUT ACCEPT
ip6tables -P FORWARD ACCEPT

# Flush all existing rules
iptables -F
ip6tables -F

You can manually reactivate the firewall with the following command:

sudo setup-olimex-firewall

Restart re6stnet

If the firewall is already activated and you try to reinstall the software it happens that re6stnet won't function properly anymore. You can check if your board has an ipv6 address with the following command:

hostname -I

If there is only an ipv4 address it may help to first deactivate the firewall and then restart the re6stnet service:

sudo service re6stnet restart

Afterwards you can reactivate the firewall

Thank You

  • Nexedi SA
  • 147 Rue du Ballon
  • 59110 La Madeleine
  • France
  • +33629024425

For more information, please contact Jean-Paul, CEO of Nexedi (+33 629 02 44 25).