Using the Dragino LT-22222 LoRa I/O Controller with Machinechat's JEDI Pro IoT Platform

Description

This project adds the Dragino LT-22222-L I/O controller to a ChirpStack based private LoRaWAN network and uses HTTP integration and a custom data collector to upload controller I/O parameter data to Machinechat’s JEDI Pro IoT platform. Seeed’s IP67 rated industrial LoRaWAN gateway is used to forward the LoRa sensor packets to a private ChirpStack LoRaWAN network server running on a Seeed Odyssey Blue mini PC (with Ubuntu linux installed). Machinechat’s JEDI Pro IoT platform runs on the same Odyssey Blue mini PC.

Hardware

Software

  • JEDI Pro or JEDI Pro SSE
    Adaptable software for IoT data collection, visualization, monitoring and data storage that can be integrated into IoT solutions. Capabilities include: collect data from sensors, devices and machines; build intuitive real-time and historical data and system view dashboards; create rules to monitor and respond to data conditions automatically; receive alert notifications by email and SMS. JEDI Pro SSE is the Seeed Studio Edition version of JEDI Pro that adds a Data Collector for Seeed’s line of SenseCAP LoRaWAN sensors
  • ChirpStack
    The ChirpStack open-source LoRaWAN Network Server stack provides open-source components for LoRaWAN networks. The modular architecture makes it possible to integrate within existing infrastructures.
  • Tera Term
    Tera Term is open source free software terminal emulator supporting UTF-8 protocol.

Background

This post is a follow-on project that builds on the related TechForum post Set up a private LoRaWAN Sensor Network with Machinechat and Seeed SenseCAP which details setting up a private LoRaWAN IoT sensor network using off the shelf hardware and software available at Digi-Key. Software used in the related project included Machinechat’s JEDI Pro applications software and ChirpStack’s LoRaWAN network server application. Hardware used in the project included a Seeed Odyssey x86 Mini PC and SenseCAP outdoor LoRaWAN gateway. For this post a Dragino LoRa I/O controller is configured and added to the existing private LoRaWAN network.

Implementation

For this project, a 12V power supply is used to power the LT-22222 and an FTDI USB to serial TTL cable is connected to the PRO jack serial interface. Default configuration for the LT-22222 when power is applied is to join a LoRa network and once connected, to upload the I/O controller parameter data to the LoRaWAN network every 10 minutes. Below schematic diagram illustrates how the setup is implemented (see Scheme-it DraginoLT22222 Project).

Electrical connections are shown below:

LT-22222-L FTDI serial cable Power Supply
GND - GND
VIN - +12VDC
PRO-txd (red) 4 - tx (orange) -
PRO-rxd (white) 5 - rx (yellow) -
PRO-gnd (black) 1 - gnd (black) -

Determine Dragino LT-22222-L board device EUI and App KEY

Each LT-22222-L is shipped with a sticker with the default device EUI and KEYs as shown below:
image
Device EUI can also be read from the serial port when the LT-22222-L is reset. Connect a FTDI TTL-232R-3V3 cable to the LT-22222-L cable as shown in above schematic. Open Tera Term (or similar serial terminal) and configure as shown below:
image

Press RST on LT-22222-L and device EUI and other info will be displayed as shown below:
image

An AT command “AT+APPKEY=?” can be used to query the App KEY in Tera Term and can be easily copied for your records. (note: see detailed info on AT commands in the user manual).

Add the LT-22222-L I/O controller to the ChirpStack LoRaWAN network server

(note: this project and below steps assume that a ChirpStack based private LoRaWAN network is active and in range of the LoRa-E5 sensor node, if not refer to TechForum post Set up a private LoRaWAN Sensor Network with Machinechat and Seeed SenseCAP)

1 - In ChirpStack, select Device-profile and Create. Name Device-profile “DraginoLT”, Select “1.0.3” for LoRaWAN MAC version, Select “A” for LoRaWAN Regional Parameters version, Select “Default ADR algorithm” for ADR algorithm, and enter “3600” for Uplink interval. In JOIN(OTAA/ABP) tab, check box for “Device supports OTAA”. In CODEC tab, select “Custom JavaScript codec functions” in CODEC dropdown list.

Next, you need to paste the decoder function from Dragino Download Server ./downloads/LT_LoRa_IO_Controller/LT33222-L/Payload_decoder/ into the window as shown below.

2 - In ChirpStack, select Applications, then select “FarmTest” and then select Create. Enter “LT22222io” for Device name, enter “description” for Device description, enter Device EUI for LT-22222-L board, enter “DraginoLT” for Device-profile, and select CREATE DEVICE. (note: for initial testing and demonstration you may want to check Disable frame-counter validation box)

3 - Add Application key for Device.
Go to “KEYS(OTAA)” tab on the LT22222io device page, paste APP Key (determined from earlier step) into “Application key” section and select SET DEVICE-KEYS.

4 - Check for LT-22222 LoRaWAN data
Once the LT-22222-L has joined the network you can check for I/O controller data in the LoRa message. In Chirpstack go to the Device Data page at Applications/FarmTest/Devices/LT22222io

Open one of the data frames to check for decoded JSON parameters in LoRa data
image

Set up and test ChirpStack HTTP Integration with JEDI Pro Generic LoRaWAN Custom Data Collector

ChirpStack is modified to add HTTP integration for forwarding LoRaWAN meta and sensor data to a specified IP address. Machinechat’s Generic LoRaWAN Custom Data Collector Plug-in is used for listening to the specified IP address and parsing the LoRaWAN data for review (when debug enabled) and use in the JEDI Pro platform.
(note: The Custom Data Collector consists of two files, lorawan-linux.bin and config.yml that are available from Machinechat at: https://support.machinechat.io/hc/en-us/articles/6046199010327-Generic-LoRaWAN-Custom-Data-Collector-Beta-for-JEDI-PRO-Linux )

1 - Enable HTTP Integration in ChirpStack.
Select “Add” in ChirpStack Integrations screen.

2 - Configure HTTP Integration
Select “JSON” for Payload marshaler , add IP address (use same IP as in config.yml file) for Endpoint URL , and select ADD INTEGRATION

3 - Copy lorawan-linux.bin and config.yml files to the ~/jedi/plugins directory where JEDI Pro is installed on the Ubuntu Linux Mini-PC. Modify config.yml file to enable debug and specify IP listening address. Note: if you have previously installed lorawan-linux.bin and config.yml files to the ~/jedi/plugins directory go to step 5

4 - Run Custom Plug-In on command line using “./lorawan-linux.bin ./config.yml” on terminal in Ubuntu Linux Mini-PC and monitor output data. Parameters will be different but format of JSON data should look similar to below (note: remember to make lorawan-linux.bin file executable):

5 - Edit config.yml file to map LoRaWAN data to JEDI Pro data parameters and disable debug (if enabled). For this project example, edit propertyNames to add values as shown below. The cSproperty values must match identically to the Chirpstack data names but mcProperty names can be anything as long as alphanumeric characters without any spaces.

propertyNames:
  - cSproperty: "ACI1_mA"
    mcProperty: "analog1i"    
  - cSproperty: "ACI2_mA"
    mcProperty: "analog2i"    
  - cSproperty: "AVI1_V"
    mcProperty: "analog1v"    
  - cSproperty: "AVI2_V"
    mcProperty: "analog2v"   
  - cSproperty: "DI1_status"
    mcProperty: "digital1in"        
  - cSproperty: "DI2_status"
    mcProperty: "digital2in"         
  - cSproperty: "DI3_status"
    mcProperty: "digital3in"         
  - cSproperty: "DO1_status"
    mcProperty: "digital1out"           
  - cSproperty: "DO2_status"
    mcProperty: "digital2out"  
  - cSproperty: "DO3_status"
    mcProperty: "digital3out"       
  - cSproperty: "RO1_status"
    mcProperty: "relay1status"       
  - cSproperty: "RO2_status"
    mcProperty: "relay2status"               
#

Set up JEDI Pro Custom Data Collector and Data Dashboard

In JEDI Pro, select “Settings” tab, then select “Data Collectors” and select “Add Collector” (note: this step can be ignored if you have already set up the LoRaWAN custom data collector).

Configure Collector as shown below. Name Data Collector “LoRaWAN” (or whatever you prefer), select Collector Type as “Custom Plug-In”, select “lorawan-linux.bin” as Plug-In Executable file, enter location of config.yml file (example: “/home/scottr/jedi/plugins/config.yml” for Plug-in Options, select check box for “Run As Background Process and Monitor” , then select “VALIDATE PLUG-IN” to verifiy functionality.

In JEDI Pro, select “Data Dashboards”, then select “+” to add a new chart.

Configure data chart and select “Add” to include in your Data Dashboard(see example below)

Conclusion

The Dragino LT-22222 provides multiple I/O data capability for sensing and control of digital and analog parameters over LoRaWAN. Machinechat’s JEDI Pro IoT application software provides a quick and effective means of monitoring data and taking action on the data.

References