TG-LR82 (operates in 863.0–869.0 MHz and 2.4 GHz band) and TG-LR92 (operates in 900.0–928.0 MHz band and 2.4 GHz band) are LoRaWAN 1.0.4 compatible sensor tags.

User Manual:

tg-lrx2-um.pdf

Overview

TG-LR82 and TG-LR92 are MikroTik's first LoRa tags equipped with temperature, humidity and acceleration/orientation sensors (as well as magnetic switch for changing tag's configuration).

Generally, LoRa nodes or tags are devices which broadcast the data (which, the tags, usually get from their own built-in sensors, like the surrounding temperature or humidity) over the LoRa frequencies.

A typical LoRaWAN topology consists of 3 main elements → the server, the node and the gateway. The gateway's job is to simply forward received LoRa packets that are broadcasted by the nodes (within the same supported frequency spectrum) to the server (where they are decoded).

Once the LoRa node gets activated, it should start broadcasting "Join-request" packets, which should be captured by the gateway (over LoRa frequency) and forwarded to the server (over IP connection). If the node is registered on the server, the server should generate session keys for the node and send "Join-accept" packet back to the node (through the gateway, which acts as a "bridge" between IP and LoRa communication). As a result of this packet exchange, both ends should obtain session keys, the node should obtain a "DevAddr" from the server and a communication line between the two elements should be up and running. To the gateway, the LoRa packets/payloads broadcasted by the node will look "encrypted", however, the server, if it has a correct decoder setup, should see proper sensor captured data/values.

Operating modes

ModeDescription
Shutdown

Device deactivated in low power mode with all functionality disabled. Factory default mode.

RunNormal application functionality.

New device is in SHUTDOWN mode and is inactive. To change device configuration or set RUN mode, use Magnet Switch input method.

Supported LoRaWAN regions

Numeric code X-Y

Common Name


TG-LR82


TG-LR92
1-1EU868Yes
2-1AS923_GRP1
Yes
3-1US915
Yes
4-1AU915
Yes
5-1WW2G4YesYes
6-1AS923_GRP2
Yes
7-1AS923_GRP3
Yes
8-1IN865Yes
9-1KR920
Yes

Magnetic Switch

Device has magnet switch that can be used for configuration commands or as external input signal.

When using magnet switch for configuration user must apply sequence of 1 to 4 digits. Each digit in sequence is entered consecutively. When magnetic field is applied to device, LED starts blinking with interval 500ms ON, 500ms OFF (or according to LED Mode). When LED is switched on, internal counter is incremented starting from 0. When magnetic field is removed counter value is latched as user input digit. If magnetic field is applied again, next digit in input sequence is started. If interval after applying digit is larger than 2.5s, sequence code is executed as command.

When applying input code based on time, ensure to follow this equation: T = N - 0.5, where N is input digit and T is time in seconds to apply magnetic field. The interval between digits should be less than 1s.

If valid input command sequence is detected device executes requested operation and indicates status using device LED signals.

Sequence

PIN pro-

tected


Command description
2-1optionalActivate - enable RUN operating mode.
3-1optionalTrigger "current-state" frame uplink.
4-1-XoptionalSwitch device profile, where X is profile number [1..6].
4-2-1optionalSet primary band to 8xx MHz or 9xx MHz (depending on the model)
4-2-2optionalSet primary band to 2.4 GHz band.
4-3-1optionalEnable secondary band.
4-3-9optionalDisable secondary band.
6-1optionalDevice reset.
6-2-9optionalDeactivate device.
9-X-YoptionalSet LoRaWAN Region as per supported LoRaWAN regions.
6-9-9yesDevice factory reset
3-1-5yesExit PIN mode.
A-B-C-D-Enter PIN mode. A-B-C-D are digits of device factory PIN code.

If applied command doesn’t exist device ignores it.

LED indications during digit input can change based on device configuration. It is possible to change or completely disable LED indications.

Sensors and Data

Device has temperature, humidity, magnetic field, acceleration/orientation sensors. Data from these sensors can be sent to LoRaWAN  application server periodically or based on configurable rules.

See “ul_decoder.js” script for data field decoding details. This script is compatible with TTN JavaScript engine.

Following data fields are contained in these UL frame types:

KeyFrame types


Description
temperaturecurrent-state, last-tempLast measured temperature °C.
avg_temperatureema-tempExponential moving average of temperature samples.
temp_histogramtemp_histogramEpoch number and bin counter values for temperature histogram.
humiditycurrent-state, last-humidLast measured relative humidity RH%.
humid_histogramhumid_histogramEpoch number and bin counter values for humidity histogram.
avg_humidityema-humidLast measured relative humidity RH%.
mag_sw_cnt_lsbcurrent-stateLSB of magnet switch 32bit counter value.
mag_sw_cntmag-switchMagnet switch 32bit counter value.
mag_switch_tsmag-switchLast magnet switching time stamp. UNIX time or device uptime [s].
activity_statecurrent-state, full-activity, activityCurrent device Activity State Code.
activity_sfull-activityActivity time 32bit counter [s].
high_activity_sfull-activityHigh level activity (if configured) time 32bit counter [s].
total_activity_sactivityCurrent device activity state.
major_axis_orientcurrent-stateApproximate device Major axis orientation code.
orientationdevice-orientationDevice orientation normal vector: x, y, z.
free_fall_eventcurrent-stateFlag indicating the free fall event is pending.
free_fall_cntmotion-eventsFree fall event 32bit counter.
impact_cntmotion-eventsImpact event 32bit counter.
impact_cnt_u16impact-countImpact event 16 LSB bit counter.
impact_cnt_ximpact-countX axis impact event 16 LSB bit counter.
impact_cnt_yimpact-countY axis impact event 16 LSB bit counter.
impact_cnt_zimpact-countZ axis impact event 16 LSB bit counter.
uptime_sdev-timeDevice uptime [s].
unix_timedev-timeCurrent device UNIX time.
battery_mvdev-healthBattery voltage mV.
version_strversionDevice version data.
serial_numberserial-numberDevice serial number string.
config_checksumcfg-stateDevice current configuration checksums.
pending_eventcurrent-stateFlag indicating pending device events.

Data Frames

Each LoRaWAN uplink message may contain multiple data frames depending on maximum payload size and pending frames. See "ul_decoder.js” script for frame encoding details.

IDNameDescription
1current-state

Basic sensor and state data.

2device-eventsList of device events with time stamp.
3temp-histogramTemperature histogram data.
4humid-histogramHumidity histogram data.
5device-orientationOrientation data.
6full-activityComplete activity data.
7motion-eventsImpact and free-fall event counter.
8mag-switchFull magnetic switch data.
9impact-countDetailed impact counters - including specific axis.
10last-tempLast measured temperature.
11ema-tempExponential moving average of temperature samples.
12last-humidLast measured humidity.
13ema-humidExponential moving average of humidity samples.
14activityActivity state and total active time.
20dev-timeDevice uptime and UNIX time stamp.
21dev-healthDevice health status: battery voltage.
22versionVersion information.
23serial-numberSerial number string.
24cfg-stateCRC of each configuration block.

Configuring Frames

Each frame can be configured to be sent periodically, on network join and either as confirmed or unconfirmed message.

To configure frames following command must be encoded as msgpack array and sent to device as a downlink on port 2:

2,2,<profile>,<frame-id>,<ul-period-s>,<confirmed>,<on-join>
profile: device profile 0..5.
frame-id: frame ID number or name string.
ul-period-s: interval to send frame or 0 to disable.
confirmed: true/false to enabled/disable confirmed frame.
on-join: true/false to enable/disable send on join event.

Examples:

Configuring dev-health frame to be sent every 180 seconds

Command: [2,2,0,21,180,false,false] can be encoded using https://msgpack.solder.party/ as bytes:

[0x97 0x02 0x02 0x00 0x15 0xCC 0xB4 0xC2 0xC2].

Activity State codes

CodeState
0

IDLE

1LOW
2HIGH
3DISABLED

Major Axis orientation code

CodeOrientation
0

XH

1XL
2YH
3YL
4ZH
5ZL

LED MODE

Numeric CodeModeDescription
0HALF_DUTY_CYCLE

LED blinks with 50% duty.

1SHORT_BLINKLED blinks with short pulses on counter increment.
2NO_BLINKLED is completely disabled.


  • No labels