Table of Contents:

1.  Overview

This is a general instruction for the use of Armbian base OS of Dragino devices. Current models include:

  • HP0A
  • HP0C
  • LPS8v2
  • MS20

 

2.  Development Guide

For advanced users to develop Driver/ Linux etc.

2.1  How to recompile LoRaWAN Concentrator Driver ( dragino-fwd package).

Step 1. Clone dragino-fwd package

Requirements:

 sudo apt install -y libsqlite3-dev

 sudo apt install -y libftdi1-dev

Run command clone dragino-fwd package: git clone https://github.com/dragino/dragino_fwd_src.git

image-20220527151010-1.png

Step 2. Compile dragino_fwd

After cloning is complete, Run the command starts compiling:

Compile HP0C/HP0A fwd:  ./hp0z-make-deb.sh  c

The following example compilers HP0C fwd.

image-20220527153913-3.png

When the compilation is complete a draginofwd-*.deb package is generated.

image-20220527154311-4.png

Step 3. Install the dragino_fwd

Run command:

dpkg -i draginofwd-*.deb 

image-20220527154811-5.png

Step 4. Test

Check the dragino_fwd log:

journalctl -u draginofwd -f

image-20220527165221-7.png

Start/stop dragino_fwd via systemctl:

systemctl start draginofwd

systemctl stop draginofwd

2.2  How to clone Complete OS on the EMMC to SD card

2.3  How to flash SD card to (eMMC) device's built-in Memory

2.3.1 Prepare an SD card with OS

 Preparations:

1. Prepare an SD card and a card reader device

2. Formatting the SD card (Make sure the SD card is empty)

3. Download the OS image from the release.image:  ( File format dragino-lps8v2-1.7.img )

4. A Flash software tool ( Such as v1.7.9 from balenaEtcher )

2.3.2 Flash SD card to device's eMMC

1. Open the device's enclosure, and put the SD card into the SD card slot

2. Power on the device and access the gateway's CLI via the serial port.

3. Login and run the below command to flash.

Run command:

nand-sata-install

image-20220602112051-1.png

Select the "Boot from eMMC - system on eMMC".

image-20220602112058-2.png

image-20220602112106-3.png

Select the "1  ext4"

image-20220602112113-4.png

It takes 4-5 minutes to burn from SD card to eMMC

image-20220602112119-5.png

image-20220602112125-6.png

image-20220602112131-7.png

Note: After the flash is complete, power off the device and then remove the SD card.

2.4 Default Built Version

image-20220902155621-1.png

2.5 How to upgrade the nodejs version to the latest.

By default, the nodejs uses the pre-install version v12 which is due to Debian the ultra-stable via ultra-old.

image-20221112145029-2.png

If you want to upgrade the nodejs to the latest, please follow to use these commands on the gateway CIL.

#install n, which is an Interactively Manage Your Node.js Versions

image-20221112154230-3.png

npm install -g n

#Install the latest LTS Node.js release (downloading if necessary)

image-20221112154418-4.png

n lts

#Remove all downloaded versions except the installed version

image-20221112154456-5.png

n prune

apt remove nodejs -y && apt autoremove -y && reboot

Check the current version

image-20221112154724-6.png

node -v

2.6 How to install Grafana and influxdb

Grafana:

curl https://packages.grafana.com/gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/grafana-archive-keyrings.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/grafana-archive-keyrings.gpg] https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
apt update && apt install grafana

Check the running status:

systemctl status grafana-server

configuration path:

/etc/grafana/grafana.ini

Influxdb:

curl https://repos.influxdata.com/influxdb.key | gpg --dearmor | sudo tee /usr/share/keyrings/influxdb-archive-keyring.gpg >/dev/null
echo "deb [signed-by=/usr/share/keyrings/influxdb-archive-keyring.gpg] https://repos.influxdata.com/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
apt update && apt install influxdb

Check the running status:

systemctl status influxdb

configuration path:

/etc/influxdb/influxdb.conf

2.7 How to install BACnet

wget http://dragino.vicp.io:6080/bacnet/dragino-bacnet-apps-hp0c-2023-03-01.deb
dpkg -i dragino-bacnet-apps-hp0c-2023-03-01.deb

image-20230327152105-1.png

2.7.1 Configure BACnet

After BACnet is installed, run commands to modify BACnet configurations

Note: device_port and bacnet_ip_port are not set to the same

nano /etc/config/bacnet

Examples:

config settings 'general'
    option bacnet_ip '10.130.2.80'                     #The IP address of the BACnetIP network, here basically the same IP as the bbmd address below
    option bacnet_ip_port '47808'                     #As with bbmd_port, the purpose of this is to register a Bacnet Server application as a bbmd registration server
    option bbmd_address '10.130.2.80'             #bbmd is the BACnet registration server. Only one bbmd server is required in the same ip network
    option bbmd_port '47808'                           #In general, 47808 is used as the default port
    option bacnet_dev_count '2'                        #Here is the number of BACnet devices that need to be simulated, if the number is 2, then the following settings must have 2, which are bacdev_1, bacdev_2

config settings 'bacdev_1'
    option device_name 'LHT65N-1'                  #The identification name of the bacnet device
    option device_id '10001'                               #The unique identification code in the same network segment of BACnet,Scope is(1 - 4194302)
    option device_port '47912'                           #The IP port occupied by Bacnet when it starts, Scope is (1024 - 65535)

config settings 'bacdev_2'
    option device_name 'LHT65N-2'         
    option device_id '10002'           
    option device_port '47913'   

2.7.2 Run BACnet

After the configuration is complete, run the following command to start BACnet, The following are two ways to run BACnet:

(1) With /etc/config/bacnet configuration, and to run the registration server on the current machine, start it with the following command (configure the /etc/config/bacnet file correctly):

bacserver  -c -s

(2) Without /etc/config/bacnet, and to run the registration server on the current machine, start it with the following command:

bacserver -s -a 10.130.2.80 -p 47808 

This command simulates two devices, with device IDs 47910 and 47911

Enter bacserver -h to output help

bacserver -h 

image-20230327154700-3.png

2.7.3 Read devices and modify devices

Enter baccli -h to output help

baccli -h 

image-20230327165836-1.png

Examples:

(1) List the current Bacnet devices:

baccli -l -a

image-20230327174537-3.png

(2) List device information based on device ID:

baccli -l -i id

image-20230327174556-4.png

(3) List the device details by device ID:

baccli -l -v -i id

(4) Modify the specified attribute value based on the device ID:

baccli -i id -p prop -w value

image-20230327174853-5.png

The user can check the data of the device by using the yabe BACnet tool

image-20230327171824-2.png

3.  Package Management

3.1  Default Package Maintain System

3.1.1  How Package-Auto-Update works?

By default, LPS8v2 / MS20 series products have an auto-update feature for main packages. The device will connect to Dragino's auto-update server and check for updates.  

When devices will check for updates?

  • Devices will check for updates for every boot.
  • Devices will check for updates on every day midnight.

What packages will be checked for updates?

dragino-httpd -- Main Web UI http configuration

dragino-sid    -- SN write and read tool

dragino-ui     -- Gateway Web UI package

draginofwd   -- UDP packet forwarder, LoRa Base Station

draginoups   -- Miscellaneous between different versions

Location and changelog for packages:

How to view auto-updated log

You can view the log on the page of System --> Package Management.

1661305025451-220.png

Can I disable package-auto-update?

You can check the checkbox and click the ‘SAVE’ button to enable or disable the auto-update.

1661305258501-636.png

3.1.2  How to manually update core packages?

You can click the ‘Manual Update’ to update the dragino's packages.

1661305328295-218.png

3.1.3  How to manually update other packages?

For the other packages, you have to access the device's CLI to do it via the apt command.

3.2  Set up a 3rd party package maintain server

3.2.1  Overview

Customers can use their own package maintenance system instead of using the default one from Dragino. They need to set up a package maintenance system for Debian. Lots of instructions are available in Internet, below is a reference instruction.

3.2.2  Install Apache2 HTTP server

apt install apache2

3.2.3  Creating Package Directories

 cd /var/www/html/

 mkdir debian/release/dists/stable/main/binary-armhf/ -p

 mkdir debian/release/pool/main/d/dragino/ -p

Tree Structure:

Note: If you are not familiar with updating servers, most directory names are not recommended to be changed.

└── debian

    └── release

        ├── dists

        │   └── stable

        │       └── main

        │           └── binary-armhf

        └── pool

            └── main

                └── d

                    └── dragino   -->  This is the directory to store the packages. User can change it to other name.

3.2.4  Get deb packages

The deb packages for auto-update can be placed in  /var/www/html/debian/release/pool/main/d/dragino/

Below is an example package(testing-0808.deb) for test purpose:

 wget http://repo.dragino.com/release/tool/unimportant/testing-0808.deb

 cp ./testing-0808.deb /var/www/html/debian/release/pool/main/d/dragino/

3.2.5  Generate Package Index file

cd /var/www/html/debian/release/

dpkg-scanpackages pool/ > dists/stable/main/binary-armhf/Packages

cat dists/stable/main/binary-armhf/Packages | gzip -9 > dists/stable/main/binary-armhf/Packages.gz

Note: Every time a package has been update, above comments need to be executed in the server to get the up-to-date package list.

3.2.6  Generate Release file

Create the generated script:

cd /var/www/html/debian/release/dists/stable

wget http://repo.dragino.com/release/tool/unimportant/generate-release.sh

chmod + x ./generate-release.sh

./generate-release.sh > Release

3.2.7  Sign the Release file with gpg and generating Inrelease file

Make sure auto-update server has gnupg

apt install gnupg

generate gpg key

gpg -gen-key

Note: Fill in the content as required and remember the name and email address.

Check the gen-key

gen -list-key

Generate the release.gpg

cd /var/www/html/debian/release/dists/stable

gpg --armor --detach-sign -o Release.gpg Release

gpg --clearsign -o InRelease Release

Generate the public key

gpg --armor --output <name>.asc --export <email address>

example: gpg --armor --output xiao.asc --export xiaoye@dragino.cc

3.2.8  Add url as apt source in LPS8v2 / MS20

Add the public key

cp xiao.asc /etc/apt/trusted.gpg.d/

Note: First need to transfer the public key from auto-update server to device.

Add the apt source list

Add the apt source list url and name this as test_server.list

echo "deb http://<IP_address or hostname>/debian/release stable main" | tee /etc/apt/sources.list.d/test_server.list

Validate the apt repository

Get and install the testing package (download testing-0808.deb and test)

apt update && apt install testing

Example output:

1661306420449-569.png

3.2.9  Configure the gateway's auto-upgrade rules

Remove dragino apt source

/etc/apt/sources.list

1661306460134-112.png

Set up automatic updates

Path : /usr/lib/dragino/dragino-apt-updates

The device performs automatic updates from this script,

But it will now only look for dragino as a keyword, so you need to replace the keyword dragino with your own keyword.

1661306487761-768.png

 

Tags:
    
Copyright ©2010-2022 Dragino Technology Co., LTD. All rights reserved
Dragino Wiki v2.0