> For the complete documentation index, see [llms.txt](https://sharinghub-eng.kittenbot.hk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sharinghub-eng.kittenbot.hk/functional_module/sugar/pir.md).

# Sugar PIR Sensor Module

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/pir1.png)

This is a PIR sensor module in the Sugar sensor series. The pin holes on the back allow compatibility with plastic building bricks.

### Product Specifications

* Dimensions: 24 x 24 x 19 mm
* Weight: 5.6g
* Type: Digital
* Sensing Radius: 5m

### Wiring

Use a 3Pin cable to connect the module to Robotbit Edu.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/pir_wire.png)

### Programming Tutorial

### MakeCode Programming Tutorial

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/mcbanner.png)

#### Import Sugar Extension

#### Search for sugar in the search bar (Kittenbot products has been verified by Microsoft)

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/sugar_search.png)

[Importing Extensions Tutorial](/programming-platforms/makecode-tutorial/kittenbot-and-makecode.md)

#### Extension URL

Sugar extension: <https://github.com/KittenBot/pxt-sugar>

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/pir_mc_code.png)

[Sample Program](https://makecode.microbit.org/_Ar46zXCKVPDu)

#### Kittenblock Programming Tutorial

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/kbbanner.png)

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/pir3.png)

#### Micropython Programming Tutorial

```
PIR(pin)
value()
```

* value(): Returns sensor status

Sample Program

```
from future import *
from sugar import *

pir = PIR('P1')

neopix=NeoPixel("P7",3)

while True:
    if pir.value():
        neopix.setColorAll((103, 0, 0))
    else:
        neopix.setColorAll((0,0,0))
```
