User Tools

Site Tools


products:rgbledstrip: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
Next revision Both sides next revision
products:rgbledstrip:index.html [2010/11/09 22:45]
ladyada
products:rgbledstrip:index.html [2011/05/03 17:52]
schnoggo
Line 1: Line 1:
-====== ​LED strips! ​======+{{ flickrvid>​5162826878 }} 
 + 
 +====== ​Introduction ​======
  
 We love some good LED blinking as much as the next person but after years of LED-soldering we need something cooler to get us excited. Sure there are RGB LEDs and those are fun too but what comes after that? Well, we have the answer: **LED Strips**! These are __flexible__ circuit boards with full color LEDs soldered on. They take a lot of LED-wiring-drudgery out of decorating a room, car, bicycle, costume, etc. The ones we carry are also waterproof (although not all are). We love some good LED blinking as much as the next person but after years of LED-soldering we need something cooler to get us excited. Sure there are RGB LEDs and those are fun too but what comes after that? Well, we have the answer: **LED Strips**! These are __flexible__ circuit boards with full color LEDs soldered on. They take a lot of LED-wiring-drudgery out of decorating a room, car, bicycle, costume, etc. The ones we carry are also waterproof (although not all are).
Line 6: Line 8:
  
 The Digital-type strips work in a different way. They have a chip for each LED, to use the strip you have to send digitally coded data to the chips. However, this means you can control each LED individually! Because of the extra complexity of the chip, they are more expensive. The Digital-type strips work in a different way. They have a chip for each LED, to use the strip you have to send digitally coded data to the chips. However, this means you can control each LED individually! Because of the extra complexity of the chip, they are more expensive.
 +
 +**[[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=37&​products_id=285|You can buy waterproof analog-type RGB LED strips by the meter at the Adafruit shop!]]**
  
 ====== "​Analog"​ RGB LED strips ====== ====== "​Analog"​ RGB LED strips ======
Line 81: Line 85:
 {{  :​products:​rgbledstrip:​ledstripfet.gif ​ |}} {{  :​products:​rgbledstrip:​ledstripfet.gif ​ |}}
  
 +This diagram shows connecting up with power NPN transistors such as TIP120, where Base is pin 1, Collector is pin 2 and Emitter is pin 3. Its very similar except this time we have 100-220 ohm resistors between the PWM output pin and the base.
 +
 +{{  :​products:​rgbledstrip:​ledstripbjt.gif ​ |}}
 +
 +Connect a 9-12V power supply to the Arduino so that **Vin** supplies the high voltage to the LED strip. If you want, you can also just use a separate wire that connects to a power supply that provides about +12V. Make sure to connect the ground of that supply to the ground of the Arduino/​MOSFETs!
 +
 +====== Example code ======
 +
 +Once you have the strip wired up, it is easy to control the color of the strip by using PWM output, for Arduino you can use **analogWrite()** on pins 3, 5, 6, 9, 10 or 11 (for classic Arduinos using the Atmega328 or 168). An **analogWrite(pin,​ 0)** will turn that LED off, **analogWrite(pin,​ 127)** will turn it on half-way and **analogWrite(pin,​ 255)** will turn it on full blast. Here is some example code that performs a simple color-swirl.
 +
 +<code C>
 +// color swirl! connect an RGB LED to the PWM pins as indicated
 +// in the #defines
 +// public domain, enjoy!
 +
 +#define REDPIN 5
 +#define GREENPIN 6
 +#define BLUEPIN 3
 +
 +#define FADESPEED 5     // make this higher to slow down
 +
 +void setup() {
 +  pinMode(REDPIN,​ OUTPUT);
 +  pinMode(GREENPIN,​ OUTPUT);
 +  pinMode(BLUEPIN,​ OUTPUT);
 +}
 +
 +
 +void loop() {
 +  int r, g, b;
 +
 +  // fade from blue to violet
 +  for (r = 0; r < 256; r++) { 
 +    analogWrite(REDPIN,​ r);
 +    delay(FADESPEED);​
 +  } 
 +  // fade from violet to red
 +  for (b = 255; b > 0; b--) { 
 +    analogWrite(BLUEPIN,​ b);
 +    delay(FADESPEED);​
 +  } 
 +  // fade from red to yellow
 +  for (g = 0; g < 256; g++) { 
 +    analogWrite(GREENPIN,​ g);
 +    delay(FADESPEED);​
 +  } 
 +  // fade from yellow to green
 +  for (r = 255; r > 0; r--) { 
 +    analogWrite(REDPIN,​ r);
 +    delay(FADESPEED);​
 +  } 
 +  // fade from green to teal
 +  for (b = 0; b < 256; b++) { 
 +    analogWrite(BLUEPIN,​ b);
 +    delay(FADESPEED);​
 +  } 
 +  // fade from teal to blue
 +  for (g = 255; g > 0; g--) { 
 +    analogWrite(GREENPIN,​ g);
 +    delay(FADESPEED);​
 +  } 
 +}
 +</​code>​
/home/ladyada/public_html/wiki/data/pages/products/rgbledstrip/index.html.txt · Last modified: 2016/01/28 18:05 (external edit)