background image

7/23/22, 9:41 PM

Grove - Chainable RGB LED - Seeed Wiki

https://wiki.seeedstudio.com/Grove-Chainable_RGB_LED/

1/29

Grove - Chainable RGB LED

 is based on P9813 chip which is a full-

color LED driver. It provides 3 constant-current drivers as well as
modulated output of 256 shades of gray. It communicates with a
MCU using 2-wire transmission (Data and Clock). This 2-wire
transmission can be used to cascade additional 

Grove - Chainable

RGB LED

 modules. The built-in clock regeneration enhances the

transmission distance. This Grove module is suitable for any
colorful LED based projects.

Содержание Grove

Страница 1: ...ver It provides 3 constant current drivers as well as modulated output of 256 shades of gray It communicates with a MCU using 2 wire transmission Data and Clock This 2 wire transmission can be used to cascade additional Grove Chainable RGB LED modules The built in clock regeneration enhances the transmission distance This Grove module is suitable for any colorful LED based projects ...

Страница 2: ...eedstudio com Chainable RGB LED p 850 html v2 Replace P9813S16 with P9813S14 and change Grove connector from Vertical to horizontal Apr 19 2016 https www seeedstudio com E2 80 93 Chainable RGB Le p 2903 html Specifications Operating Voltage 5V Operating Current 20mA Communication Protocol Serial Tip More details about Grove modules please refer to Grove System https wiki seeedstudio com Grove_Syst...

Страница 3: ...ED Note that the IN interface of one Grove Chainable RGB LED should be connect to D7 D8 of Grove Base Shield Base_Shield_V2 and its OUT interface connect to IN interface of another Grove Chainable RGB LED chainable more LED in this way Caution The platforms mentioned above as supported is are an indication of the module s software or theoritical compatibility We only provide software library or co...

Страница 4: ...leThroughColors by the path File Examples ChainableLED_master and upload it to Seeeduino 1 2 Example of using the ChainableRGB library for control 3 This code cycles through all the colors in an uniform 4 5 6 7 include ChainableLED h 8 9 define NUM_LEDS 5 10 11 ChainableLED leds 7 8 NUM_LEDS 12 13 void setup 14 15 leds init 16 17 18 float hue 0 0 19 boolean up true 20 21 void loop 22 23 for byte i...

Страница 5: ... from green to red when the temperature is from 25 to 32 The test code is shown below Do it if you are interested in it 32 33 if hue 1 0 up 34 up false 35 else if hue 0 0 up 36 up true 37 1 demo of temperature rgbLED 2 temperature form 25 32 rgbLed from green red 3 Grove temperature plu to A0 4 LED plug to D7 D8 5 6 include Streaming h 7 include ChainableLED h 8 9 define TEMPUP 32 10 define TEMPDO...

Страница 6: ...alog 32 33 resistance float 1023 a 10000 a get the r 34 temperature 1 log resistance 10000 B 1 298 15 35 return temperature 36 37 38 void ledLight int dta light led 39 40 41 dta dta 4 0 255 42 43 int colorR dta 44 int colorG 255 dta 45 int colorB 0 46 47 leds setColorRGB 0 colorR colorG colorB 48 49 50 void setup 51 52 Serial begin 38400 53 cout hello world endl 54 55 56 void loop 57 58 float temp...

Страница 7: ... to your PC via an USB cable Software Step 1 Open Codecraft https ide chmakered com add Arduino support and drag a main procedure to working area Step 2 Drag blocks as picture below or open the cdc file which can be downloaded at the end of this page 62 nTemp map nTemp TEMPDOWN 100 TEMPUP 100 0 1 63 ledLight nTemp 64 delay 100 65 Note If this is your first time using Codecraft see also Guide for C...

Страница 8: ...ould have got a raspberry pi and a grovepi or grovepi 2 You should have completed configuring the development enviroment otherwise follow here GrovePi_Plus 3 Connection Success When the code finishes uploaded you will see the LED fade in and fade out done Attention If you are using Raspberry Pi with Raspberrypi OS Bullseye you have to use this command line only with Python3 warning ...

Страница 9: ...EDs connected in series with the f 10 First LED input socket connected to GrovePi o 11 numleds 1 12 13 grovepi pinMode pin OUTPUT 14 time sleep 1 15 16 Chainable RGB LED methods 17 grovepi storeColor red green blue 18 grovepi chainableRgbLed_init pin numLeds 19 grovepi chainableRgbLed_test pin numLeds tes 20 grovepi chainableRgbLed_pattern pin pattern 21 grovepi chainableRgbLed_modulo pin offset d...

Страница 10: ...edsExceptThis 1 37 thisLedAndInwards 2 38 thisLedAndOutwards 3 39 40 try 41 42 print Test 1 Initialise 43 44 init chain of leds 45 grovepi chainableRgbLed_init pin numleds 46 time sleep 5 47 48 change color to green 49 grovepi storeColor 0 255 0 50 time sleep 5 51 52 set led 1 to green 53 grovepi chainableRgbLed_pattern pin thisLed 54 time sleep 5 55 56 change color to red 57 grovepi storeColor 25...

Страница 11: ...erns blue 80 81 test pattern 1 blue 82 grovepi chainableRgbLed_test pin numleds t 83 time sleep 1 84 85 86 print Test 2c Test Patterns green 87 88 test pattern 2 green 89 grovepi chainableRgbLed_test pin numleds t 90 time sleep 1 91 92 93 print Test 2d Test Patterns cyan 94 95 test pattern 3 cyan 96 grovepi chainableRgbLed_test pin numleds t 97 time sleep 1 98 99 100 print Test 2e Test Patterns re...

Страница 12: ...h Test Patterns white 122 123 test pattern 7 white 124 grovepi chainableRgbLed_test pin numleds t 125 time sleep 1 126 127 128 pause so you can see what happened 129 time sleep 2 130 131 reset all off 132 grovepi chainableRgbLed_test pin numleds t 133 time sleep 5 134 135 136 print Test 3a Set using pattern this led 137 138 change color to red 139 grovepi storeColor 255 0 0 140 time sleep 5 141 14...

Страница 13: ...d 162 time sleep 5 163 164 pause so you can see what happened 165 time sleep 2 166 167 reset all off 168 grovepi chainableRgbLed_test pin numleds t 169 time sleep 5 170 171 172 print Test 3c Set using pattern this led 173 174 change color to green 175 grovepi storeColor 0 255 0 176 time sleep 5 177 178 set leds 1 3 to green 179 grovepi chainableRgbLed_pattern pin thisLed 180 time sleep 5 181 182 p...

Страница 14: ...ed_test pin numleds t 205 time sleep 5 206 207 208 print Test 4a Set using modulo all leds 209 210 change color to black fully off 211 grovepi storeColor 0 0 0 212 time sleep 5 213 214 set all leds black 215 offset 0 means start at first led 216 divisor 1 means every led 217 grovepi chainableRgbLed_modulo pin 0 1 218 time sleep 5 219 220 change color to white fully on 221 grovepi storeColor 255 25...

Страница 15: ... time sleep 5 245 246 pause so you can see what happened 247 time sleep 2 248 249 250 print Test 4c Set using modulo every 2 251 252 change color to green 253 grovepi storeColor 0 255 0 254 time sleep 5 255 256 set every 2nd led to green offset 1 257 grovepi chainableRgbLed_modulo pin 1 2 258 time sleep 5 259 260 pause so you can see what happened 261 time sleep 2 262 263 reset all off 264 grovepi...

Страница 16: ... color to blue 287 grovepi storeColor 0 0 255 288 time sleep 5 289 290 set every 3nd led to blue offset 2 291 grovepi chainableRgbLed_modulo pin 2 3 292 time sleep 5 293 294 pause so you can see what happened 295 time sleep 2 296 297 reset all off 298 grovepi chainableRgbLed_test pin numleds t 299 time sleep 5 300 301 302 print Test 4e Set using modulo every 3 303 304 change color to yellow 305 gr...

Страница 17: ... you can see what happened 327 time sleep 2 328 329 reset all off 330 grovepi chainableRgbLed_test pin numleds t 331 time sleep 5 332 333 334 print Test 5a Set level 6 335 336 change color to green 337 grovepi storeColor 0 255 0 338 time sleep 5 339 340 set leds 1 6 to green 341 grovepi write_i2c_block 0x04 95 pin 6 0 342 time sleep 5 343 344 pause so you can see what happened 345 time sleep 2 346...

Страница 18: ...363 except KeyboardInterrupt 364 reset all off 365 grovepi chainableRgbLed_test pin numleds t 366 break 367 except IOError 368 print Error 1 pin 7 setting up the output pin 2 numleds 1 how many leds you plug 1 storeColor red green blue 2 chainableRgbLed_init pin numLeds 3 chainableRgbLed_test pin numLeds testColor 4 chainableRgbLed_pattern pin pattern whichLed 5 chainableRgbLed_modulo pin offset d...

Страница 19: ...e familiar with Cloud9 IDE creating a simple application to blink one of the 4 user programmable LEDs on the BeagleBone is a good start If this is your first time to use Cloud9 IDE please follow this link BeagleBone_Green Step1 Set the Grove UART socket as a Grove GPIO Socket just follow this link https www seeedstudio com recipe 362 how to use the grove uart port as a gpio on bbg html Step2 Click...

Страница 20: ...3 4 CLK_PIN P9_22 5 DATA_PIN P9_21 6 NUMBER_OF_LEDS 1 7 8 class ChainableLED 9 def __init__ self clk_pin data_pin number_of_led 10 self __clk_pin clk_pin 11 self __data_pin data_pin 12 self __number_of_leds number_of_leds 13 14 GPIO setup self __clk_pin GPIO OUT 15 GPIO setup self __data_pin GPIO OUT 16 17 for i in range self __number_of_leds 18 self setColorRGB i 0 0 0 19 20 def clk self content_...

Страница 21: ...t self __data_pin GPIO HIGH 32 else 33 GPIO output self __data_pin GPIO LOW 34 self clk 35 36 Advance to the next bit to send 37 b b 1 38 39 def sendColor self red green blue 40 Start by sending a byte with the format 1 1 41 prefix B11000000 42 prefix 0xC0 43 if blue 0x80 0 44 prefix B00100000 45 prefix 0x20 46 if blue 0x40 0 47 prefix B00010000 48 prefix 0x10 49 if green 0x80 0 50 prefix B0000100...

Страница 22: ..._leds 77 78 if i led 79 _led_state i 3 _CL_RED red 80 _led_state i 3 _CL_GREEN green 81 _led_state i 3 _CL_BLUE blue 82 sendColor _led_state i 3 _CL_RED 83 _led_state i 3 _CL_GREEN 84 _led_state i 3 _CL_BLUE 85 86 self sendColor red green blue 87 88 Terminate data frame 32x 0 89 self sendByte 0x00 90 self sendByte 0x00 91 self sendByte 0x00 92 self sendByte 0x00 93 94 95 Note Use P9_22 UART2_RXD a...

Страница 23: ... socket on BBG Step6 Run the code You ll find the RGB LED is changing color every 2 seconds Chainable RGB LED eagle file V1 103 time sleep 2 104 rgb_led setColorRGB 0 0 255 0 105 time sleep 2 106 rgb_led setColorRGB 0 0 0 255 107 time sleep 2 108 rgb_led setColorRGB 0 0 255 255 109 time sleep 2 110 rgb_led setColorRGB 0 255 0 255 111 time sleep 2 112 rgb_led setColorRGB 0 255 255 0 113 time sleep ...

Страница 24: ...7 23 22 9 41 PM Grove Chainable RGB LED Seeed Wiki https wiki seeedstudio com Grove Chainable_RGB_LED 24 29 Chainable RGB LED eagle file V2 ...

Страница 25: ...ble_RGB_LED 25 29 Resources Library Chainable RGB LED Library for the P9813 https github com pjpmarques ChainableLED Library Github repository for Chainable RGB LED Library new https github com Seeed Studio Grove_Chainable_RGB_LED Library CodeCraft Code https files seeedstudio com wiki Grove ...

Страница 26: ...wiki Grove Chainable_RGB_LED res Chainable_RGB_LED_eagle_file 20V1 zip Eagle Chainable RGB LED eagle file V2 https files seeedstudio com wiki Grove Chainable_RGB_LED res Grove 20 20Chainable 20RGB 20LED 20v2 0 zip Datasheet P9813 Datasheet https files seeedstudio com wiki Grove Chainable_RGB_LED res P9813_datasheet pdf Projects Grove Introduction to Chainable LED This project shows how to connect ...

Страница 27: ...om Grove Chainable_RGB_LED 27 29 G I d i Ch i bl LED https www hackster io ingo lohs grove introduction to chainable led d668b7 DIY a device for explaining RGB color model DIY d i f l i i RGB l https www hackster io kevin lee2 diy a device for explaining rgb color model 496cbc ...

Страница 28: ...ou knock on the door or close to the door the door will open automatically Security Access Using Seeeduino Lotus https www hackster io limanchen security https www hackster io limanchen secu access using seeeduino lotus 7eb90f Tech Support Please submit any technical issue into our forum https forum seeedstudio com https www seeedstudio com act 4 html ...

Страница 29: ...7 23 22 9 41 PM Grove Chainable RGB LED Seeed Wiki https wiki seeedstudio com Grove Chainable_RGB_LED 29 29 utm_source wiki utm_medium wikibanner utm_campaign newpr oducts ...

Отзывы: