# 36mm LED Pixels

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/001/136/medium800/led_pixels_ID683_LRG.jpg?1396769137)

RGB Pixels are digitally-controllable lights you can set to any color, or animate. Each pixel contains four RGB LEDs and a controller chip in a sturdy metal housing.&nbsp;The pixel is then 'flooded' with epoxy to make it waterproof. These are fairly large pixels but they have a lot of nice mounting options, such as two metal flanges on the side and a 0.15"/4mm diameter hole in the middle so you can screw them directly onto a surface. They're typically used to make outdoor signs. Compared to our other LED dots, these are much bigger and much brighter, good for larger scale installations.  
  
At&nbsp; **12 volts** , they draw a maximum of&nbsp; **120 milliamps** &nbsp;per pixel: 40 mA each for red, green and blue.  
  
The LED pixels are spaced along a strand of ribbon cable, with about&nbsp;**3 inches (75mm)**&nbsp;between pixels. If additional distance is needed you can cut the ribbon cable and solder 4 wires to extend the gap to the desired length.  
![](https://cdn-learn.adafruit.com/assets/assets/000/001/137/medium800/led_pixels_36mmbundle.jpg?1396769142)

Each pixel contains a small microchip. The WS2801 LED driver chip is custom designed for this purpose. We provide an Arduino library for communicating with the pixels (explained in subsequent pages), but if you want to write your own code for other microcontrollers, they’re very easy to communicate with using an SPI-like protocol. For each pixel, one “shifts out” 24 bits of color information — the first data out corresponds to the pixel closest to the microcontroller. To write colors to 10 LEDs, you would issue 240 bytes (10 \* 24). Following the data, a 500 microsecond pause will then “latch” the data and display the new LED colors.

# 36mm LED Pixels

## Project Ideas

These pixels could be used for stuff like…  
  
An LED coffee table (this one was “hand made” some time ago…now you could simply use a long strand of our LED pixels and skip the complicated wiring and&nbsp;driver parts):http://www.youtube.com/watch?v=Tj1j1-dIX6k&amp;feature=player_embedded

Signs and displays:http://www.youtube.com/watch?v=EkrZbBEqcjo&amp;feature=player_embedded

# 36mm LED Pixels

## Wiring

The “magic” of&nbsp;these pixels is that they're digitally controlled…even though there are only two control lines, you can have as many pixels as you’d like in a single long strand, yet each remains independently controllable.

 

Though it looks like the 4-conductor ribbon cable is continuous,&nbsp;_it isn't!_&nbsp;The pixels have a distinct “in” and “out” side. Data from the microcontroller arrives on the input side, where it’s received by the driver chip. The output side then connects to the input of the next pixel, all the way down the line.

When connecting these pixels to a microcontroller, make sure you're connecting to the strand's&nbsp; **input** &nbsp;pins! On these large pixels, it's easy to spot: examine the circuit board, looking for the "IN" label and an arrow indicating the direction of data flow. If connecting multiple strands together, make sure the output of one strand goes to the input of the next.![](https://cdn-learn.adafruit.com/assets/assets/000/001/138/medium800/led_pixels_36mm-io.jpg?1396769148)

The pixel strands&nbsp;include plugs&nbsp;for joining multiple strands, plus two wires for connecting power:

![](https://cdn-learn.adafruit.com/assets/assets/000/001/139/medium800/led_pixels_36mm-power.jpg?1396769156)

Wiring is pretty easy since there are only 4 wires. The only important thing is that you should not try to power the LED strand from the Arduino's 5V line — these LEDs require a dedicated 12V source separate from the microcontroller.

 

Use this diagram with the red wire going to +12V from the power supply, green (serial clock) to Arduino digital pin 3, yellow (serial data) to digital pin 2, and black to both the ground connection on the power supply and any available GND pin on the Arduino.

![](https://cdn-learn.adafruit.com/assets/assets/000/001/140/medium800/led_pixels_arduinowiring12v.png?1396769173)

Our Arduino library can use any two pins, but the examples are written to use pins 2 and 3 as above.

# 36mm LED Pixels

## Powering

When running a lot of LEDs, it’s important to keep track of power usage.&nbsp;Individual LEDs don't get very hot or use tons of power, but they add up fast!

 

Each single 36mm RGB LED pixel can draw up to 120mA from a 12V supply. That means a strand of 20 can use up to 2.4 Amps. That’s a peak rate, which assumes that all the LEDs are on at full brightness. If most of the LEDs are kept dim or off (as when animating patterns), the average power usage can be 1/3 this or less.

We suggest a nice switching supply for driving LED pixels, such as our&nbsp;[12 Volt 5 Amp supply](http://www.adafruit.com/products/352 "Link: http://www.adafruit.com/products/352")&nbsp;. For larger projects, a&nbsp;[slightly modified ATX computer power supply](http://www.instructables.com/pages/search/search.jsp?ie=ISO-8859-1&q=ATX)&nbsp;can provide 10 Amps to power upwards of 80 pixels!

![](https://cdn-learn.adafruit.com/assets/assets/000/001/142/medium800/led_pixels_12v5aswitching_LRG.jpg?1396769181)

Since the 36mm pixels are powered by 12V but use 3-5V signaling, make sure you don't accidentally connect the 12V to your microcontroller — this will destroy it! For that reason, the power lines are separated out. Use something like a&nbsp;[2.1mm DC terminal block adapter](https://www.adafruit.com/products/368)&nbsp;so that you can directly plug in our 12V adapter.

The wires on the 3-JST SM connector are then connected to your microcontroller: black is ground, yellow is data and green is clock.

![](https://cdn-learn.adafruit.com/assets/assets/000/001/141/medium800/led_pixels_36mmpower.jpg?1396769178)

# 36mm LED Pixels

## Code

# Installation

To download the required Arduino library, use the Arduino library manager.

Open up the Arduino library manager:

![](https://cdn-learn.adafruit.com/assets/assets/000/084/298/medium800/led_pixels_library_manager_menu.png?1573836043)

Search for the&nbsp; **Adafruit WS2801&nbsp;** library and install it

![](https://cdn-learn.adafruit.com/assets/assets/000/084/299/medium800/led_pixels_ws2801.png?1573836054)

We also have a great tutorial on Arduino library installation at:  
[http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use](http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use "Link: http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use")

After installing the Adafruit\_WS2801 library, you should be able to access the sample code by navigating through menus in this order: File→Sketchbook→Libraries→Adafruit\_WS2801→strandtest

# Using the Library

Let's look through the strandtest example code. To use the library in an Arduino sketch, you'll first need to globally declare a WS2801 object to talk to the strip. It is invoked with three variables: the number of pixels and the data and clock pins:

```
int dataPin = 2;
int clockPin = 3;
 
// Set the first variable to the NUMBER of pixels. 25 = 25 pixels in a row
Adafruit_WS2801 strip = Adafruit_WS2801(25, dataPin, clockPin);
```

The example code was written for multiple types of pixels we carry, some of which come in different strand lengths. Since the 36mm strands contain 20 (rather than 25) pixels, feel free to edit the declaration for 20 pixels:

```
Adafruit_WS2801 strip = Adafruit_WS2801(20, dataPin, clockPin);
```

Next, we initialize the strip in the&nbsp;setup()&nbsp;procedure:

```
void setup() {
 
  strip.begin();
 
  // Update LED contents, to start they are all 'off'
  strip.show();
}
```

begin()&nbsp;initializes the library, while&nbsp;show()&nbsp;refreshes the displayed colors of the LEDs. You'll need to call&nbsp;show() after changing any pixel colors to see this reflected in the LEDs. This way you can change the entire strip at one time (it takes the same amount of time to change one pixel as it does for an entire strip).

 

Let's look inside an example function,&nbsp;colorWipe(). This creates a 'chase' sequence that fills the strip&nbsp;with a color. It is basically a loop that increments through every pixel (which you can query with the&nbsp;numPixels()&nbsp;function) and sets the color of each (incremented with&nbsp;i) to the value passed (c&nbsp;— colors are expressed as a 32-bit variable type, though only the bottom 24 bits are used). The strip output is then updated with&nbsp;show(). Finally there is some delay (otherwise this would happen instantly).

 

Below that is a helper function that converts a color from separate 8-bit red, green and blue values into a combined 24-bit value (suitable for passing to&nbsp;colorWipe()). The brightness range is from 0 (off) to 255 (max brightness).

```
// fill the dots one after the other with said color
// good for testing purposes
void colorWipe(uint32_t c, uint8_t wait) {
  int i;
 
  for (i=0; i &lt; strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}
 
/* Helper functions */
// Create a 24 bit color value from R,G,B
uint32_t Color(byte r, byte g, byte b)
{
  uint32_t c;
  c = r;
  c &lt;&lt;= 8;
  c |= g;
  c &lt;&lt;= 8;
  c |= b;
  return c;
}
```

For example, in the&nbsp;loop()&nbsp;function we call colorWipe(Color(255, 0, 0), 50) which will fill the strand with full-brightness red light, pausing about 50 milliseconds between pixels.

```
  colorWipe(Color(255, 0, 0), 50);  // red fill
  colorWipe(Color(0, 255, 0), 50);  // green fill
  colorWipe(Color(0, 0, 255), 50);  // blue fill
```

# 36mm LED Pixels

## Troubleshooting

Many support issues arise&nbsp;from&nbsp;eager users getting ahead of themselves, changing the code and wiring before confirming that all the pieces work in the standard configuration.&nbsp;We recommend always starting out with the examples as shown. Use the pinouts and wiring exactly as in the tutorial, and run the stock, unmodified “strandtest” example sketch. Only then should you start switching things around.  
  
Here are the most common issues and solutions…### 

- Double-check all wiring. Are the clock and data wires swapped? Is ground connected to the Arduino?
- Confirm the Arduino is connected to the INPUT end of the strand.
- Check power supply polarity and voltage. Are + and - swapped? If you have a multimeter, confirm 12V DC output (±10%) from the power supply.
- Are the power wires at the opposite end of the strand insulated or trimmed? They should not be left exposed where they might make contact with metal, or each other.
- Is the correct board type&nbsp;selected in the Arduino Tools→Board menu?

### 

The power supply is probably OK. Check for any of the following:  
  

- Double-check all wiring. Are the clock and data wires swapped? Is ground connected to the Arduino?
- Confirm the Arduino is connected to the INPUT end of the strand.
- Is the correct board type&nbsp;selected in the Arduino Tools→Board menu?  
- Did the strandtest code successfully compile and upload?

### 

- Confirm that the number of LEDs in the&nbsp;Adafruit\_WS2801() constructor match the number of LEDs in the strand (both will be 20 if using the strandtest example and a single strand of LEDs).

### 

Are the clock and data wires swapped? Is ground connected to the Arduino?### 

- This can happen when trying to power too long of a strand from one end. Voltage will drop along the length of the strand and the furthest pixels will “brown out.” Connect power to&nbsp;_every_&nbsp;20 pixel strand.

### 

- Confirm the library is&nbsp;<u>unzipped</u>&nbsp;prior to installation.
- Confirm the library is properly named and located. The folder should be called&nbsp;Adafruit\_WS2801, and placed inside your personal&nbsp;Documents/Arduino/Libraries folder —&nbsp;_not_&nbsp;inside the Arduino application folder!
- After installation, the Arduino IDE needs to be restarted for new libraries to be used.


## Featured Products

### Adafruit METRO 328 Fully Assembled - Arduino IDE compatible

[Adafruit METRO 328 Fully Assembled - Arduino IDE compatible](https://www.adafruit.com/product/50)
We sure love the ATmega328 here at Adafruit, and we use them&nbsp;_a lot_&nbsp;for our own projects. The processor has plenty of GPIO, Analog inputs, hardware UART SPI and I2C, timers and PWM galore - just enough for most simple projects. When we need to go small, we use a <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/50)
[Related Guides to the Product](https://learn.adafruit.com/products/50/guides)
### Female DC Power adapter - 2.1mm jack to screw terminal block

[Female DC Power adapter - 2.1mm jack to screw terminal block](https://www.adafruit.com/product/368)
If you need to connect a DC power wall wart to a board that doesn't have a DC jack - this adapter will come in very handy! There is a 2.1mm DC jack on one end, and a screw terminal block on the other. The terminals are labeled with positive/negative assuming a positive-tip configuration...

In Stock
[Buy Now](https://www.adafruit.com/product/368)
[Related Guides to the Product](https://learn.adafruit.com/products/368/guides)
### 12V 5A switching power supply

[12V 5A switching power supply](https://www.adafruit.com/product/352)
This is a beefy switching supply, for when you need a lot of power! It can supply 12V DC up to 5 Amps, running from 110V or 220V power (the plug it comes with is for US/Canada/Japan but you can use any plug adapter for your country, or just replace the cable with a standard 'figure-8'...

In Stock
[Buy Now](https://www.adafruit.com/product/352)
[Related Guides to the Product](https://learn.adafruit.com/products/352/guides)
### 36mm  Square 12V Digital RGB LED Pixels (Strand of 20)

[36mm  Square 12V Digital RGB LED Pixels (Strand of 20)](https://www.adafruit.com/product/683)
RGB Pixels are digitally-controllable lights you can set to any color, or animate. Each metal 'pixel square' contains 4 RGB LEDs and a controller chip soldered to a PCB. The pixel is then 'flooded' with epoxy to make it water resistant, however we cannot say 100% waterproof you...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/683)
[Related Guides to the Product](https://learn.adafruit.com/products/683/guides)

## Related Guides

- [Wireless Game Show Poppers for the Classroom!](https://learn.adafruit.com/wireless-game-show-poppers.md)
- [OLED TRON Clock](https://learn.adafruit.com/oled-tron-clock.md)
- [Adafruit PN532 RFID/NFC Breakout and Shield](https://learn.adafruit.com/adafruit-pn532-rfid-nfc.md)
- [RePaper eInk Development Board](https://learn.adafruit.com/repaper-eink-development-board.md)
- [IR Sensor](https://learn.adafruit.com/ir-sensor.md)
- [Line Following Zumo Robot Using Simulink](https://learn.adafruit.com/line-following-zumo-robot-programmed-with-simulink.md)
- [Trellis 3D Printed Enclosure](https://learn.adafruit.com/trellis-3d-printed-enclosure.md)
- [TMP36 Temperature Sensor](https://learn.adafruit.com/tmp36-temperature-sensor.md)
- [Introducing Adafruit Trellis ](https://learn.adafruit.com/adafruit-trellis-diy-open-source-led-keypad.md)
- [LED Lightbox](https://learn.adafruit.com/led-lightbox.md)
- [Arduino Lesson 12. LCD Displays - Part 2](https://learn.adafruit.com/adafruit-arduino-lesson-12-lcd-displays-part-2.md)
- [Adafruit Music Maker Shield](https://learn.adafruit.com/adafruit-music-maker-shield-vs1053-mp3-wav-wave-ogg-vorbis-player.md)
- [Arduino "Hunt The Wumpus"](https://learn.adafruit.com/arduino-hunt-the-wumpus.md)
- [Nokia 5110/3310 Monochrome LCD](https://learn.adafruit.com/nokia-5110-3310-monochrome-lcd.md)
- [Babel Fish](https://learn.adafruit.com/babel-fish.md)
