{"product_id":"2535-addressable-through-hole-5mm-rgb-led-with-diffused-lens-ws2811-driver-10-pack","title":"Addressable Through-Hole 5mm RGB LED with Diffused Lens, WS2811 Driver (10-Pack)","description":"\u003cp\u003eThis 10-pack of \u003cstrong\u003e5 mm\u003c\/strong\u003e through-hole RGB LEDs offers an easy way to add colorful and complex lighting effects to a project.  Each diffused LED features an integrated WS2811 driver that operates at 5 V and is controlled through a high-speed one-wire digital interface that allows multiple LEDs to be connected together to form a chain of addressable RGB LEDs.\u003c\/p\u003e\n\u003cbr\u003e\u003ch2\u003eOverview\u003c\/h2\u003e\n\u003ctable class=\"picture_with_caption right\"\u003e\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https:\/\/a.pololu-files.com\/picture\/0J5432.1200.jpg?43e14798aa4d1ae3aa239e01eff763da\" class=\"noscript-fallback\"\u003e\u003cimg alt=\"\" class=\"zoomable\" data-gallery-pictures=\"[{\" id chain of addressable rgb leds and on a breadboard controlled by an a-star micro. data-picture-id=\"0J5432\" data-picture-longest_side=\"1200\" src=\"https:\/\/a.pololu-files.com\/picture\/0J5432.300.jpg?43e14798aa4d1ae3aa239e01eff763da\"\u003e\u003c\/a\u003e\u003c\/td\u003e\n\u003cp\u003e\u003c\/p\u003e\n\u003c\/tr\u003e\u003c\/table\u003e\n\u003cp\u003eThese LED 10-packs are an easy way to add colorful and complex lighting effects to a project.  Each RGB LED contains an integrated WS2811 driver that allows it to be controlled with a high-speed one-wire interface (see the bottom of this page for sample code, including an Arduino library for controlling these LEDs).  Multiple LEDs can be connected together to form a chain of RGB LEDs, and the entire chain can be controlled from a single microcontroller pin.  These are very similar to the LEDs in our \u003ca href=\"https:\/\/www.pololu.com\/category\/151\/addressable-rgb-leds-based-on-the-sk6812-ws281x\"\u003eaddressable RGB LED strips\u003c\/a\u003e, but with these discrete LEDs you have far more flexibility in how they are arranged.  The picture on the right shows a chain of 10 LEDs in a breadboard controlled by an \u003ca href=\"https:\/\/www.pololu.com\/product\/3101\"\u003eA-Star 32U4 Micro\u003c\/a\u003e.\u003c\/p\u003e\n\u003cp\u003eWe offer these LEDs in two different sizes: \u003ca href=\"https:\/\/www.pololu.com\/product\/2535\"\u003e5 mm\u003c\/a\u003e and \u003ca href=\"https:\/\/www.pololu.com\/product\/2536\"\u003e8 mm\u003c\/a\u003e.\u003c\/p\u003e\n\u003ch3\u003eFeatures and specifications\u003c\/h3\u003e\n\u003cul\u003e\n\t\u003cli\u003eOne-wire digital control interface\u003c\/li\u003e\n\t\u003cli\u003eCan form a chain of individually-addressable RGB LEDs\u003c\/li\u003e\n\t\u003cli\u003e24-bit color control (8-bit PWM per channel); 16.8 million colors per pixel\u003c\/li\u003e\n\t\u003cli\u003e5 V operating voltage\u003c\/li\u003e\n\t\u003cli\u003eDraws approximately 50 mA at 5 V with red, green, and blue at full brightness\u003c\/li\u003e\n\t\u003cli\u003eColor ordering: red, green, blue\u003c\/li\u003e\n\t\u003cli\u003eExample code available for Arduino, AVR, and mbed\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003ch2\u003eUsing the LED\u003c\/h2\u003e\n\u003ch3\u003ePinout\u003c\/h3\u003e\n\u003cp\u003eThe LED has 4 pins, as shown in the diagram below:\u003c\/p\u003e\n\u003ctable class=\"picture_with_caption center wide\"\u003e\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https:\/\/a.pololu-files.com\/picture\/0J5433.1200.jpg?cdc0daa0c2fd98e38ed59b7d43758c6b\" class=\"noscript-fallback\"\u003e\u003cimg alt=\"\" class=\"wide zoomable\" data-gallery-pictures=\"[{\" id of and addressable rgb ws2811 leds with diffused lenses. data-picture-id=\"0J5433\" data-picture-longest_side=\"1200\" src=\"https:\/\/a.pololu-files.com\/picture\/0J5433.631.jpg?cdc0daa0c2fd98e38ed59b7d43758c6b\"\u003e\u003c\/a\u003e\u003c\/td\u003e\n\u003cp\u003e\u003c\/p\u003e\n\u003c\/tr\u003e\u003c\/table\u003e\n\u003cp\u003eThe pins can be identified by the length of the leads or by looking for the flat side of the LED.\u003c\/p\u003e\n\u003ch3\u003eConnecting the LEDs\u003c\/h3\u003e\n\u003cp\u003eThe \u003cstrong\u003eDIN\u003c\/strong\u003e pin is the input signal pin.  The DIN pin of the first LED in the chain should be connected to an I\/O line of a microcontroller.\u003c\/p\u003e\n\u003cp\u003eThe \u003cstrong\u003e5V\u003c\/strong\u003e pin supplies power to the LED, and should be connected to a suitable 5 V power supply.  The power supply should be capable of supplying enough current for all the LEDs it is powering.  Each LED draws approximately 50 mA with all three channels at full brightness.\u003c\/p\u003e\n\u003cp\u003eThe \u003cstrong\u003eGND\u003c\/strong\u003e pin should be connected to the ground pin of the microcontroller that is controlling the LEDs and also the negative terminal of the power supply.\u003c\/p\u003e\n\u003cp\u003eThe \u003cstrong\u003eDOUT\u003c\/strong\u003e pin is optional and allows you to chain multiple LEDs together.  It can be connected directly to the \u003cstrong\u003eDIN\u003c\/strong\u003e pin of the next LED in the chain.\u003c\/p\u003e\n\u003cp\u003eWe recommend taking several precautions to protect these LEDs from damage:\u003c\/p\u003e\n\u003cul\u003e\n\t\u003cli\u003eNever supply more than 5 V to the LED.\u003c\/li\u003e\n\t\u003cli\u003eConnect a capacitor of at least 10 μF between the ground and power lines.\u003c\/li\u003e\n\t\u003cli\u003eAvoid making or changing connections while the circuit is powered.\u003c\/li\u003e\n\t\u003cli\u003eMinimize the length of the wires connecting your microcontroller to the LED.\u003c\/li\u003e\n\t\u003cli\u003eFollow generally good engineering practices, such as taking precautions against electrostatic discharge (ESD).\u003c\/li\u003e\n\t\u003cli\u003eConsider adding a 100 \u0026amp;ohm; to 1000 \u0026amp;ohm; resistor between your microcontroller’s data output and the LED to reduce the noise on that line and to avoid accidentally powering the LED through its data input.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp class=\"note_warning clear\"\u003e\u003cb style=\"color:red;\"\u003eWarning:\u003c\/b\u003e These LEDs can explode if they are pushed beyond their limits.  For example, we were able to make an 8 mm LED explode by powering at 6 V and setting it to full brightness for about a minute (though we could not subsequently replicate that result).  We strongly recommend you avoid powering these LEDs at voltages over 5 V.\u003c\/p\u003e\n\u003ch3\u003eDefault Color\u003c\/h3\u003e\n\u003cp\u003eAfter power is applied to these LEDs, they will emit bright blue light until the first color command is received.\u003c\/p\u003e\n\u003ch3\u003eChaining\u003c\/h3\u003e\n\u003cp\u003eThese LEDs can be chained with each other and also with other LED products that have a similar protocol.  In particular, they can be chained with any of our \u003ca href=\"https:\/\/www.pololu.com\/category\/151\/addressable-rgb-leds-based-on-the-sk6812-ws281x\"\u003eSK6812\/WS281x-Based Addressable RGB LEDs\u003c\/a\u003e.  Even though these LEDs use a different color ordering than the WS2812B (RGB instead of GRB), they can still be chained to WS2812B-based products.\u003c\/p\u003e\n\u003ch3\u003eProtocol\u003c\/h3\u003e\n\u003cp\u003eThese LEDs are controlled by a simple, high-speed one-wire protocol on the input signal line.  The protocol is documented below.\u003c\/p\u003e\n\u003cp\u003eThe default, idle state of the signal line is low.  To update the LED colors, you need to transmit a series of high pulses on the signal line.  Each high pulse encodes one bit: a short pulse (0.35 μs) represents a zero, while a long pulse (0.9 μs) represents a one.  The time between consecutive rising edges should be 1.25μs.  After the bits are sent, the signal line should be held low for 50 μs to send a reset command, which makes the new color data take effect.\u003c\/p\u003e\n\u003ctable class=\"picture_with_caption center wide\"\u003e\n\u003ctr\u003e\n\u003ctd style=\"max-width: 600px\"\u003e\u003cimg alt=\"\" class=\"wide\" data-gallery-pictures=\"[{\" id rgb data timing diagram. data-picture-id=\"0J5006\" data-picture-longest_side=\"600\" src=\"https:\/\/a.pololu-files.com\/picture\/0J5006.600.png?4cfc791b316f463d196788959affe68f\"\u003e\u003c\/td\u003e\n\u003cp\u003e\u003c\/p\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\u003cth style=\"max-width: 600px\"\u003e\u003cp\u003eSK6812\/WS281x RGB data timing diagram.\u003c\/p\u003e\u003c\/th\u003e\u003c\/tr\u003e\n\u003c\/table\u003e\n\u003cp\u003eThe color of each LED is encoded as three LED brightness values, which must be sent in RGB (red-green-blue) order.  Each brightness value is encoded as a series of 8 bits, with the most significant bit being transmitted first, so each LED color takes 24 bits.  The first color transmitted applies to the LED that is closest to the control source, while the second color transmitted applies to the next LED in the chain, and so on.\u003c\/p\u003e\n\u003ctable class=\"picture_with_caption left\"\u003e\n\u003ctr\u003e\n\u003ctd style=\"max-width: 300px\"\u003e\u003ca href=\"https:\/\/a.pololu-files.com\/picture\/0J3886.1200.png?c431bc9123f46fbd8403126a9211110b\" class=\"noscript-fallback\"\u003e\u003cimg alt=\"\" class=\"zoomable\" data-gallery-pictures=\"[{\" id bits in rgb order represent the color of one led. data-picture-id=\"0J3886\" data-picture-longest_side=\"599\" src=\"https:\/\/a.pololu-files.com\/picture\/0J3886.300.jpg?c431bc9123f46fbd8403126a9211110b\"\u003e\u003c\/a\u003e\u003c\/td\u003e\n\u003cp\u003e\u003c\/p\u003e\n\u003c\/tr\u003e\n\u003ctr\u003e\u003cth style=\"max-width: 300px\"\u003e\u003cp\u003e24 bits in RGB order represent the color of one LED.\u003c\/p\u003e\u003c\/th\u003e\u003c\/tr\u003e\n\u003c\/table\u003e\n\u003cp\u003eTo update all the LEDs in the chain, you should send all the colors at once with no pauses.  If you send fewer colors than the number of LEDs in the chain, then some LEDs near the end will not be updated.  For example, to update 10 LEDs wired in a chain, you would send 240 bits encoded as high pulses and then hold the signal line low for 50 μs.\u003c\/p\u003e\n\u003cp\u003eThe high-speed protocol of the driver allows for fast updates; our library for the Arduino below takes about 1.1 ms to update 30 LEDs.  However, constant updates are not necessary; the LED can hold its state indefinitely as long as power remains connected.\u003c\/p\u003e\n\u003cdiv class=\"clear\"\u003e\u003c\/div\u003e\n\u003ch3\u003eImplementing the protocol on a microcontroller\u003c\/h3\u003e\n\u003ctable class=\"picture_with_caption right\"\u003e\u003ctr\u003e\n\u003ctd\u003e\u003ca href=\"https:\/\/a.pololu-files.com\/picture\/0J5430.1200.jpg?a52e573f074bb45d126ff5a2c591b8c3\" class=\"noscript-fallback\"\u003e\u003cimg alt=\"\" class=\"zoomable\" data-gallery-pictures=\"[{\" id addressable rgb leds and on a breadboard controlled by an a-star micro. data-picture-id=\"0J5430\" data-picture-longest_side=\"1200\" src=\"https:\/\/a.pololu-files.com\/picture\/0J5430.250.jpg?a52e573f074bb45d126ff5a2c591b8c3\"\u003e\u003c\/a\u003e\u003c\/td\u003e\n\u003cp\u003e\u003c\/p\u003e\n\u003c\/tr\u003e\u003c\/table\u003e\n\u003cp\u003eSince this LED does \u003cstrong\u003enot\u003c\/strong\u003e use a standard protocol, a software bit-banging approach is usually needed to control it from a microcontroller.  Because of the sub-microsecond timing, the bit-banging code generally needs to be written in assembly or very carefully optimized C, and interrupts will need to be disabled while sending data to the LEDs.  If the interrupts in your code are fast enough, they can be enabled during periods where the signal line is low.  It is generally not possible to generate the required control signals directly from older, slower microcontroller boards, like the Basic Stamp, or from processors that run full operating systems and can experience multithreading delays, like the Raspberry Pi.\u003c\/p\u003e\n\u003ch3\u003eSample code\u003c\/h3\u003e\n\u003cp\u003eTo help you get started quickly, we provide sample code for these microcontroller platforms:\u003c\/p\u003e\n\u003cul\u003e\n\t\u003cli\u003e\n\u003ca href=\"https:\/\/github.com\/pololu\/pololu-led-strip-arduino\"\u003ePololuLedStrip Arduino library\u003c\/a\u003e (also works with our Arduino-compatible \u003ca href=\"https:\/\/www.pololu.com\/category\/149\/a-star-programmable-controllers\"\u003eA-star modules\u003c\/a\u003e)\u003c\/li\u003e\n\t\u003cli\u003e\u003ca href=\"https:\/\/github.com\/pololu\/pololu-led-strip-avr\"\u003eExample AVR C code\u003c\/a\u003e\u003c\/li\u003e\n\t\u003cli\u003e\u003ca href=\"https:\/\/os.mbed.com\/users\/DavidEGrayson\/code\/PololuLedStrip\/\"\u003ePololuLedStrip mbed library\u003c\/a\u003e\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eAdditionally, the \u003ca href=\"https:\/\/github.com\/adafruit\/Adafruit_NeoPixel\"\u003eAdafruit NeoPixel library\u003c\/a\u003e for Arduino should work with these LEDs since the NeoPixels are based on the similar WS2812B driver.\u003c\/p\u003e","brand":"Unspecified","offers":[{"title":"2-4 Settimane","offer_id":47696771907929,"sku":"POL-2535","price":7.25,"currency_code":"EUR","in_stock":true},{"title":"1 Giorno","offer_id":47886020936025,"sku":"POL-2535\/A","price":7.25,"currency_code":"EUR","in_stock":false}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0781\/1009\/7753\/files\/0J5427.1200.jpg?v=1705457699","url":"https:\/\/xernuqvalzi.pro\/products\/2535-addressable-through-hole-5mm-rgb-led-with-diffused-lens-ws2811-driver-10-pack","provider":"Robot Italy","version":"1.0","type":"link"}