AN-113 LoRaWAN Tilt Sensor User Guide
Device Information: Model AN-113, devEui ffffff100004c8b3, gateway IP 192.168.31.205, Modbus Slave ID 12, BACnet Device ID 112
1 Protocol Overview
The AN-113 reports tilt angle, tilt alarm, battery voltage, tamper status, and signal quality on Fport 210.
1.1 Uplink Data Protocol (Fport 210)
Payload format (Fport 210):
| Byte | Field | Description |
|---|---|---|
| 0 | Reserved | Always 0x00 (protocol version) |
| 1 … N | TLV pairs | [Type(1 B)][Value(N B)] … repeating until end |
Each Type byte determines the field name and the number of following value bytes:
| Type | Value Bytes | Field Name | Encoding | Scale | Unit | Notes |
|---|---|---|---|---|---|---|
0x01 |
1 | model |
uint8 | — | — | Model code = 0x3C |
0x6D |
1 | packetType |
uint8 | — | — | 0x00=heartbeat 0x01=data report |
0x04 |
2 | batteryVoltage |
uint16 BE | ÷1000 | V | mV raw ÷1000 = V |
0x7D |
1 | batteryVoltageState |
uint8 | — | — | 0=normal 1=low voltage |
0x77 |
1 | tamperState |
uint8 | — | — | 0=normal 1=tampered |
0x6B |
2 | tiltAngle |
uint16 BE | — | ° | Tilt angle in degrees |
0x05 |
1 | batteryLowEvent |
uint8 | — | — | 0=normal 1=low-voltage event |
0x03 |
1 | tamperEvent |
uint8 | — | — | 0=normal 1=tamper event |
0xA8 |
1 | accelerationAlarm |
uint8 | — | — | 0=normal 1=acceleration alarm event |
0xC2 |
1 | tiltAlarm |
uint8 | — | — | 0=normal 1=tilt alarm event |
JavaScript Decoder Example:
// AN-113 Tilt Sensor — Fport 210 uplink decoder
function decodeUplink(bytes) {
var i = 1, r = {};
function u16(b,o){ return (b[o]<<8)|b[o+1]; }
while (i < bytes.length) {
var t = bytes[i++];
switch (t) {
case 0x01: r.model = bytes[i++]; break;
case 0x03: r.tamperEvent = bytes[i++]; break;
case 0x04: r.batteryVoltage = u16(bytes,i)/1000; i+=2; break;
case 0x05: r.batteryLowEvent = bytes[i++]; break;
case 0x6B: r.tiltAngle = u16(bytes,i); i+=2; break; // degrees
case 0x6D: r.packetType = bytes[i++]; break;
case 0x77: r.tamperState = bytes[i++]; break;
case 0x7D: r.batteryVoltageState = bytes[i++]; break;
case 0xA8: r.accelerationAlarm = bytes[i++]; break;
case 0xC2: r.tiltAlarm = bytes[i++]; break;
default: i++; break;
}
}
return r;
}
// Example payload (hex): 00 01 3C 6D 01 04 0D AC 7D 00 77 00 6B 00 05
// → { model:60, packetType:1, batteryVoltage:3.50, batteryVoltageState:0, tamperState:0, tiltAngle:5 }
Script download: LPP.zip
Compatibility note: LPP.js is developed and tested against ChirpStack v4.17.0. The ChirpStack JavaScript codec API may differ across versions — if you are running a different ChirpStack version, review and adjust the script as needed before deployment.
2 Getting Uplink Data
⚠️ The IP addresses (192.168.31.205/192.168.31.193), ChirpStack API token, Slave ID, BACnet Device ID, and devEui in the examples below are for demonstration only. Replace them with your actual gateway IP, ChirpStack API token, and device parameters.
2.1 ChirpStack MQTT Subscription
Subscribe to the MQTT topic to receive real-time uplink frames:
Application ID —3ef9e6b9-ec54-4eda-86b8-a5fb46899f39is the factory-default ChirpStack
application built into the gateway. Replace it with your actual application
ID if you have created a different one.
Gateway IP —192.168.31.205is the gateway WAN port IP shown as an
example. Replace it with your actual gateway IP address.
Device EUI —ffffff100004c8b3is the EUI of the example device.
Replace it with the EUI shown in the gateway device list, or use+
as a wildcard to subscribe to all devices at once.
# Subscribe to one specific device
mosquitto_sub -h 192.168.31.205 -p 1883 \
-u gateway -P mqtt88888888 \
-t "application/3ef9e6b9-ec54-4eda-86b8-a5fb46899f39/device/ffffff100004c8b3/event/up"
# Subscribe to ALL devices on ALL applications (wildcard)
mosquitto_sub -h 192.168.31.205 -p 1883 \
-u gateway -P mqtt88888888 \
-t "application/+/device/+/event/up"
Example uplink payload (JSON):
{
"devEui": "ffffff100004c8b3",
"fPort": 210,
"object": {
... (decoded LPP fields)
}
}
2.2 IoT Hub HTTP API
Send a GET request to retrieve the latest device state:
curl -s "http://192.168.31.205:8070/api/getStatus?devEui=ffffff100004c8b3"
{
"success": true,
"result": {
"batteryVoltage": 4.13,
"batteryVoltageState": 0,
"tamper": 1,
"tiltAngle": 16,
"accelerationAlarm": true,
"tiltAlarm": false,
"batteryLowEvent": false,
"model": "AN-113"
}
}
2.3 IoT Hub Modbus TCP — Python Script
Script download: modbus_tcp_read.py
Use modbus_tcp_read.py to poll all registers at once:
python3 modbus_tcp_read.py --ip 192.168.31.205 --port 502 \
--slaveId 12 --sensorType AN-113
Target: 192.168.31.205:502 | Slave ID: 12 | Sensor: AN-113
================================================================================================================================================================
Attribute | Addr | FC | Format | Order | Cnt | Scale | Raw(Hex) | Value | Unit
----------------------------------------------------------------------------------------------------------------------------------------------------------------
online | 6 | 03 | Bit/Bool | Big(ABCD) | 1 | x1 | 0001 | true | none
lastOnlineTime | 7 | 03 | UnixTime | Big(ABCD) | 2 | x1 | 69CB 8AC9 | 1774947017 | second
batteryVoltage | 9 | 03 | Int16(S) | Big(ABCD) | 1 | /100 | 019D | 4.13 | volt
batteryVoltageState | 10 | 03 | Int16 | Big(ABCD) | 1 | x1 | 0000 | 0.0 | none
tamper | 11 | 03 | Int16 | Big(ABCD) | 1 | x1 | 0001 | 1.0 | none
tiltAngle | 12 | 03 | Int16 | Big(ABCD) | 1 | x1 | 0010 | 16.0 | degree
accelerationAlarm | 13 | 03 | Bit/Bool | Big(ABCD) | 1 | x1 | 0001 | true | none
tiltAlarm | 14 | 03 | Bit/Bool | Big(ABCD) | 1 | x1 | 0000 | false | none
batteryLowEvent | 15 | 03 | Bit/Bool | Big(ABCD) | 1 | x1 | 0000 | false | none
tamperEvent | 16 | 03 | Int16 | Big(ABCD) | 1 | x1 | 0001 | 1.0 | none
model | 41 | 03 | String(24B) | ASCII | 12 | x1 | 414E 2D31 3133 0000 ... | AN-113 | none
rssi | 53 | 03 | Int16 | Big(ABCD) | 1 | x1 | FFD3 | -45.0 | none
... (13 fields total)
2.4 IoT Hub Modbus TCP — Modbus Poll
Tool download: Modbus Poll 9.5.0.1507.zip
- Open Modbus Poll, connect to
192.168.31.205:502, Slave ID12 - Menu Setup → Read/Write Definition, set Function Code = FC03, Start Address =
6, Length =49 - Click OK — values update in real-time
2.5 IoT Hub BACnet BIP — Python Script
Script download: bacnet_read.py
Use bacnet_read.py to read all BACnet objects:
python3 bacnet_read.py --ip 192.168.31.205 --port 47808 --id 112
Target: 192.168.31.205:47808 | BACnet ID: 112 | Scan: 11200-11299
------------------------------------------------------------
Type | Instance | Offset | Value | Object Name
------------------------------------------------------------
BI | 11202 | 2 | active | ffffff100004c8b3.online
AI | 11203 | 3 | 1774947072.00 | ffffff100004c8b3.lastOnlineTime
AI | 11204 | 4 | 4.13 | ffffff100004c8b3.batteryVoltage
AI | 11205 | 5 | 0.00 | ffffff100004c8b3.batteryVoltageState
AI | 11206 | 6 | 1.00 | ffffff100004c8b3.tamper
AI | 11207 | 7 | 16.00 | ffffff100004c8b3.tiltAngle
BI | 11208 | 8 | active | ffffff100004c8b3.accelerationAlarm
BI | 11209 | 9 | inactive | ffffff100004c8b3.tiltAlarm
BI | 11210 | 10 | inactive | ffffff100004c8b3.batteryLowEvent
AI | 11211 | 11 | 1.00 | ffffff100004c8b3.tamperEvent
CV | 11215 | 15 | AN-113 | ffffff100004c8b3.model
AI | 11216 | 16 | -45.00 | ffffff100004c8b3.rssi
... (13 objects total)
2.6 IoT Hub BACnet BIP — YABE
Tool download: SetupYabe_v2.1.0.exe
- Open YABE, connect to
192.168.31.205:47808 - Expand Device 112 in the device tree
- Browse AI/BI/AV/BV/CV objects to view real-time values