Subject: Best Practices in Communication Networks II (PKS II), Department of Telecommunications, Faculty of electrical engineering and computer science, VSB-TUO.

Name: Bc. Kryštof Šara (SAR0130)

Date of presentation: October 25, 2024

introduction

In the field of monitoring, the vizualisation tools are vital for the human operators to analyze the currect situation on the network, hardware or in the system, and to decide on the operation being executed next.

implementation

used hardware and software

  • Raspberry Pi 4B 8GB + GPIO
  • simple breadboard and wires
  • VISHAY BPV10NF photodiode
  • rrdtool

wiring up

Fig. 1: Raspberry Pi 4B GPIO Pinout scheme.

For the purpose of wiring the photodiode up with the Raspberry Pi desk computer, we are going to use GPIO (General Purpose Input/Output). The pinout scheme is shown in the figure 1. For the purpose of interconnection, pins 17 (3V3) and 37 (GPIO 26) are to be used.

installation

Next part deals with the data collection, storing and vizualisation. For this purpose, the rrdtool will be used.

To start using the RRDTool, one has to perform an installation at first. We need to update the repository package list before that to ensure we have the latest package database. Possibly we could upgrade the system too before installing a new software as it is the recommended procedure.

1
2
apt update
apt upgrade

From here, we can now install the rrdtool itself. The main metapackage contains all the necessary tooling, so we don’t need to install anything else now. [1]

1
apt install rrdtool

RRDTool

We need to create a RRDB database file first:

1
rrdtool create ./photodiode.rrd --step 10 DS:value:GAUGE:60:0:U RRA:LAST:0.5:1:50

data collection script

The data collection itself is carried out using the simple shell script which periodivally updates the RRDB database file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#!/bin/sh

DIODE=$(python ./photodiode.py)

while true
do
	rrdtool update ./photodiode.rrd N:$DIODE
	#rrdtool graph photodiode.png -s now-300 -e now DEF:value=photodiode.rrd:value:LAST LINE:value#0000ff
	sleep 5
done

data source

The data values stored in the database file come from the simple python3 script to operate the GPIO interface of the Raspberry Pi 4B desk computer.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/python3

import RPi.GPIO as GPIO
import time
import sys

pin_diode = 26

GPIO.setmode( GPIO.BCM )

GPIO.setup( pin_diode, GPIO.IN )

try:
        #if ( GPIO.input( pin_diode ) > 0 ):	    
        print( GPIO.input( pin_diode ) )
        #else:
            #print(0)

        time.sleep( 0.300 )

finally:
    GPIO.cleanup()

sys.exit(0)

visualization

Unfortunately, I did not succeed in measing of the light intensity directly, so decided to use the photodiode to catch the Morse code recording.

For this purpose I periodically covered and uncovered the breadboard with the photodiode circuit to demonstrate ups (high voltage) and downs (low voltage).

Fig. 2: A PKS sign encoded into the Morse code in rrdtool-generated graph.

Fig. 3: International Morse code specification. [2]

conclusion

Visualization is the key part of monitoring, analyzing and reacting to incidents in the telecommunications. Tools like RRDTool are one of the simpliest ones, still, they are widely used and utilized in the core networking overviews and in the networking stats too.

references

reference numberreference content
[1]NEVLUD, Pavel. Komunikační sítě II pro integrovanou výuku VUT a VŠB-TUO. Ostrava: 2014. Katedra telekomunikační techniky, Vysoká škola báňská-Technická univerzita Ostrava.
[2]https://en.wikipedia.org/wiki/Morse_code