elapsed, the pump mode (exposition or recovery) is
changed and the pump timer is reset. The temperature
and humidity values are acquired and saved at defined
periods. This process is repeated in each iteration,
ending when the duration of the experiment session
has elapsed.
2.3.2 Network Layer
In order to make the system as scalable as possible,
each acquisition module must be able to easily con-
nect to the NAS and to the user.
First, the NAS, Raspberry Pi systems, and the user
must be connected to the same network, in this case
the internal LAN of the laboratory. By being con-
nected to the same LAN, it makes it easier for all the
devices to see and be seen by the rest of the hardware
components.
With all the components connected to the same
LAN, the IP of both the NAS and the Raspberry Pi
systems must be set to a static IP in order to make the
connection easier. In the case of the Raspberry Pi’s,
the static IP also gives a unique ID to each of them.
In order to access the NAS, each Raspberry Pi
auto-mounts the folders in the shared folders direc-
tory via the network file system (NFS) protocol. Each
Raspberry Pi connects to a particular folder in the
NAS to save the data acquired and to a common folder
containing the Excel file. Each Raspberry Pi folder is
named using its own IP, e.g., eNose108 is the NAS
folder where the Raspberry Pi with the 108 ending IP
connects to. The user also mounts the NAS folders in
his/hers computer in order to access the files for set-
ting up, controlling and visualizing the experiments.
To communicate with the Raspberry Pi ’s via a PC,
the secure shell (SSH) protocol was used. In order to
use this protocol in python, the paramiko library was
used. This library implements the SSHv2 protocol.
This library is used to run the data acquisition script,
query the Raspberry Pi if there is any script running
and to stop the script if the user deems necessary.
2.3.3 Interface, Control and Visualization
In order to ease the management of the experiment,
an user interface has been built using a python GUI
library, TKinter. The interface runs in the personal
computer of the user and coordinates all the processes
that run during the experiment, namely the main pro-
cess that controls the Arduino and runs on the Rasp-
berry Pi, and the visualization process which also runs
in the personal computer of the user. This interaction
is also possible because the interface is connected to
the Raspberry Pi by SSH.
As mentioned in the previous section, each E-nose
system is associated to its corresponding Raspberry Pi
ID. The interface will also be linked to that specific ID
in order to check, every time it is started, if any exper-
iment session is already running in the corresponding
Raspberry Pi. If so, the main page of the interface will
be frame B (see Figure 4), where all the characteris-
tics of the experiment are shown as disabled, whereas
in Figure 3, is represented the main page of the inter-
face, in which would appear enabled for the user to
interact with.
The main page enables the user to configure the
conditions in which the experiment will be conducted.
The first appearance shows a default configuration,
which can be changed according to the needs of the
user. Each entry is verified in order to guarantee that
the input text type is valid.
After the configuration is done, the user can press
the button ”Run” to start the experiment session. This
action triggers a new thread which sends a command
via SSH to the Raspberry Pi that runs the python script
that activates the Arduino and runs as demonstrated
in Figure 2. All the remaining buttons and entries are
disabled, except the button ”Stop” which is enabled
and can be pressed by the user to stop the experiment
session if necessary.
The visualization starts automatically when the
”Run” button is pressed by calling a subprocess that
runs the plotting script in the user’s computer. This
part of the software has been developed in Bokeh,
which is a web based python interactive plotting plat-
form.
As the access to data from the NAS can be slow,
the data has been saved in multiple temporary files
with 100 samples, which are accessed and read by the
plotting process and erased afterwards.
During the experiment the data is acquired and
plotted. When the experiment finishes, all the pro-
cesses are stopped.
The interface and the processes that are launched
are completely independent. If the interface is closed,
the main process that controls the Arduino will still
be active, as well as the visualization subprocess. This
procedure guarantees that the experiment does not fail
by means of any unexpected occurrence.
This independence is also relevant for the scala-
bility of the system, since all the scripts are separated
into specific blocks, it will be easier to use what is
necessary for any future improvement and upgrade of
the system.
2.3.4 Database and Data File Structure
The name of the files where the data from the exper-
iments are stored has itself information about the ex-
BIODEVICES 2018 - 11th International Conference on Biomedical Electronics and Devices
182