# PIR (Motion sensor)

Since the device is primarily solar-powered, the PIR sensor cannot be always ON, as the device will need a lot of light on average.

Therefore, we have implemented a duty-cycle on the PIR - turning it ON for certain period of time and turning it OFF for some period. This means that the device may not always report accurate movement detection.

{% hint style="success" %}
If you need to have the PIR constantly enabled and detecting movement, you have to insert 2 or 4 AA batteries and reconfigure the settings of the PIR sensor.

If you want to do this, we recommend sending the following downlink to the device:

**Option 1 - blind period 1 minute:** \
3C014A00004C003C3D4B4D \
\
**Option 2 - blind period 10 minutes**\
3C014A00004C02583D4B4D<br>

Read more about the blind period below.
{% endhint %}

## PIR Status

This commands allow you to set/get the PIR status - whether it's enabled or disabled at all. By default, the PIR is disabled.

{% tabs %}
{% tab title="SET" %}

<table data-header-hidden><thead><tr><th width="131"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>3C – The command code.</td></tr><tr><td>1</td><td><p>00 – Disable the PIR sensor; <strong>Default state.</strong></p><p>01 – Enable the PIR sensor. </p></td></tr></tbody></table>

**Example downlink:** 0x3C01 – Enable the PIR sensor.
{% endtab %}

{% tab title="GET" %}

<table data-header-hidden><thead><tr><th width="143.99999999999997"></th><th width="193"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>3D – Command code</td><td>3D – Command code</td></tr><tr><td>1</td><td> </td><td>00 - The PIR sensor is disabled.<br>01 - The PIR sensor is enabled.</td></tr></tbody></table>

**Example downlink sent by the server:** 0x3D;

**Example command response:** 0x3D01 – The PIR sensor is enabled.
{% endtab %}
{% endtabs %}

{% hint style="success" %}
With the default values for PIR Check interval (54s) and PIR Measurement duration (3s) and PIR Blind time (10m) it means that:

* PIR powers up every 54 seconds (PIR Check interval)
* It stays powered and is looking for movement for 3 seconds (PIR Measurement duration)
  * If a movement is detected, it sends an immediate uplink and disables the PIR for the next 10 minutes (PIR Blind period)
    {% endhint %}

## PIR Blind period

{% hint style="warning" %}
Тhe PIR sensor functionality has been changed to report pir=true during the blind period for devices with firmware version ≥ 1.7.
{% endhint %}

After detecting a movement in the room, the PIR sensor is disabled for the specified blind period to avoid too many uplinks, improving the energy usage - saving battery or requiring less light to harvest.

Example with Blind period of 1 minute:

* The moment the sensor detects movement, it sends an uplink.
* Then the PIR is powered down for 1 minute to save energy.&#x20;
* After 1 minute, the PIR is powered up again and the device will send a new uplink immediately after the PIR detects movement.

The shorter the Blind period, the more time-accurate detection of movement and more uplinks, but more energy is used.&#x20;

{% tabs %}
{% tab title="SET" %}

<table data-header-hidden><thead><tr><th width="140"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>4C – The command code.</td></tr><tr><td>1</td><td>XX –  PIR blind period data, bits 15:8;</td></tr><tr><td>2</td><td>XX – PIR blind period data, bits 7:0. <strong>Default value = 10min.</strong></td></tr></tbody></table>
{% endtab %}

{% tab title="GET" %}

<table data-header-hidden><thead><tr><th width="143.99999999999997"></th><th width="193"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>4D – Command code</td><td>4D – Command code</td></tr><tr><td>1</td><td> </td><td>XX - PIR sensor blind period - bits 15:8</td></tr><tr><td>2</td><td></td><td>XX - PIR sensor blind period - bits 7:0</td></tr></tbody></table>
{% endtab %}
{% endtabs %}

**Note:** Acceptable values: 15...65535sec. (1sec. resolution).

## PIR Check interval

This value instructs the sensor what's the period between PIR measurements. Outside this time, the sensor is not powered.

When the value is 0, the PIR is constantly powered and checking for movements.

{% tabs %}
{% tab title="SET" %}

<table data-header-hidden><thead><tr><th width="161"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>4A – The command code.</td></tr><tr><td>1</td><td>XX –  PIR check interval data, bits 15:8;</td></tr><tr><td>2</td><td>XX – PIR check interval data, bits 7:0.  <strong>Default value = 54sec.</strong></td></tr></tbody></table>

**Example downlink:** 0x4A0006 – Set the PIR check period to 6sec.
{% endtab %}

{% tab title="GET" %}

<table data-header-hidden><thead><tr><th width="143.99999999999997"></th><th width="193"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>4B – Command code</td><td>4B – Command code</td></tr><tr><td>1</td><td> </td><td>XX - PIR sensor check interval - bits 15:8</td></tr><tr><td>2</td><td></td><td>XX - PIR sensor Check interval - bits 7:0</td></tr></tbody></table>

**Example downlink sent by the server:** 0x4B;

**Example command response:** 0x4B0006 –  Measurement period of the PIR sensor = 6 sec.
{% endtab %}
{% endtabs %}

**Note:** Acceptable values: 0...65535sec. (1sec. resolution).

## PIR Measurement period

The PIR Measurement period is a value that instructs the sensor how long it should be checking for movements before going back to sleep to conserve energy.

{% tabs %}
{% tab title="SET" %}

<table data-header-hidden><thead><tr><th width="145"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>48 – The command code.</td></tr><tr><td>1</td><td>XX – PIR measurement period. <strong>Default value = 3sec.</strong></td></tr></tbody></table>

Example command: 0x4804 – Set the measurement period of the PIR sensor = 4sec
{% endtab %}

{% tab title="GET" %}

<table data-header-hidden><thead><tr><th width="143.99999999999997"></th><th width="193"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>49 – Command code</td><td>49 – Command code</td></tr><tr><td>1</td><td> </td><td>XX - PIR measurement period [sec]</td></tr></tbody></table>

**Example downlink sent by the server:** 0x49;

**Example command response:** 0x4904 –  Measurement period of the PIR sensor = 4 sec
{% endtab %}
{% endtabs %}

**Note:** Acceptable values: 3...255sec. (1sec. resolution).

## PIR Sensitivity

The PIR sensitivity can be set from 12 to 255. The minimum value we advise setting is 12 or 0x0C - the sensor will be super sensitive to movements.

{% hint style="info" %}
The higher the value, the less sensitive the PIR sensor is to movement.&#x20;

Minimum = 12 - very sensitive

Maximum = 255 - less sensitive
{% endhint %}

{% tabs %}
{% tab title="SET" %}

<table data-header-hidden><thead><tr><th width="131"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Hex value – Meaning</strong></td></tr><tr><td>0</td><td>3Е – The command code.</td></tr><tr><td>1</td><td>XX - PIR sensor sensitivity. <strong>20 is the dafault value.</strong></td></tr></tbody></table>

**Example downlink:** 0x3E1E – Set PIR sensor sensitivity 0x1E = 30.
{% endtab %}

{% tab title="GET" %}

<table data-header-hidden><thead><tr><th width="143.99999999999997"></th><th width="193"></th><th></th></tr></thead><tbody><tr><td><strong>Byte index</strong></td><td><strong>Sent request</strong></td><td><strong>Received response</strong></td></tr><tr><td>0</td><td>3F – Command code</td><td>3F – Command code</td></tr><tr><td>1</td><td> </td><td>XX - The sensitivity of the PIR sensor</td></tr></tbody></table>

**Example downlink sent by the server:** 0x3F;

**Example command response:** 0x3F1E – The sensitivity of the PIR sensor = 0x1E => converted to decimal = 30.
{% endtab %}
{% endtabs %}

**Note:** Acceptable values: 12...255.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mclimate.eu/mclimate-lorawan-devices/devices/mclimate-wireless-thermostat/wireless-thermostat-device-communication-protocol/pir-motion-sensor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
