Fledge is an open source framework and community for the industrial edge focused on critical operations, predictive maintenance, situational awareness and safety. Fledge is architected to integrate Industrial Internet of Things (IIoT), sensors and modern machines with the cloud and existing “brown field” systems like historians, DCS (Distributed Control Systems), PLC (Program Logic Controllers) and SCADA (Supervisory Control and Data Acquisition). All sharing a common set of administration and application APIs.
I wanted to give Fledge a try to see how one can bring an open-source IoT/IIoT Stack to a quick realization.
Device: Raspberry Pi 4 Model B
Spec: 2GB RAM, 32GB Micro SD Card
Operating System: Ubuntu LTS 20.04.2
I am going to just clone stuff in my home directory
Clone the fledge Repository
$ git clone https://github.com/fledge-iot/fledge.git && cd fledge/
Install the Dependencies (in the root directory of fledge)
$ sudo ./requirements.sh
Let's install fledge on the Pi
$ sudo make install
grab something to munch on till the installation is complete
The installation will add the files and binaries in to the following directory:
/usr/local/fledge/. You can export this path:
$ export FLEDGE=/usr/local/fledge
start Fledge and check the status using the following:
$ $FLEDGE/bin/fledge start $ $FLEDGE/bin/fledge status
Checkout the Fledge UI by hitting the Pi's IP Address:
At this point of time, Fledge is very bare-metal which implies there are lot of plugins that are missing. We begin by installing a very basic simulated plugin.
Since we are doing things by source, we need to clone the plugin repository. We start with a very basic
sinusoidal South Plugin which will generate sine waves to the Fledge Core.
$ cd $ git clone https://github.com/fledge-iot/fledge-south-sinusoid.git && cd fledge-south-sinusoid/
we just need to copy the source code of the sine-wave generator to the directory path of plugins for Fledge
$ # we are currently in the root directory of fledge-south-sinusoid $ sudo cp -r python/fledge/plugins/south/sinusoid $FLEDGE/python/fledge/plugins/south
You can refresh the UI and click on the South Menu and you will be able to see
sinusoid as a South Plugin
Let's get one more Plugin into Fledge: CoAP plugin
$ cd $ git clone https://github.com/fledge-iot/fledge-south-coap.git && cd fledge-south-coap/
Let's copy the plugin's code to Fledge as we did previously
$ # we are currently in the root directory of fledge-south-coap $ sudo cp -r python/fledge/plugins/south/coap $FLEDGE/python/fledge/plugins/south
Copy the python dependencies that are necessary to execute the plugin and install them:
$ sudo cp -r python/requirements-coap.txt $FLEDGE/python/ $ sudo pip3 - r $FLEDGE/python/requirements-coap.txt
Since the code is in the
/usr/local/directory we need to provide root privileges to the coap plugin for execution by the Fledge Core
$ sudo chown -R root:root $FLEDGE/python/fledge/plugins/south/coap
That's it ! Now you have we two South Plugins in our Fledge Application that can provide us some simulated data!
Your UI South Menu should look like the following:
Let's setup the Sine-Wave Generator by naming it
test-sine-southand click Next
Name the Asset Name. We name it
Make sure to enable the plugin by checking the Enabled checkbox and finally click Done
On the UI you now see the Sinusoid Plugin Enabled with active readings being fed into the Fledge Core. You can click on the link
test-sine-south to change the configuration of the plugin / delete it or export readings to a file.
You can click on Assets & Readings Menu and click on the Graph Icon to get some visualization delete it or export readings to a file.
And there you have visualization of the data coming in from your South Plugin, a lovely sine wave. Not practical but you get to understand how the Fledge Architecture would work!
You can click on the Summary tab to get some basic statistics of the information
Let's setup the CoAP South Plugin similarly to Sinusoid by clicking on the + Add button on the top-right of the Panel under South Page
Call the service
test-coap-southand click Next
In the next step keep the configuration as it is for now i.e. Port as
5683and the URI as
sensor-valuesand click Next and enable the plugin on the last setup.
This should enable the CoAP Plugin for Fledge and it's time to generated some CoAP data from a simulated client to a CoAP Server running on the Pi.
Fledge does provide some testing information for CoAP in the core directory under the the CLI called
Let's generate some CoAP data on the Pi.
$FLEDGE/bin/fogbench -t $FLEDGE/data/extras/fogbench/fogbench_sensor_coap.template.json -I 100
-t flag is for mentioning a template and we use a coap template provided by Fledge mentioned above.
-I is the time interval
Upon executing the command on the Pi, you can check the UI which will generate the following output for the CoAP Plugin.
You can explore the Assets and Visualization by going to Assets & Readings and clicking on any of the asset you wish to observe.
NOTE: In order to visualize live-data you can run the
fogbenchcommand above a couple of more times.
The sine wave isn't that cool to look at to so let's get some Frequency Domain Analysis on it with a Fast Fourier Transform on it using Fledge's FFT filter plugin
Let's clone the plugin in the home directory
$ cd $ git clone https://github.com/fledge-iot/fledge-filter-fft.git && cd fledge-filter-fft/
This plugin is not python based so we need to do some tasks for installing it. We export a
FLEDGE_ROOTvariable and create a
builddirectory in the root of the repo
$ # we export the directory where we built Fledge for the filter plugin to use $ export FLEDGE_ROOT=~/fledge/ $ # in the root of the `fledge-filter-fft` repo $ mkdir build && cd build/
compile the plugin
$ cmake ..
install the plugin
$ sudo make install
Now you have the FFT plugin ready to be applied in Fledge
Let's head back to the South Plugins in the UI and click on the
Click on the Applications menu for the Service
fftfrom the available plugins and name the service
Setup the Service to conduct filtering on the asset called
sine-wave-asset(See steps to setup Sinusoid Plugin) and other parameters as shown below (no fine tuning done here). Don't forget to click the Enabled checkbox and finally Done
The Fast Fourier Transform might take some time to show up but you can head to Assets & Readings and click on the
sine-wave-asset FFT's Graph Icon to see some visualizations. This is what mine look like
Great stuff. Imagine having vibration sensors and you need to conduct FFT analyses on it! Fledge makes it nifty!!