User Tools

Site Tools


digispark:tutorials:rgb

Differences

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

Link to this comparison view

Next revision
Previous revision
digispark:tutorials:rgb [2012/12/09 01:13]
digistump created
digispark:tutorials:rgb [2015/06/03 00:23]
oscomputing [Programming:]
Line 1: Line 1:
-RGB Tutorial+======RGB Shield Kit Tutorial====== 
 + 
 +=====Product Description:​===== 
 +[[https://​s3.amazonaws.com/​digispark/​images/​m/​rgb1.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​rgb1.jpg}}]][[https://​s3.amazonaws.com/​digispark/​images/​m/​rgb3.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​rgb3.jpg}}]][[https://​s3.amazonaws.com/​digispark/​images/​m/​rgb2.jpg|{{https://​s3.amazonaws.com/​digispark/​images/​t/​rgb2.jpg}}]] 
 + 
 +The RGB Shield Kit allows you to build a Digispark shield that connects a Red-Green-Blue tri-colored LED to the Digispark development board. Using the PWM (Pulse Width Modulation) features of the Digispark you can mix the three colors to achieve millions of different shades. Use it as a status indicator, a light show, or even connect it to your computer and change the color remotely. 
 + 
 +This is an unassembled kit and requires basic soldering. This is designed for use with the Digispark development board, which is not included.
  
  
 =====Parts:​===== =====Parts:​=====
  
-^ Image      ​^ Part       ^ Quantity ​         ^Identification +^ Part       ^ Quantity ​         ^Identification^ 
-| {{https://​s3.amazonaws.com/​digispark/​tutorials/​rgb/​board.jpg}}  ​| RGB Shield PCB|1| | +| RGB Shield PCB|1| | 
-| {{https://​s3.amazonaws.com/​digispark/​tutorials/​rgb/​100.jpg}} ​   ​| 100 (100R) Ohm 1/4W resistor 1% or 5%|2| Brown - Black - Brown| +| 100 ohm 1/4 W resistor 1% or 5%|2| Brown - Black - Brown| 
-| {{https://​s3.amazonaws.com/​digispark/​tutorials/​rgb/​180.jpg}} ​   ​| 180 (180R) Ohm 1/4W resistor 1% or 5%|1| Brown - Grey - Brown| +| 180 ohm 1/4 W resistor 1% or 5%|1| Brown - Grey - Brown| 
-| {{https://​s3.amazonaws.com/​digispark/​tutorials/​rgb/​led.jpg}} ​   ​| RGB Common Cathode LED|1| +| RGB Common Cathode LED|1| 
-{{https://​s3.amazonaws.com/​digispark/​tutorials/​headers.jpg}} ​   | 1x40pin ​male 0.1" pitch header| 9 pins worth| |+1x40 pin male 0.1" pitch header| 9 pins worth| |
  
-**Resistor Values:** For more information on how to identify the value of the resistors we recommend these sites:+**Resistor Values:** For more information on how to identify the value of the resistorswe recommend these sites:
 A nice simple resistor calculator: http://​www.ealnet.com/​m-eal/​resistor/​resistor.htm A nice simple resistor calculator: http://​www.ealnet.com/​m-eal/​resistor/​resistor.htm
 A comprehensive article on identification:​ http://​www.diyaudioandvideo.com/​Electronics/​Color/​ A comprehensive article on identification:​ http://​www.diyaudioandvideo.com/​Electronics/​Color/​
Line 18: Line 25:
 Soldering Basics (http://​www.sparkfun.com/​tutorials/​106) and Soldering Crash Course from the folks at Sparkfun (http://​www.sparkfun.com/​tutorials/​354). Soldering Basics (http://​www.sparkfun.com/​tutorials/​106) and Soldering Crash Course from the folks at Sparkfun (http://​www.sparkfun.com/​tutorials/​354).
 How to solder from the Curious Inventor: http://​store.curiousinventor.com/​guides/​How_to_Solder How to solder from the Curious Inventor: http://​store.curiousinventor.com/​guides/​How_to_Solder
 +
 +Adafruit has this excellent guide that starts with the tools needed and then shows detailed pictures, including some of the common problems that beginners experience (http://​learn.adafruit.com/​adafruit-guide-excellent-soldering)
  
 **We assume for these assembly instructions that you know the basics of thru-hole soldering. If you don't check out the links above, these boards are very easy to solder - we promise!** **We assume for these assembly instructions that you know the basics of thru-hole soldering. If you don't check out the links above, these boards are very easy to solder - we promise!**
Line 24: Line 33:
 =====Assembly:​===== =====Assembly:​=====
  
-{{https://​s3.amazonaws.com/​digispark/​tutorials/​rgb/​s1.jpg}} 
  
-Empty kit (or if using a raw PCB, aquire ​parts) ​bag and verify contents. ​+Empty kit bag (or if using a raw PCB, acquire ​parts) and verify contents. ​
 **Note for Kickstarter Backers and Pre-orders:​** Headers are not included in each kit bag, but the entire order came with more than enough headers for all kits. **Note for Kickstarter Backers and Pre-orders:​** Headers are not included in each kit bag, but the entire order came with more than enough headers for all kits.
  
-{{https://​s3.amazonaws.com/​digispark/​tutorials/rgb/s2.jpg}}+[[https://​s3.amazonaws.com/​digispark/​images/​m/​rgb1.jpg|{{https://​s3.amazonaws.com/​digispark/​images/t/rgb1.jpg}}]]
  
 Solder resistors one at a time. Match the value of resistor with the number written within the resistor outline on the board. Solder the leads and clip off the excess. Repeat for all resistors. Solder resistors one at a time. Match the value of resistor with the number written within the resistor outline on the board. Solder the leads and clip off the excess. Repeat for all resistors.
  
-{{https://​s3.amazonaws.com/​digispark/​tutorials/rgb/s1.jpg}}+[[https://​s3.amazonaws.com/​digispark/​images/​m/​rgb5.jpg|{{https://​s3.amazonaws.com/​digispark/​images/t/rgb5.jpg}}]]
  
-When inserting the LED into the board ensure the longest lead of the LED goes through the hole marked ground - this ensure you ahve the LED oriented properly. Solder the LED leads and clip off the excess.+When inserting the LED into the board ensure the longest lead of the LED goes through the hole marked ground - this will ensure you have the LED oriented properly. Solder the LED leads and clip off the excess.
  
  
-{{https://​s3.amazonaws.com/​digispark/​tutorials/rgb/s1.jpg}}+[[https://​s3.amazonaws.com/​digispark/​images/​m/​rgb4.jpg|{{https://​s3.amazonaws.com/​digispark/​images/t/rgb4.jpg}}]]
  
-Cut a length ​of male headers 6 pins long and one 3 pins long. Insert into corresponding positions (on the bottom of the board) and solder each pin.+Cut two lengths ​of male headers, one 6 pins long and another ​3 pins long. Insert into corresponding positions (on the bottom of the board) and solder each pin.
  
-**Tip:​** ​Inseting ​the headers into a breadboard and then placing the board on top can make this process easier.+**Tip:​** ​Inserting ​the headers into a breadboard and then placing the board on top can make this process easier.
  
 **Note:** If you are using stackable headers, use them here instead of the standard male headers. **Note:** If you are using stackable headers, use them here instead of the standard male headers.
  
  
-{{https://​s3.amazonaws.com/​digispark/​tutorials/rgb/s1.jpg}}+[[https://​s3.amazonaws.com/​digispark/​images/​m/​rgb3.jpg|{{https://​s3.amazonaws.com/​digispark/​images/t/rgb3.jpg}}]]
  
 Your RGB shield is complete! Your RGB shield is complete!
Line 55: Line 63:
 =====Programming:​===== =====Programming:​=====
  
-**Note:** The programming sections assumes you've installed the Arduino IDE and the Digispark Add-ons: [[SoftwareSetup]]+**Note:** The programming sections assumes you've installed the Arduino IDE and the Digispark Add-ons: [[digispark:​tutorials:​connecting|Connecting and Programming Your Digispark]].
  
-The RGB shield uses the following pins to control the LEDS+The RGB shield uses the following pins to control the LEDs
-Pin 0 -> Red +Pin 0 -> Red LED 
-Pin 1 -> Green +Pin 1 -> Green LED 
-Pin 2 -> Blue+Pin 2 -> Blue LED
  
 Turning a color on or off is as simple as this: Turning a color on or off is as simple as this:
  
 <code arduino> <code arduino>
-void setup() {                 +void setup() { 
-  // initialize ​the LED pins as outputs +    // Initialize ​the LED pins as outputs 
-  pinMode(0, OUTPUT); ​    ​ +    pinMode(0, OUTPUT); 
-  pinMode(1, OUTPUT); ​    ​ +    pinMode(1, OUTPUT); 
-  pinMode(2, OUTPUT); ​    ​+    pinMode(2, OUTPUT);
 } }
  
 void loop() { void loop() {
-  ​digitalWrite(0,​ HIGH); ​  // turn the Red LED On +    ​digitalWrite(0,​ HIGH); ​ // Turn the red LED On 
-  delay(1000); ​             // wait for a second +    delay(1000); ​           // Wait for a second 
-  digitalWrite(1,​ HIGH); ​  // turn the Green LED On +    digitalWrite(1,​ HIGH); ​ // Turn the green LED On 
-  delay(1000); ​             // wait for a second +    delay(1000); ​           // Wait for a second 
-  digitalWrite(2,​ HIGH); ​  // turn the Blue LED On +    digitalWrite(2,​ HIGH); ​ // Turn the blue LED On 
-  delay(1000); ​             // wait for a second +    delay(1000); ​           // Wait for a second 
-  digitalWrite(0,​ LOW);     // turn the Red LED off +    digitalWrite(0,​ LOW);   ​// Turn the red LED off 
-  digitalWrite(1,​ LOW);     ​// turn the Green LED off +    digitalWrite(1,​ LOW);   ​// Turn the green LED off 
-  digitalWrite(2,​ LOW);     ​// turn the Blue LED off +    digitalWrite(2,​ LOW);   ​// Turn the blue LED off 
-  delay(1000); ​             // wait for second+    delay(1000); ​           // Wait for one second
 } }
 </​code>​ </​code>​
  
-Take a look at the * and * examples ​for more advanced ​uses.+**PWM Note:** While the red and green LEDs are connected to pins that support PWM, the blue LED is not - this is because the third PWM pin is used by the USB communications and we figure most will want to use the RGB shield with USB communication. See Examples->​DigisparkRGB->​DigisparkRGB or Examples->​DigisparkUSB->​DigiBlink for examples of using software PWM for pin 2 (blue LED). 
 + 
 +If you are not planning to use USB communication:​ If you want to connect the blue LED to P4 instead of P2 - flip the shield over and you'll see two solder jumpers, one has a little trace connecting its two pads, the other doesn'​t - cut the one with the trace and bridge the other with solder. This will disconnect the blue LED from P2 and connect it to P4. 
 + 
 +In the Arduino IDE, take a look at the Examples -> DigisparkRGB -> DigisparkRGB example ​for more advanced ​usage. When using that example you must set your board type as Digispark (Tiny Core) for it to work. 
digispark/tutorials/rgb.txt · Last modified: 2016/06/09 12:03 (external edit)