diff --git a/LoRaWAN_Payload_Description.md b/LoRaWAN_Payload_Description.md new file mode 100644 index 0000000..f56c25e --- /dev/null +++ b/LoRaWAN_Payload_Description.md @@ -0,0 +1,52 @@ +# LoRaWAN Payload Description - Raumsensor Device + +## Uplink Payload (Device → Network Server) + +**Port:** 2 +**Length:** 7 bytes +**Format:** Binary + +| Byte | Field | Type | Unit | Description | +|------|-------|------|------|-------------| +| 0-1 | Room Temperature | int16_t | 0.01°C | SHT4x sensor reading (big-endian) | +| 2-3 | Floor Temperature | int16_t | 0.01°C | MLX90614 IR sensor reading (big-endian) * | +| 4-5 | Humidity | int16_t | 0.01% | SHT4x sensor reading (big-endian) | +| 6 | Relay State | uint8_t | - | Current relay status (0=OFF, 1=ON) | + +**Example Uplink:** +- `08 34 0A 28 15 E0 01` = 21.00°C room, 26.00°C floor, 56.00% humidity, relay ON + +## Downlink Payload (Network Server → Device) + +**Port:** Any +**Format:** ASCII commands + +### Relay Control Commands + +| Command | Length | Format | Description | +|---------|--------|--------|-------------| +| `r1 0` | 4 bytes | ASCII | Force relay OFF + disable auto control | +| `r1 1` | 4 bytes | ASCII | Re-enable automatic temperature control | + +### Temperature Threshold Commands + +| Command | Length | Format | Description | +|---------|--------|--------|-------------| +| `t1[temp]` | 3 bytes | ASCII + uint8 | Set room temperature threshold (°C) | +| `t2[temp]` | 3 bytes | ASCII + uint8 | Set floor temperature threshold (°C) | + +**Examples:** +- `72 31 20 30` (`r1 0`) = Force relay OFF +- `72 31 20 31` (`r1 1`) = Enable auto control +- `74 31 16` (`t1` + 22) = Set room threshold to 22°C +- `74 32 1A` (`t2` + 26) = Set floor threshold to 26°C + +## Data Conversion + +- **Temperature:** `value = (int16_t)(temperature * 100)` +- **Humidity:** `value = (int16_t)(humidity * 100)` +- **Decoding:** `actual_value = received_value / 100.0` + +## Special Cases + +**\* Floor Temperature Sensor:** If the MLX90614 sensor is not available or not responding, the floor temperature will be transmitted as `-273.15°C` (hex: `95 5D`). \ No newline at end of file diff --git a/LoRaWAN_Payload_Description.pdf b/LoRaWAN_Payload_Description.pdf new file mode 100644 index 0000000..a16bcac Binary files /dev/null and b/LoRaWAN_Payload_Description.pdf differ