ORCA-TN-003 — Automated test equipment (ATE) monitoring with ORCA SBC, ThingsBoard IoT, and Fledge

From DAVE Developer's Wiki
Revision as of 14:01, 19 April 2023 by U0001 (talk | contribs) (Introduction)

Jump to: navigation, search
Info Box

History[edit | edit source]

Version Date Notes
1.0.0 April 2023 First public release

Introduction[edit | edit source]

This Technical Note (TN for short) illustrates the same application described here with some notable differences:

  • The edge device is Orca SBC instead of SBCSPG gateway.
  • Fledge and Fledge GUI were not installed by using apt. They were built on the target instead, even though the Linux distribution is still Debian 11. This approach may be more suited to address different situations. For instance, think about the case in which you have to develop new functionalities or test custom north/south plugins. At large, this set-up allows to develop the code on a PC host running the same distribution, and to migrate to the target later on when it is already tested and debugged thoroughly.
  • As the target platform features an HDMI port, Fledge GUI can be displayed locally, too. This solution can be convenient for building products that require a local display without having to implement a new graphics application. Interestingly, this HDMI port is provided by a LVDS/HDMI bridge that, in turn, is connected to the LVDS native port of the i.MX8M Plus SoC.

Building and running Fledge and Fledge GUI[edit | edit source]

For convenience, sshd was set up in order to access the target remotely over SSH connections. This step is not strictly necessary, but it is recommended because it allows to work more effectively as shown in the rest of the article.

Furtehrmore, armbian user was added to the sudoers file as Fledge may require root privileges to execute some operations. As we are working in a development environment, this can be tolerated.

Fledge and Fledge GUI were built starting from the develop of their respective GitHub repositories.

 
armbian@sbcorca-00a5:~/devel/fledge$ git clone https://github.com/fledge-iot/fledge.git
...
armbian@sbcorca-00a5:~/devel/fledge$ cd fledge
armbian@sbcorca-00a5:~/devel/fledge/fledge$ make
Building Fledge version 2.1.0, DB schema 60
...
uccessfully built cchardet pyjq
Installing collected packages: pyjwt, pyjq, ifaddr, cchardet, zeroconf, urllib3, multidict, idna, frozenlist, charset-normalizer, certifi, attrs, async-timeout, yarl, requests, aiosignal, requests-toolbelt, aiohttp, aiohttp_cors
Successfully installed aiohttp-3.8.1 aiohttp_cors-0.7.0 aiosignal-1.3.1 async-timeout-4.0.2 attrs-23.1.0 cchardet-2.1.7 certifi-2022.12.7 charset-normalizer-2.1.1 frozenlist-1.3.3 idna-3.4 ifaddr-0.2.0 multidict-6.0.4 pyjq-2.5.1 pyjwt-1.6.4 requests-2.28.2 requests-toolbelt-0.9.1 urllib3-1.26.15 yarl-1.7.2 zeroconf-0.27.0

[notice] A new release of pip is available: 23.0.1 -> 23.1
[notice] To update, run: python3 -m pip install --upgrade pip
armbian@sbcorca-00a5:~/devel/fledge/fledge$ export FLEDGE_ROOT=/home/armbian/devel/fledge/fledge
armbian@sbcorca-00a5:~/devel/fledge/fledge$ $FLEDGE_ROOT/scripts/fledge stop ; $FLEDGE_ROOT/scripts/fledge start
It looks like Fledge is not running.
Starting Fledge v2.1.0.......
Fledge started.
 
armbian@sbcorca-00a5:~/devel/fledge$ cd fledge-gui
armbian@sbcorca-00a5:~/devel/fledge/fledge-gui$ yarn install && yarn start --host 0.0.0.0 --port 4200
yarn install v1.22.19
[1/4] Resolving packages...
armbian@sbcorca-00a5:~/devel/fledge$ git clone https://github.com/fledge-iot/fledge-gui.git
...
Build at: 2023-04-18T16:04:36.723Z - Hash: b7cd6cc33931ce39 - Time: 98000ms

** Angular Live Development Server is listening on 0.0.0.0:4200, open your browser on http://localhost:4200/ **


✔ Compiled successfully.

As stated previously, SSH connections are very convenient when it comes to interact with the target platform during the software development. The following screenshot shows, for example, four active connections used to start Fledge, start Fledge GUI, monitor processor load/memory occupation, and monitor system logs.

Multiple SSH open connections

SSH can also be used to configure VSCode for remote development as illustrated here. This set-up is very useful to explore/edit source code remotely, for instance.

VSCode configured for remote development

On the ThingsBoard IoT platform side, we can verify that data is uploaded from the target as expected:

Verifying that data is uploaded to the ThingsBoard IoT platform

Visualize Fledge GUI on a local display[edit | edit source]

To visualize the GUI on a local display, we run a web browser configured to operate in kiosk mode.


 
armbian@sbcorca-00a5:~$ sudo apt update
Hit:1 http://deb.debian.org/debian bullseye InRelease
...
armbian@sbcorca-00a5:~$ sudo apt-get install weston
...


[Unit] Description=Weston wayland compositor After=systemd-logind.service

  1. D-Bus is necessary for contacting logind. Logind is required.

Wants=dbus.socket After=dbus.socket Before=graphical.target

[Service] Type=oneshot EnvironmentFile=/etc/default/weston ExecStart=/usr/bin/weston --shell=kiosk-shell.so

  1. The user to run Weston as.

User=root Group=root

  1. Make sure the working directory is the users home directory

WorkingDirectory=/root/weston

  1. Set up a full user session for the user, required by Weston.

PAMName=weston-autologin

  1. A virtual terminal is needed.

TTYPath=/dev/tty7 TTYReset=yes TTYVHangup=yes TTYVTDisallocate=yes

[Install] WantedBy=graphical.target

/lib/systemd/system/weston.service


armbian@sbcorca-00a5:~$ sudo touch /etc/default/weston armbian@sbcorca-00a5:~$ sudo mkdir /root/weston armbian@sbcorca-00a5:~$ sudo systemctl enable weston Created symlink /etc/systemd/system/graphical.target.wants/weston.service → /lib/systemd/system/weston.service. armbian@sbcorca-00a5:~$ sudo systemctl start weston


armbian@sbcorca-00a5:~$ sudo apt-get install chromium
Reading package lists... Done
...
/lib/systemd/system/browser.service
armbian@sbcorca-00a5:~$ sudo systemctl enable browser
Created symlink /etc/systemd/system/graphical.target.wants/browser.service → /lib/systemd/system/browser.service.
armbian@sbcorca-00a5:~$ sudo systemctl start browser

TBD