Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Next step after using S-Soil MTEC-02B sensor in Milestone 2: Outdoor single sensor and saving telemetry data via Fledge software framework we are going to setup a framework where developers can add new sensors from scratch and build a new software stack to provide secure, private, zero-touch deployments to a subset of Edge Nodes (IoT devices).
RPi4 board will be used as Edge Node.

Deployments are distributed via completely customised Edge Server and can be deployed locally on developer workstation, in cloud infrastructure or on premises.

All components are open sourced and can be reconfigured and customised, interested parties may use any cloud infrastructure which support containerised servers deployments i.e. GCP, AWS, Azure, IBM Cloud, Alibaba Cloud, Digital Ocean, Oracle Cloud, VMware Cloud, Cisco Cloud.

In this case the containerised services software is deployed with Open Horizon to RPi4 board.

Image Added

Goals

  1. Build OS image with BSP distribution for Edge Node and save it to SD card. Insert SD card with BSP to RPi4 board and start controlling the board remotely.
    [~10 minutes]

  2. Run local Edge Server on developer workstation with all needed services for software development and zero touch deployment.
    [~3 minutes]
     
  3. Connect/solder S-Soil MTEC-02B with USB to RS485 converter and insert into RPi4 board.

  4. Build a custom stack for S-Soil MTEC-02B to extract realtime data - Total Dissolved Solids (TDS), Temperature, Salinity, Volumetric Water Content (VWC) with python script, send data to Edge Server with Telegraf.
    Deploy new stack remotely without touching the board to Edge Node (RPi4 board) from developer workstation.
    Edge Server will collect data
    in InfluxDB and telemetry data will be available to display Grafana dashboard.
    [~4 minutes]

  5. Update stack on developer workstation and redeploy stack into the Edge Node remotely.
    [~3 minutes]

Prerequisites

Hardware

  1. Raspberry Pi4 model B 4GB+ RAM 
  2. Industrial Soil Moisture & Temperature & EC Sensor MODBUS-RTU RS485 (S-Soil MTEC-02B)
  3. 16+ GB micro SD Card
  4. Power supply for Raspberry Pi 4
  5. SD card reader
  6. x64 (development workstation)
  7. USB to RS485 converter (or similar like USB-RS485-WE-1800-BT)

Software

MacOS/Linux based developer host with installed Docker Desktop (TBD: add OCI compatible alternatives)
Image Added

Containerised Architecture has been selected to build an isolated software components for Edge NodeEdge Server as well as for development and deployment tools.
It can be used without restriction, including without limitation to build isolated proprietary ecosystem for IIoT device management and zero-touch secure device onboard.

In this milestone container images are based on open source components to display, debug and analyse data from Edge Node with connected S-Soil MTEC-02B sensor.

From the software components structure of IoT device there are static BSP image and dynamic services which are deployed remotely to Edge Server and downloaded by Edge Nodes.
Stack services are managed by Edge Server and deployed automatically to device fleet according to business policies rules (deployment by edge node id is presented in this example) after device has been onboarded.
Edge Node should be pre-configured with BSP image, so the device could update itself after the boot and later when new services are uploaded and published.

The stack consist of one or more preconfigured and tested software components which are running in isolated containers on the board and managed by Deployment Agent.

To provide more secure board management none IP ports are exposed from the board outside in production (this is configured when initial BSP image for the board is created).

Development tools is a docker image it's intended to:

  • Create initial BSP image and write it to SD card
  • Run EdgeServer with Open Horizon services, Grafana, InfluxDB, Loki and onboard the Edge Device
  • Create initial stack for development and further deployment to Edge Device
  • Deploy stack on Edge Device by using business policy rule (Edge Device name as an example)

A single Edge Server (based on Open Horizon) may manage/update more than 10k of clusters or stand alone IoT devices acting as Edge Nodes.
Each Edge Node may control a dozens of wired or wireless Edge Devices (Arduino, STM32, ESP32, etc.) or sensors directly.

Here is a top view of ecosystem:

Image Added


Also with added AI services, Edge Node may act as distributed AI node with federated learning capabilities.

Here is how the system components are deployed and updated:

1. Create OS image with BSP installed and create disk image to be used in Edge Node

2. Deploy and run Edge Server

3. Update software stack on the Edge Node by building container images, uploading them to private registry server
(or public registry available via DockerHubAmazon ECR, Google GCRMicrosoft ACR, etc.)

Image Added

An Edge Node software stack can be any set of:

  • Proprietary/open-source containerised services.
  • Integrations with 3rd party services (AWS IoT, GCP IoT CoreParticle, etc.)
  • Complex software frameworks (EdgeX, ORRAFledge, etc.) with own architecture, services stack, software updates and management tools.

Some open source data exporters to consider are - telegraf, node-exporter, statsd, tcollector, collectd, cadvisor, promtail.

Stack can be single or multiple containerised services working together and incorporating designed business logic.

Image Added

Steps to configure

In this milestone, we cover:

  • How to start and run the system from scratch
  • How to start your own customised solution 
  • How to update RPi4 board running all needed tools locally

...

To create an initial BSP image in SD card for the RPi4 board, where you can deploy your own services to support sensors.
Download OS image from here, copy file to SmartAg-foundation/tools/os.img
Insert SD card and run:
./write_bsp_image node_name
(node_name can be any suitable name for Edge node and will be used later to deploy the services)

Links

...

Goals

  1. Start system from scratch with ability to extend it with new services.

System Diagram

...

  1. Clone SmartAg-foundation repo. And change directory to tools.

  2. Build BSP image, write to SD card. Insert 16GB+ SD card in drive and run Edge Node

    sudo ./write_bsp_image example-edge-node

    Image Added

  3. Run Edge Server

    ./start_local_edgeserver 


    Image Added

  4. Solder sensor and USB converter (described in p.6 from Milestone 2: Outdoor single sensor)

  5. Create new example stack. By default new stack will contain a workable solution with telegraf and exec plugin for S-Soil MTEC-02B.

    ./create_stack ssoil-mtec-02b-single


    Image Added

  6. Insert sensor to USB port of Edge Node

  7. Build stack to get retrieve data (Total Dissolved Solids (TDS), Temperature, Volumetric Water Content (VWC)) from S-Soil MTEC-02B, deploy

    ./build_and_deploy ssoil-mtec-02b-single example-edge-node


    Image Added

  8. Open Grafana from Edge Server http://localhost:3000/, login, explore and display telemetry data
    Once InfluxDB data source needs to be configured as below:
    URL - http://influxdb:8086

    Database - telegraf

    User - user

    Password - password
    And press "Save and Test"

    Image Added

  9. Open Explore tab (http://localhost:3000/explore)
    You should see new measurement mtec-02b-sensor and fields for it (tds, temperature, vwc)

    Image Added


    Image Added


  10. (Optional) Extend service with new logic to read soil salinity - check how to do it in this part of video https://youtu.be/mCqbzVYJyVs?t=1306
    Deploy and view new data on a dashboard (salinity should be available)