Grove - Chainable RGB LED
Contents |
Introduction
Chainable RGB LED is based on P9813 chip which is a full-color light source LED driver chip, can provide constant current drive and modulated output of 256 gray. Transmission by wire (DATA and CLK), built-in recycling, can enhance the transmission distance.
Model: COM53140P
Features
- Chainable (up to 1024 nodes)
- General 256 gray output
- Anti-interference stability
Specification
| Item | Min | Typical | Max | Unit |
|---|---|---|---|---|
| Operate Voltage | 4.75 | 5.0 | 5.25 | V |
| Operate Current
(Red channel&Green channel&Blue channel) |
/ | 20 | / | mA |
| Communication Protocol | Serial: Data and Clock | / | ||
Usage
You can control the Grove- Chainable RGB LED using the Chainable RGB Library. The using methods are described as follows.
1. Connect the Grove socket marked "IN" on the Chainable RGB LED and D7/D8 on the Grove-Base Shield with a Grove cable. You can change to the digital port as you like, but don't forget to change the port number in the definition of the demo code at the same time.
Note:The 2 Grove interfaces in Grove - Chainable RGB LED are respectively screen-printed “IN” (for controlling data input) and “OUT” (for controlling data shared with the next Chainable RGB LED).
2. Plug Grove - Base Shield Shield onto Arduino/Seeeduino.
3. Supply Power for module. There has two methods. One, Connect it to PC using a USB cable. Two, Connect extern power to Jack interface of Arduino/Seeeduino.
The extern power comes in through a 2-pin terminal of Arduino.The highest supply voltage can not exceed 15V.

4. Download the Chainable RGB LED Library. Unzip and import it into Arduino-1.0 Libraries: ..\arduino-1.0\libraries.
5. Open the code directly by the path:File -> Example ->ChainableLED ->CycleThroughColors.
Demo code :
<span class="coMULTI">/*
* Example of using the ChainableRGB library for controlling a Grove RGB.
* This code cycles through all the colors in an uniform way. This is accomplished using a HSB color space.
* comments add By: http://www.seeedstudio.com/
* Suiable for Grove - Chainable LED
*/</span> <span class="co2">#include <ChainableLED.h></span> <span class="co1">//Defines the num of LEDs used, The undefined </span> <span class="co1">//will be lost control.</span> <span class="co2">#define NUM_LEDS 5</span> ChainableLED leds<span class="br0">(</span><span class="nu0">7</span>, <span class="nu0">8</span>, NUM_LEDS<span class="br0">)</span><span class="sy4">;</span><span class="co1">//defines the pin used on arduino.</span> <span class="kw4">void</span> <span class="kw2">setup</span><span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="co1">//nothing</span> <span class="br0">}</span> <span class="kw4">float</span> hue <span class="sy1">=</span> <span class="nu16">0.0</span><span class="sy4">;</span> <span class="kw4">boolean</span> up <span class="sy1">=</span> <span class="kw2">true</span><span class="sy4">;</span> <span class="kw4">void</span> <span class="kw2">loop</span><span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">for</span> <span class="br0">(</span>byte i<span class="sy1">=</span><span class="nu0">0</span><span class="sy4">;</span> i<span class="sy1"><</span>NUM_LEDS<span class="sy4">;</span> i<span class="sy2">++</span><span class="br0">)</span> leds.<span class="me1">setColorHSB</span><span class="br0">(</span>i, hue, <span class="nu16">1.0</span>, <span class="nu16">0.5</span><span class="br0">)</span><span class="sy4">;</span> <span class="kw3">delay</span><span class="br0">(</span><span class="nu0">50</span><span class="br0">)</span><span class="sy4">;</span> <span class="kw1">if</span> <span class="br0">(</span>up<span class="br0">)</span> hue<span class="sy2">+</span><span class="sy1">=</span> <span class="nu16">0.025</span><span class="sy4">;</span> <span class="kw1">else</span> hue<span class="sy2">-</span><span class="sy1">=</span> <span class="nu16">0.025</span><span class="sy4">;</span> <span class="kw1">if</span> <span class="br0">(</span>hue<span class="sy1">>=</span><span class="nu16">1.0</span> <span class="sy3">&&</span> up<span class="br0">)</span> up <span class="sy1">=</span> <span class="kw2">false</span><span class="sy4">;</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">(</span>hue<span class="sy1"><=</span><span class="nu16">0.0</span> <span class="sy3">&&</span> <span class="sy3">!</span>up<span class="br0">)</span> up <span class="sy1">=</span> <span class="kw2">true</span><span class="sy4">;</span> <span class="br0">}</span>6. Upload the code. Please click here if you do not know how to upload.
Resources
- Chainable RGB LED eagle file
- Chainable LED Library
- P9813 datasheet
- Chainable RGB LED Library for the P9813 (greatly simplifies using this component)
Support
If you have questions or other better design ideas, you can go to our forum or wish to discuss.