# 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](https://sharinghub-eng.kittenbot.hk/programming-platforms/makecode-tutorial/kittenbot-and-makecode)

#### 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))
```
