User Tools

Site Tools


tutorials:products:pixel12mm:index.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:products:pixel12mm:index.html [2012/01/27 01:23]
pburgess
tutorials:products:pixel12mm:index.html [2016/01/28 18:05] (current)
Line 1: Line 1:
 ==== LED full color (RGB) Pixels! ==== ==== LED full color (RGB) Pixels! ====
  
-RGB Pixels are digitally-controllable lights you can set to any color, or animate. Each pixel contains an RGB LED and a controller chip molded into a '​dot'​ of silicone, with flanges so they can be pushed into holes in thin sheet material. The dots are waterproof and rugged — they'​re typically used to make outdoor signs.+RGB Pixels are digitally-controllable lights you can set to any color, or animate. Each pixel contains an RGB LED and a controller chip molded into a '​dot'​ of silicone, with flanges so they can be pushed into holes in thin sheet material. The dots are waterproof and rugged — they'​re typically used to make outdoor signs.
  
-**Basic stats** ​\\+**Basic stats**
  
-  * 12mm diameter round waterproof pixels +  * 12mm diameter round waterproof pixels ​ 
-  * Approximately ​inches (100mm) apart on 4-pin strand+  * Comes in both "​Bullet"​ (thin) shape and "​Square"​ (flat) shapes 
 +  * Approximately ​inches (80mm) apart on 4-pin strand 
 +  * 5 Volts DC, 60 milliamps max per pixel (all LEDs on, full white)
   * WS2801 LED driver chip provides 24-bit color: [[http://​www.adafruit.com/​datasheets/​WS2801.pdf|Datasheet]]   * WS2801 LED driver chip provides 24-bit color: [[http://​www.adafruit.com/​datasheets/​WS2801.pdf|Datasheet]]
-  ​* 5 Volts DC, 60 milliamps peak per pixel (all LEDs on, full white) +  * 2-pin SPI-like protocol ​— easy for Arduino and other microcontrollers
-  ​* 2-pin SPI-like protocol+
  
-[[http://​www.adafruit.com/​products/322|You can pick up RGB pixels in strands of 25 from the Adafruit shop]].+[[http://​www.adafruit.com/​category/37_87|You can pick up RGB pixels in strands of 25 from the Adafruit shop]].
  
 Here's a video showing some 12mm pixels running a test pattern: Here's a video showing some 12mm pixels running a test pattern:
Line 17: Line 18:
 {{flickrvid>​5262163094}} {{flickrvid>​5262163094}}
  
-==== Overview ==== +==== Project ​Ideas ====
- +
-{{ :​tutorials:​products:​pixel12mm:​12mmpixels.jpg?​nolink&​ |}} +
- +
-Our 12mm pixels use an 8mm diffused RGB LED — diffused pixels mix colors nicer. At 5 Volts, they draw a maximum of 60 mA per pixel: 20mA each for red, green and blue. +
- +
-The LED pixels are spaced along strands of ribbon cable, with about 4 inches or 100mm 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. +
- +
-{{ :​tutorials:​products:​pixel12mm:​12mmwires.jpg?​nolink&​ |}} +
- +
-==== Ideas ====+
  
 These pixels could be used for stuff like… These pixels could be used for stuff like…
  
-LED coffee tables (this one is 'hand made' but you could skip the wiring/​drivers part and just use a long strand of our LED pixels)+LED coffee tables (this one is 'hand made' but you could skip the wiring/​drivers part and just use a long strand of our LED pixels ​now)
  
 {{youtube>​Tj1j1-dIX6k}} {{youtube>​Tj1j1-dIX6k}}
  
-A 'strand' ​of LEDs like a digital LED strip but easier to control!+trippy ​'light bar':
  
 {{vimeo>​16297109}} {{vimeo>​16297109}}
  
-A '​ball'​ of LEDs:+Signs or displays:
  
-{{vimeo>16303734}}+{{youtube>EkrZbBEqcjo}}
  
-sign or display:+ball of LEDs:
  
-{{youtube>EkrZbBEqcjo}}+{{vimeo>16303734}}
  
-A matrix or video wall can also be created:+A matrix or video wall can also be created, as with our [[https://​www.adafruit.com/​products/​611|Adavision kit]]:
  
 {{vimeo>​33417250}} {{vimeo>​33417250}}
  
-==== Driver chip ====+==== Overview ​====
  
-Every pixel contains a small microchip within the silicone dot. The WS2801 ​LED driver chip is custom designed for this purposeThese chips are very simple to communicate with — all they do is shift color data in from one pin and out another. To issue data from microcontroller such as an Arduino, one "​shifts out" 24 bits of color information — the first data out corresponds to the pixel closest to the microcontroller. To write data to 10 LEDsyou would issue 240 bits (10 * 24). Following the data, a 500 microsecond pause will "​latch"​ the data and present the new LED colors.+Our 12mm pixels use an 8mm diffused RGB LED — diffused pixels mix colors nicerAt 5 Volts, ​they draw maximum ​of 60 mA per pixel: 20mA each for redgreen and blue.
  
-==== Powering 12mm pixels ​====+{{ :​tutorials:​products:​pixel12mm:​12mmpixels.jpg?​nolink&​ |}} 
 +{{ :​tutorials:​products:​pixel12mm:​id738rainbow_lrg.jpg?​500 |}} 
 + 
 +The LED pixels are spaced along a strand of ribbon cable, with about 3 inches or 80mm 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. 
 + 
 +{{ :​tutorials:​products:​pixel12mm:​12mmwires.jpg?​nolink&​ |}} 
 + 
 +==== Powering 12mm Pixels ​====
  
 An important part of running a lot of LEDs is to keep track of power usage. Individual LEDs don't get very hot or use tons of power, but they add up fast! An important part of running a lot of LEDs is to keep track of power usage. Individual LEDs don't get very hot or use tons of power, but they add up fast!
  
-Each single 12mm RGB LED pixel can draw up to 60mA from a 5V supply. That means a strand of 25 can use up to 1.5 A. Of course this is assuming all the LEDs are on. If you keep most of the LEDs off (by color swirling or patterns) the power usage can be 1/3 this or less.+Each single 12mm RGB LED pixel can draw up to 60mA from a 5V supply. That means a strand of 25 can use up to 1.5 Amps. Of course this is assuming all the LEDs are on. If you keep most of the LEDs off (by color swirling or patterns) the power usage can be 1/3 this or less.
  
 We suggest a nice switching supply for driving LED pixels: either a [[http://​www.adafruit.com/​products/​276|5 Volt 2 Amp supply]] for a strand or two, or our [[http://​www.adafruit.com/​products/​658|5 Volt 10 Amp supply]] for larger installations. For really massive projects, a [[http://​www.instructables.com/​pages/​search/​search.jsp?​ie=ISO-8859-1&​q=ATX|slightly modified ATX computer power supply]] can provide 30 Amps to power upwards of 500 pixels! We suggest a nice switching supply for driving LED pixels: either a [[http://​www.adafruit.com/​products/​276|5 Volt 2 Amp supply]] for a strand or two, or our [[http://​www.adafruit.com/​products/​658|5 Volt 10 Amp supply]] for larger installations. For really massive projects, a [[http://​www.instructables.com/​pages/​search/​search.jsp?​ie=ISO-8859-1&​q=ATX|slightly modified ATX computer power supply]] can provide 30 Amps to power upwards of 500 pixels!
  
-As shown below, connect ground to both your power supply and microcontroller. Then connect the 5V pin to the power supply. A large capacitor (1000uF or so) is a nice addition to keep ripple down.+**IMPORTANT:​ Never, //never// connect more than 5 Volts to the pixels! This will permanently damage them!** 
 + 
 +As shown later, connect ground to both your power supply and microcontroller. Then connect the 5V pin to the power supply. A large capacitor (1000uF or so) between 5V and ground ​is a nice addition to keep ripple down. 
 + 
 +==== Driver Chip ==== 
 + 
 +Each pixel contains a small microchip within the silicone dot. The WS2801 LED driver chip is custom designed for this purpose. These chips are very simple to communicate with — all they do is shift color data in from one pin and out another. To issue data from a microcontroller such as an Arduino, one "​shifts out" 24 bits of color information — the first data out corresponds to the pixel closest to the microcontroller. To write data to 10 LEDs, you would issue 240 bits (10 * 24). Following the data, a 500 microsecond pause will "​latch"​ the data and show the new LED colors. 
 + 
 +<class notewarning>​ 
 + 
 +**PLEASE NOTE: THE LED DRIVER CHIP AND WIRE COLORS HAVE CHANGED FROM EARLIER BATCHES OF THESE PIXELS. ANYTHING PURCHASED AFTER AUGUST 2011 SHOULD MATCH THE FOLLOWING DECRIPTION. We initially sold LEDs in this form factor using the LPD6803 driver chip (BEFORE August 2011). If you are using those pixels, [[http://​www.ladyada.net/​products/​pixel20mm/​index.html|please go to the 20mm pixel tutorial]] — the wiring and code are the same, and nothing further here applies. After switching to the WS2801 chip, the first batch used different wire colors, but the order and functions are the same as described below.**
  
 +</​class>​
 ==== Wiring ​ ==== ==== Wiring ​ ====
  
-The great thing about these pixels is that they'​re digitally controlled…that is, even though there are only two control lines (data and clock inputs), you can put as many pixels as you'​d ​line in a continuous row, yet each one remains independently controllable.+The great thing about these pixels is that they'​re digitally controlled…that is, even though there are only two control lines (data and clock inputs), you can put as many pixels as you'​d ​like in a single long strand, yet each one remains independently controllable.
  
-Though it looks like the 4-conductor ribbon cable is continuous, //it isn'​t!//​ The ground and 5V lines pass through from one pixel to the next, but the two data control lines are different on the input and output sides. The input side goes to the LED driver chip, which then drives ​the output to the next pixel in the strand.+Though it looks like the 4-conductor ribbon cable is continuous, //it isn'​t!//​ The ground and 5V lines pass through from one pixel to the next, but the two data control lines are different on the input and output sides. The input side goes to the LED driver chip, which then drives ​its own output to the next pixel in the strand.
  
-When connecting these pixels to a microcontroller,​ make sure you're connecting to the strand'​s **input** pins! Best way to distinguish the correct end is to closely examine the circuit board embedded in the first pixel, looking for the arrow and "​INPUT"​ label. If connecting multiple strands together, make sure the output of one strand goes to the input of the next.+When connecting these pixels to a microcontroller,​ make sure you're connecting to the strand'​s **input** pins! Best way to distinguish the correct end is to closely examine the circuit board embedded in the first pixel. If its a WHITE PCBtry looking for the "​INPUT"​ label. If connecting multiple strands together, make sure the output of one strand goes to the input of the next.
  
 {{ :​tutorials:​products:​pixel12mm:​12mminput.jpg?​nolink&​ |}} {{ :​tutorials:​products:​pixel12mm:​12mminput.jpg?​nolink&​ |}}
  
-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, unless you'll be using only a few LEDs at a time. The Arduino is only mean to drive about 500mA of current, and as we saw earlier, a fully-lit strand can require 1000mA or more! This is why we suggest using an external 5V supply.+If the PCB is Green, look for the black rectangular chip, this is the input 
 + 
 +{{ :​tutorials:​products:​pixel12mm:​12mmgreenpcb.jpg?​500 |}} 
 + 
 +If you have flat pixels, look for the embossed ARROW on the side of the pixel, connect to the end that's the '​tail'​ of the arrow (not the pointy head as that indicates which way the data travels down the strand'​ 
 + 
 +{{ :​tutorials:​products:​pixel12mm:​flatarrow.jpg?​500 |}} 
 + 
 + 
 +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, unless you'll be using only a few LEDs at a time. The Arduino is only meant to drive about 500mA of current, and as we saw earlier, a fully-lit strand can require 1000mA or more! This is why we suggest using an external 5V supply.
  
 Use this diagram with the red wire going to +5V 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. Use this diagram with the red wire going to +5V 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.
Line 81: Line 99:
 {{ :​tutorials:​products:​pixel12mm:​arduinowiring.png?​nolink&​ |}} {{ :​tutorials:​products:​pixel12mm:​arduinowiring.png?​nolink&​ |}}
  
-Our Arduino library (explained ​in the next section) can use any two pins, but the examples are written to use pins 2 and 3 as above. +Our Arduino library (explained ​below) can use any two pins, but the examples are written to use pins 2 and 3 as above.
- +
-**PLEASE NOTE: THE LED DRIVER CHIP AND WIRE COLORS HAVE CHANGED FROM EARLIER BATCHES OF THESE PIXELS. Anything purchased recently should match the above description. We initially sold LEDs in this form factor using the LPD6803 driver chip. If you are using those pixels, please go to the 20mm pixel tutorial — the wiring and code are the same. After switching to the WS2801 chip, the first batches then used blue, red, white and black wires for data, clock, ground and +5V, respectively. If in doubt, the wire functions are labeled on the INPUT side of the embedded circuit board.**+
  
 ==== Download ==== ==== Download ====
  
-To download the Arduino library, [[https://​github.com/​adafruit/​WS2801-Library|visit the repository on GitHub]]. +To download the Arduino library, [[https://​github.com/​adafruit/​Adafruit-WS2801-Library|visit the repository on GitHub]]. 
-Click the DOWNLOAD ZIP button near the upper left, extract the archive and then rename the uncompressed folder to WS2801. Confirm that this folder contains the files ''​WS2801.cpp''​ and ''​WS2801.h''​ and the ''​examples''​ folder.+Click the DOWNLOAD ZIP button near the upper left, extract the archive and then rename the uncompressed folder to ''​Adafruit_WS2801''​. Confirm that this folder contains the files ''​Adafruit_WS2801.cpp''​ and ''​Adafruit_WS2801.h''​ and the ''​examples''​ folder.
  
-Place the WS2801 ​folder inside your Arduino ''​libraries''​ folder. You may need to create this folder if it does not yet exist. In Windows, this would be ''​(home folder)\My Documents\Arduino\Libraries''​ and for Mac or Linux is ''​(home folder)/​Documents/​Arduino/​Libraries''​+Place the Adafruit_WS2801 ​folder inside your Arduino ''​libraries''​ folder. You may need to create this folder if it does not yet exist. In Windows, this would be ''​(home folder)\My Documents\Arduino\Libraries''​ and for Mac or Linux is ''​(home folder)/​Documents/​Arduino/​Libraries'' ​[[http://​www.ladyada.net/​library/​arduino/​libraries.html|We also have a tutorial on library installation]].
  
-[[http://​www.ladyada.net/​library/​arduino/​libraries.html|We also have a tutorial on library installation]]. ​After installing the WS2801 ​library, restart the Arduino IDE. You should now be able to access the sample code by navigating through menus in this order: File->​Sketchbook->​Libraries->​WS2801->​strandtest+After installing the Adafruit_WS2801 ​library, restart the Arduino IDE. You should now be able to access the sample code by navigating through menus in this order: File->​Sketchbook->​Libraries->​Adafruit_WS2801->​strandtest
  
 ==== Code! ==== ==== Code! ====
  
-Let's look through the strandtest 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 initialized ​with three variables: the number of pixels and the data and clock pins:+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:
  
 <code C> <code C>
 +int dataPin = 2;
 +int clockPin = 3;
 +
 // Set the first variable to the NUMBER of pixels. 25 = 25 pixels in a row // Set the first variable to the NUMBER of pixels. 25 = 25 pixels in a row
-WS2801 ​strip = WS2801(25, dataPin, clockPin);+Adafruit_WS2801 ​strip = Adafruit_WS2801(25, dataPin, clockPin);
 </​code>​ </​code>​
  
Line 114: Line 133:
 }</​code>​ }</​code>​
  
-''​begin()''​ initializes the library, while ''​show()'' ​updates ​the contents ​of the LEDs based on data in RAM. You'll need to call ''​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, because the full strip data must be issued regardless).+''​begin()''​ initializes the library, while ''​show()'' ​refreshes ​the displayed colors ​of the LEDs. You'll need to call ''​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, because the full strip data must be issued regardless).
  
 Let's look inside an example function, ''​colorWipe()''​. This creates a '​chase'​ sequence that fills the strip up with a color. It is basically a loop that increments through every pixel (which you can query with the ''​numPixels()''​ function) and sets the color of each (incremented with ''​i''​) to the value passed (''​c''​ — colors are expressed as a 32-bit variable type, though only the bottom 24 bits are used). The strip output is then updated with ''​show()''​. Finally there is some delay (otherwise this would happen instantly). Let's look inside an example function, ''​colorWipe()''​. This creates a '​chase'​ sequence that fills the strip up with a color. It is basically a loop that increments through every pixel (which you can query with the ''​numPixels()''​ function) and sets the color of each (incremented with ''​i''​) to the value passed (''​c''​ — colors are expressed as a 32-bit variable type, though only the bottom 24 bits are used). The strip output is then updated with ''​show()''​. Finally there is some delay (otherwise this would happen instantly).
Line 147: Line 166:
 </​code>​ </​code>​
  
-For example, in the ''​loop()''​ function we call colorWipe(Color(255,​ 0, 0), 50) which will fill the strand with full-red light, pausing about 50 milliseconds between pixels.+For example, in the ''​loop()''​ 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.
  
 <code C> <code C>
Line 153: Line 172:
   colorWipe(Color(0,​ 255, 0), 50);  // green fill   colorWipe(Color(0,​ 255, 0), 50);  // green fill
   colorWipe(Color(0,​ 0, 255), 50);  // blue fill   colorWipe(Color(0,​ 0, 255), 50);  // blue fill
-</​code> ​ +</​code>​
/home/ladyada/public_html/wiki/data/attic/tutorials/products/pixel12mm/index.html.1327627437.txt.gz · Last modified: 2016/01/28 18:05 (external edit)