# Color & Gesture Module

![](https://kittenbothk.readthedocs.io/en/latest/_images/09_06.png)

This is a multifunctional module, the main features are Color detection and Gesture detection.

![](https://kittenbothk.readthedocs.io/en/latest/_images/IMG_2572.GIF)

![](https://kittenbothk.readthedocs.io/en/latest/_images/IMG_2573.GIF)

![](https://kittenbothk.readthedocs.io/en/latest/_images/IMG_2574.GIF)

This module has 4 modes:

1. In Color Mode, the 4 LEDs light up. It can detect color or ambient light level.
2. In Gesture Mode, the LEDs light up corresponding to the direction of movement.
3. In Proximity Mode, it can detect objects with a 3cm range. The LEDs brightness are determined by the proximity of the object.
4. In LED Mode, the 4 LEDs can be controlled.

### Details

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

### Specifications

* Voltage: 3V-5V
* Dimensions: 56mm X 24mm X 16mm
* Connector: 4Pin PH2.0
* Color Mode Return Value: 0-360, corresponding to hue
* Gesture Mode Return Value: 0-4, corresponding to None, Up, Right, Down, Left
* Proximity Mode Return Value: 0-255, with a range of approximately 3cm
* Brightness Return Value: 0-255

### Precautions

* This module must be connected to I2C port.
* The module defaults to Proximity Mode if mode has not been set.
* For gesture detection, practice maybe needed to get the correct distance and speed for successful detection.
* For color detection, the return value is a Hue value from HSV format.
* Color detection has the best effects when the object is about 1cm away.
* The LEDs can only be controlled in the LED Mode.

### Connecting the module

#### Armourbit

***

Connect the module to the I2C Port of Armourbit using a 4Pin Cable.

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

#### Robotbit

***

Connect the module to the I2C Port of Robotbit.

```
Blue(A)->SCL, Green(B)->SDA
```

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

### MakeCode Coding Tutorial

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

#### Load Powerbrick Extension:

#### Search "Powerbrick" in the search bar.

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

#### Or search the following link.

<https://github.com/KittenBot/pxt-powerbrick>

#### Color Gesture Module Blocks

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

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

#### Detecting Color

{% embed url="<https://makecode.microbit.org/_LLbfYx40CEdX>" %}

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

HSV Color Wheel:

![](https://kittenbothk.readthedocs.io/en/latest/_images/hsv.jpg)

#### Detecting Ambient Brightness

{% embed url="<https://makecode.microbit.org/_LTt5ugP2f00K>" %}

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

#### Detecting Proximity

{% embed url="<https://makecode.microbit.org/_RhKfYUJwu0AK>" %}

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

#### Detecting Gesture

{% embed url="<https://makecode.microbit.org/_4eiKzMXot5Vy>" %}

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

#### Controlling LEDs

{% embed url="<https://makecode.microbit.org/_c5s6sFH3mgXY>" %}

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

#### Makecode Video

{% embed url="<https://www.youtube.com/watch?v=7WrkDYMc2f0>" %}

#### Demo Video

{% embed url="<https://www.youtube.com/watch?v=jhGaRx7EGms>" %}

{% embed url="<https://www.youtube.com/watch?v=BWK_pLO0qpA>" %}

{% embed url="<https://www.youtube.com/watch?v=UTiFh02MpMc>" %}

### Extension Version and Updates

There may be updates to extensions periodically, please refer to the following link to update/downgrade your extension.

[MakeCode Extension Update](https://sharinghub-eng.kittenbot.hk/programming-platforms/makecode-tutorial/makecode-extension-updates)

### KittenBlock Coding Tutorial

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

#### Load Powerbrick Extension

Select Powerbrick from the hardware column.

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

#### Color Gesture Module Blocks[](https://kittenbothk-eng.readthedocs.io/en/latest/functional_module/PWmodules/powerBrickColorGesture.html#id1)

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

#### Detecting Color[](https://kittenbothk-eng.readthedocs.io/en/latest/functional_module/PWmodules/powerBrickColorGesture.html#id2)

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

[Sample Code Download](https://bit.ly/PowerbrickM7_01sb3)

#### Detecting Ambient Brightness

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

[Sample Code Download](https://bit.ly/PowerbrickM7_02sb3)

#### Detecting Proximity

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

[Sample Code Download](https://bit.ly/PowerbrickM7_03sb3)

#### Detecting Gesture

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

[Sample Code Download](https://bit.ly/PowerbrickM7_04sb3)

#### Controlling LEDs

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

[Sample Code Download](https://bit.ly/PowerbrickM7_05sb3)

### FAQ

1：Why is there no reaction when I click the blocks?

Make sure you have connected the Micro:bit correctly and flash the firmware again.
