This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tutorials:products:digitalrgbledstrip:index.html [2011/08/08 17:11] ladyada |
tutorials:products:digitalrgbledstrip:index.html [2012/05/13 15:41] adafruit_support [FAQ & Troubleshooting] |
||
---|---|---|---|
Line 38: | Line 38: | ||
*32 LEDs per meter (16 segments) | *32 LEDs per meter (16 segments) | ||
*Removable IP65 waterproof casing | *Removable IP65 waterproof casing | ||
- | *Maximum 5V @ 120mA draw per 2.5" strip segment (all LEDs on full brightness) | + | *Maximum 5V @ 120mA draw per 2.5" strip segment (all LEDs on full brightness) - about 2A per meter |
*2 common-anode RGB LEDs per segment, individually controllable | *2 common-anode RGB LEDs per segment, individually controllable | ||
*LED wavelengths: 630nm/530nm/475nm | *LED wavelengths: 630nm/530nm/475nm | ||
*Microcontroller required to control strip | *Microcontroller required to control strip | ||
- | |||
- | HL1606 LED controller chip with 'SPI'-like protocol ([[http://www.adafruit.com/datasheets/HL1606S.pdf|Chinese Datasheet]]) We also have a link to the [[http://www.adafruit.com/datasheets/HL1606E.pdf|english datasheet]] but since the pinout is incorrect we don't know how trustworthy it is. YMMV | ||
- | |||
- | |||
==== Project Ideas ==== | ==== Project Ideas ==== | ||
Line 68: | Line 64: | ||
==== Schematic ==== | ==== Schematic ==== | ||
- | The strip is made up of 2.5" segments. Each segment is independant and so you can cut the strip down on the segment boundaries, or extend them, or split them up, etc. | + | The strip is made up of 2.5" segments. Each segment is independent and so you can cut the strip down on the segment boundaries, or extend them, or split them up, etc. |
+ | |||
+ | This is what the HL1606-based strip segments look like: | ||
[[http://www.ladyada.net/images/digitalledstrip/digitalledstripsegment.jpg|{{ http://www.ladyada.net/images/digitalledstrip/digitalledstripsegment_t.jpg?nolink&400x186 |}}]] | [[http://www.ladyada.net/images/digitalledstrip/digitalledstripsegment.jpg|{{ http://www.ladyada.net/images/digitalledstrip/digitalledstripsegment_t.jpg?nolink&400x186 |}}]] | ||
+ | the LPD8806-based strip looks like this (its thinner, and has fewer 'pads' on the side) | ||
- | Each segment basically acts like this: | + | {{ http://www.ladyada.net/images/digitalledstrip/lpd8806segment_t.jpg |}} |
- | {{ http://www.ladyada.net/images/digitalledstrip/hl1606segment.png?nolink&644x477 |}} | + | Each segment basically acts like this |
+ | |||
+ | {{ http://www.ladyada.net/images/digitalledstrip/hl1606segment.png?nolink&644x477 |}} | ||
- | There is one HL1606 latch chip, it controls 6 LEDs (2 x RGB) with 4 input data lines and 4 output data lines. Data is sent on the **DI **(data in) pin and **CI **(clock in) pin. The **LI** (latch in) pin is used to 'push' the data down the line. to the next chip through the **DO** (data out), **CO **and **LO** pins. By alternating data sends and latch twiddles, you can write to near infinite number of LEDs in the strand. | + | There is one chip (either HL1606 or LPD8806) latch chip, it controls 6 LEDs (2 x RGB) with 2 or 4 input data lines and 2 or 4 output data lines. The HL1606 uses 4 pins, the LPD8806 uses only 2. For both, data is sent on the **DI**(data in) pin and **CI **(clock in) pin. The HL1606 also uses the **LI** (latch in) pin to 'push' the data down the line to the next chip through the **DO** (data out), **CO** and **LO** pins. The LPD8806 has a slightly smarter method by which you send special data to let it know its time to latch. By alternating data sends and latching, you can write to near infinite number of LEDs in the strand - limited pretty much by the power supply! |
- | The **SI** pin is used to 'strobe' the built in fading function. We've had difficulty getting it to work reliably in a way that doesn't suck so we wont be using it in the tutorial. | + | The **SI** pin is used by the HL1606 to 'strobe' the built in fading function. We've had difficulty getting it to work reliably in a way that doesn't suck so we wont be using it in the tutorial. |
- | The whole thing is run off of 5V, and data signal should be 5V (although we suppose you can try 3.3V, it might work) | + | The whole thing is run off of 5V, and data signal should be 5V (although we suppose you can try 3.3V data signals, it might work) |
Line 94: | Line 95: | ||
- | Each segment has 6 LEDs total. Each LED draws about 20mA when lit at full brightness. So if you have the segment set to full white, that will be 120mA from a 5V supply. | + | Each segment has 6 LEDs total (two red, two green and two blue). Each LED draws about 20mA when lit at full brightness. So if you have the segment set to full white, that will be 120mA from a 5V supply. |
Line 108: | Line 109: | ||
- | In reality, this is an upper limit. If your project doesnt light up all the LEDs, and uses colors instead of just bright white, the power usage will be a quarter or half. Either way, you'll want to keep this in mind, the power usage adds up and overdrawing from a small power adapter can damage it permanently | + | In reality, this is an upper limit. If your project doesn't light up all the LEDs, and uses colors instead of just bright white, the power usage will be a quarter or half. Either way, you'll want to keep this in mind, the power usage adds up and overdrawing from a small power adapter can damage it permanently |
- | ==== Wiring ==== | ||
+ | ==== Which type of strip do I have? ==== | ||
- | The toughest part of the project is probably just soldering to the strip, its very easy to use! | + | As we mentioned, there are two strips you may have. If you ordered before August 2011 its going to be the HL1606 type, otherwise you probably have the LPD8806 type. Its not too hard to tell the difference. Look at the segments of the strip and find the 'pads' on the side of each 2.5" segment. The HL1606 strips have **6** pads on each side. the LPD8806 have **4** pads on each side: |
+ | This is what the HL1606-based strip segments look like: | ||
+ | [[http://www.ladyada.net/images/digitalledstrip/digitalledstripsegment.jpg|{{ http://www.ladyada.net/images/digitalledstrip/digitalledstripsegment_t.jpg?nolink&400x186 |}}]] | ||
- | First, cut the piece to the length you want, on the cuttable boundaries. Next, tin the 6 **INPUT** pins (make sure you're connecting to **SI/CI/DI/LI ** which is input, not the corresponding **SO/etc** pins!) | + | the LPD8806-based strip looks like this (its thinner, and has fewer 'pads' on the side) |
- | **JUST BECAUSE YOU HAVE A STRIP WITH WIRES SOLDERED ON DOES NOT MEAN THEY ARE ON THE RIGHT SIDE, THEY COULD BE ON THE OUTPUT PINS. CHECK THREE TIMES TO MAKE SURE YOU ARE CONNECTING TO THE INPUT SIDE** | + | {{ http://www.ladyada.net/images/digitalledstrip/lpd8806segment_t.jpg |}} |
- | Tin the pads by carefully melting a little solder onto the pads | + | **[[http://www.ladyada.net/wiki/tutorials/products/digitalrgbledstrip/index-hl1606.html|IF YOU HAVE THE HL1606 BASED STRIP, CLICK HERE TO CONTINUE THE TUTORIAL - We split off the tutorial here to avoid confusion since the strips look similar!]]** |
+ | ==== Wiring the LPD8806 based strips ==== | ||
+ | ** This wiring tutorial is for the LPD8806 only - its a little bit different than the HL1606 so if the photos don't match up, check which kind you have! ** [[http://www.ladyada.net/wiki/tutorials/products/digitalrgbledstrip/index-hl1606.html|If you have a HL1606 strip, click here to read that tutorial!]] | ||
- | [[http://www.ladyada.net/images/digitalledstrip/tin.jpg|{{ http://www.ladyada.net/images/digitalledstrip/tin_t.jpg?nolink&500x319 |}}]] | ||
- | [[http://www.ladyada.net/images/digitalledstrip/tinned.jpg|{{ http://www.ladyada.net/images/digitalledstrip/tinned_t.jpg?nolink&500x242 |}}]] | + | The toughest part of the project is probably just soldering to the strip, its very easy to use! First, cut the piece to the length you want, on the cuttable boundaries. Next, tin the 4 **INPUT** pins (make sure you're connecting to **5V/CI/DI/GND** which is input, not the corresponding **5V/CO/DO/GND** pins!). To make the images clearer, we removed the plastic covering for this tutorial. However, you can just cut a little bit away on yours to allow you to access the pads. Once you take off the plastic cover its a bit difficult to get it back on |
- | Solder the +5V power wire to the +5V pin, we'll use red | + | **JUST BECAUSE YOU HAVE A STRIP WITH WIRES SOLDERED ON DOES NOT MEAN THEY ARE ON THE RIGHT SIDE, THEY COULD BE ON THE OUTPUT PINS. CHECK THREE TIMES TO MAKE SURE YOU ARE CONNECTING TO THE INPUT SIDE!** |
- | [[http://www.ladyada.net/images/digitalledstrip/pwrsolder.jpg|{{ http://www.ladyada.net/images/digitalledstrip/pwrsolder_t.jpg?nolink&500x340 |}}]] | ||
- | Connect the ground signal/power pin to **GND **- we'll use black | + | Tin the pads by carefully melting a little solder onto the pads |
- | [[http://www.ladyada.net/images/digitalledstrip/gndsolder.jpg|{{ http://www.ladyada.net/images/digitalledstrip/gndsolder_t.jpg?nolink&500x397 |}}]] | + | [[http://www.ladyada.net/images/digitalledstrip/lpdtin2.jpg|{{ http://www.ladyada.net/images/digitalledstrip/lpdtin2_t.jpg?nolink |}}]] |
- | [[http://www.ladyada.net/images/digitalledstrip/pwrgndwire.jpg|{{ http://www.ladyada.net/images/digitalledstrip/pwrgndwire_t.jpg?nolink&500x402 |}}]] | + | [[http://www.ladyada.net/images/digitalledstrip/lpdtin.jpg|{{ http://www.ladyada.net/images/digitalledstrip/lpdtin_t.jpg?nolink |}}]] |
- | Follow up by connecting the data lines. We wont be using the **SI** pin (the strobe function of the chip is not supported by our example code), so connect Yellow to **LI **(latch), Green to **CI**** **(clock), and Blue to **DI** (data) | + | Start by soldering a red wire to the +5V power line |
- | [[http://www.ladyada.net/images/digitalledstrip/allsoldered.jpg|{{ http://www.ladyada.net/images/digitalledstrip/allsoldered_t.jpg?nolink&500x393 |}}]] | + | [[http://www.ladyada.net/images/digitalledstrip/lpd5v.jpg|{{ http://www.ladyada.net/images/digitalledstrip/lpd5v_t.jpg?nolink |}}]] |
- | Great! You're now ready to use the strip. You may want to use heatshrink to provide a secure cover for the wires, or stuff hotglue in the end, which will do the same. | + | Next connect two wires to the data and clock pads. We'll use yellow for the Clock pin (CI) and green for the data pin (DI) |
+ | [[http://www.ladyada.net/images/digitalledstrip/lpddata.jpg|{{ http://www.ladyada.net/images/digitalledstrip/lpddata_t.jpg?nolink |}}]] | ||
- | ==== Basic Usage ==== | + | Finally, solder a black wire to ground |
+ | [[http://www.ladyada.net/images/digitalledstrip/lpdground.jpg|{{ http://www.ladyada.net/images/digitalledstrip/lpdground_t.jpg?nolink |}}]] | ||
- | The HL1606 is not a common chip for most people, so the best way to explain it is to say its basically a 74HC595. Like a '595 there is an SPI input and then there is a shift-output so you can chain them. The HL1606 has 6 outputs and they're specifically for driving LEDs. The most basic way to use them is to set each LED on or off. This means you can have up to 8 primary 'colors' on an LED: red, yellow, green, teal, blue, violet, white and black. | + | That's it! Now you're ready to use the strip. You may want to use heatshrink to provide a secure cover for the wires, or stuff hotglue in the end, which will do the same. |
+ | [[http://www.ladyada.net/images/digitalledstrip/lpdwired.jpg|{{ http://www.ladyada.net/images/digitalledstrip/lpdwired_t.jpg?nolink |}}]] | ||
+ | ==== Using the LPD8806 based strips ==== | ||
- | There are some pros and cons to driving the strips this way, \\ **Pro:** Very simple, easy and fast. Use any 3 pins, No interrupts or constant updating required \\ **Con: **Only a handful of colors | + | The LPD8806-based strips are easier to use than the HL1606, with fewer pins and only one library so this section will be nice and short! |
+ | First, connect the strip up to your microcontroller (we'll be using an Arduino) | ||
+ | * Connect the Black Ground to the ground pin of the microcontroller (this is for data and power ground) | ||
+ | * Connect the Yellow Clock wire to digital Pin 3 (you can change this later) | ||
+ | * Connect the Green Data wire to digital Pin 2 (you can change this later) | ||
+ | * Connect the Red +5V power wire to your 5V power supply. | ||
- | Let's get the strip up and running using this method to start | + | {{ http://www.ladyada.net/images/digitalledstrip/lpdarduino.gif?nolink |}} |
+ | You will need a lot of power for these strips so be sure to read the documentation above to specify a proper supply. Don't just connect it to the Arduino +5V pin and cross your fingers, you could damage your power adapter! | ||
+ | <class notewarning> | ||
+ | The digital RGB LED strips must be powered with a 5V DC power supply. Do not use anything higher than 6VDC or you could permanently destroy the entire strip! | ||
+ | </class> | ||
- | **The most important thing to remember is that you need a lot of current (power) to drive these strips (see above) so you will need to arrange a 5V power supply.This test will require about 1 Ampere per meter!** | + | Next you'll need to install the LPD8806 library code. [[https://github.com/adafruit/LPD8806|Download the library from github by clicking the DOWNLOADS button in the top right corner]], rename the uncompressed folder **LPD8806**. Check that the **LPD8806** folder contains **LPD8806.cpp** and **LPD8806.h** |
+ | Place the **LPD8806** library folder your **<arduinosketchfolder>/libraries/** folder. You may need to create the libraries subfolder if its your first library. Restart the IDE. | ||
+ | Load up the **File->Examples->LPD8806->StrandTest** sketch, you might want to change the line that says | ||
- | {{ http://www.ladyada.net/images/digitalledstrip/basicwiring.gif?nolink&1000x498 |}} | + | <code> |
+ | LPD8806 strip = LPD8806(32, dataPin, clockPin); | ||
+ | </code> | ||
+ | so that the first argument to the object is the number of LEDs in your strip. Each meter has 32 LEDs so count them or do the math. | ||
+ | Now upload it to your Arduino, your strip should start to perform a bunch of demonstration tests! | ||
+ | ==== Netduino and the LPD8806 based strips ==== | ||
- | Note in the image above that the 5V can come from a separate power supply that can provide the power you need. Be sure to tie the grounds together and check the polarity, sticking -5V by accident into the strip could be a sad and expensive mistake. We'll be using an Arduino to demonstrate the strip but the code can easily be ported to your favorite microcontroller. | + | Driving these strips from Netduino (or other .Net Micro Framwork boards like FEZ Panda) is very convenient and doesn't require a code library if SPI ports are used. The following sample shows driving a 32 pixel light strip connected to SPI1 (SCLK on pin 13 and MOSI on pin 11): |
+ | <code> | ||
+ | using Microsoft.SPOT.Hardware; | ||
+ | ... | ||
+ | public static void LightStripSpi() | ||
+ | { | ||
+ | var spi = new SPI(new SPI.Configuration(Cpu.Pin.GPIO_NONE, | ||
+ | false, 0, 0, false, true, 10000, SPI.SPI_module.SPI1)); | ||
+ | var colors = new byte[3 * 32]; | ||
+ | var zeros = new byte[3 * ((32 + 63) / 64)]; | ||
+ | while (true) | ||
+ | { | ||
+ | // all pixels off | ||
+ | for (int i = 0; i < colors.Length; ++i) colors[i] = (byte)(0x80 | 0); | ||
+ | // a progressive yellow/red blend | ||
+ | for (byte i = 0; i < 32; ++i) | ||
+ | { | ||
+ | colors[i * 3 + 1] = 0x80 | 32; | ||
+ | colors[i * 3 + 0] = (byte)(0x80 | (32 - i)); | ||
+ | spi.Write(colors); | ||
+ | spi.Write(zeros); | ||
+ | Thread.Sleep(1000 / 32); // march at 32 pixels per second | ||
+ | } | ||
+ | } | ||
+ | }</code> | ||
+ | | ||
+ | ===== FAQ & Troubleshooting ===== | ||
- | Note that we have **Latch** connected to digital I/O pin #2, **Clock** connected to #3 and **Data **to #4 | + | <class notewarning> |
+ | 99% of Digital LED strip problems come down to a few very common problems. BEFORE posting, check all of these multiple times. | ||
+ | </class> | ||
+ | - You are connecting to the INPUT of the strip, not the OUTPUT. This is incredibly common mistake. It wont work unless data is going into the correct end. Check the tutorial to see how to identify the input side. Just because your cut strip has a connector does NOT mean its an input. Check again! | ||
+ | - You must have a common ground between your power supply and the Arduino. If no ground wire connects the strip to the Arduino, it will be flakey and respond strangely, if at all | ||
+ | - If you want to light up a lot of LEDs, you need a fairly beefy 5V supply. Make sure its a regulated supply, and you verify that the output is no higher than 6V DC. A good rule of thumb is a max of 2 Amps per meter, with an average draw of about 0.5 - 1 amp depending on use. | ||
+ | - Check that you did not swap the DATA and CLOCK pins | ||
+ | For long strips, there can be a significant drop in voltage from one end to the other. For strips longer than 1 meter we recommend feeding power to both ends of the strip. For very long strips (5 meters or more) you should plan to feed power to multiple points along the strip. | ||
- | [[https://github.com/adafruit/HL1606-LED-Strip|Now visit our github repository]] and click on the **Downloads** button in the top right corner to download a zip of the library and examples. Uncompress the folder and rename it **HL1606strip** make sure that inside that folder is the cpp and .h files. Then copy it to your arduinosketchfolder/libraries folder. [[http://www.ladyada.net/library/arduino/libraries.html|See our tutorial for more details. ]] | + | Mysterious Green Flash- On some strips it has been reported that the first pixel on the strip will flash green whenever commands are sent to this strip (If you are sending commands continuously, it will be green most of the time). We are still trying to understand the cause of this phenomenon. In any case, it does not otherwise affect normal operation of the strip. |
+ | ===== How to separate longer strips (Advanced!) ===== | ||
- | Restart the Arduino software. You should see a new **example **folder called **HL1606strip** and inside, an example called **basicPatterns**. Upload that sketch to your Arduino. You should see the following! | + | This mini-tutorial is a little on the advanced side, its going to show how to separate the LED strips on the overlapping section ends. All the strips are made of 1/2meter long sections. Between every 2 LEDs you can cut off the flex PCB at the dotted lines. However, every 1/2 meter you cannot just cut the strip but must pull apart the soldered sections. Its not terribly hard but worth documenting! |
+ | For this, we use the wide flat tip on our METCAL iron. A wide tip isnt required but it sure is handy! | ||
- | {{ flickrvid>5387932657 }} | + | {{ :tutorials:products:digitalrgbledstrip:widetip_t.jpg? |}} |
+ | Using an x-acto knife, cut two slice from the top on either side of the solder connection | ||
+ | {{ :tutorials:products:digitalrgbledstrip:top1_t.jpg? |}} | ||
+ | {{ :tutorials:products:digitalrgbledstrip:top2_t.jpg? |}} | ||
- | You can change how long the strip is by adjusting the object creation (instantiation) line | + | Then slice the rubber coating between the two cuts you made |
- | HL1606strip strip = HL1606strip(STRIP_D, STRIP_L, STRIP_C, 32); | + | {{ :tutorials:products:digitalrgbledstrip:edge_t.jpg? |}} |
+ | {{ :tutorials:products:digitalrgbledstrip:edges_t.jpg? |}} | ||
+ | Pull off the thin rubber piece between the cuts | ||
+ | {{ :tutorials:products:digitalrgbledstrip:open_t.jpg? |}} | ||
- | The last argument "32" is the number of LEDs to address. Count how many are in your strip! The display may be wonky otherwise | + | Press the soldering iron against the four joints while pulling the two pieces apart |
- | + | ||
- | + | ||
- | + | ||
- | The **basicPatterns** sketch has many examples of how to set the color of each pixel by calling | + | |
- | + | ||
- | strip.setLEDcolor(**n**, **COLOR**); | + | |
- | + | ||
- | + | ||
- | + | ||
- | where **n **indicates which LED you want to change and **COLOR** is **RED, YELLOW, GREEN, TEAL, BLUE, VIOLET, WHITE, ** or **BLACK**. After you've set the pixel color, you need to **save** the changes to the strip by calling | + | |
- | + | ||
- | strip.writeStrip(); | + | |
- | + | ||
- | + | ||
- | + | ||
- | **writeStrip()** isnt very fast, it will take a few milliseconds to write the changes and it takes longer the more LEDs there are. So change all the LED's you want at once and then write them! | + | |
- | + | ||
- | + | ||
- | ==== Advanced Usage ==== | + | |
- | + | ||
- | + | ||
- | Now that you have the basics down, we can get a little more complicated. The really fun part about color LEDs is not just having 8 primary colors but having hundreds or thousands of colors! Again, as we said before, the HL1606 is a rather stupid chip, it is just a shift register. It doesn't really have a PWM system built in which is why it is so low power and low cost. However, we can coax it into display many colors by writing data to the strip //really fast//. This will PWM the entire strip and will create a blended color effect. | + | |
- | + | ||
- | + | ||
- | + | ||
- | The trade off with the added color-space is that we need to use an interrupt (we use timer #2) to refresh the strip constantly and that the arduino has to do a bunch of crunching in the background. | + | |
- | + | ||
- | + | ||
- | + | ||
- | **Pro:** Hundreds/thousands of colors! \\ **Con: **Uses timer #2, must use hardware SPI on pins 11, and 13, uses background CPU | + | |
- | + | ||
- | + | ||
- | + | ||
- | To wire this up, we'll have to make a small change. The clock and data lines must now connect to the hardware SPI pins to be fast enough. On atmega168/328 Arduinos, this means 11 and 13 are used for **Data** and **Clock** output (for the Mega, pins 51 and 52). The **latch pin** (L) can be any pin but pin 10 (Arduino) or 53 (Mega) but it **MUST BE AN OUTPUT!** | + | |
- | + | ||
- | + | ||
- | {{ http://www.ladyada.net/images/digitalledstrip/pwmwiring.gif?nolink&1000x498 |}} | + | |
- | + | ||
- | + | ||
- | + | ||
- | [[https://github.com/adafruit/HL1606-LED-Strip-PWM|Now visit our github repository]] and click on the **Downloads** button in the top right corner to download a zip of the library and examples. Uncompress the folder and rename it **HL1606stripPWM** make sure that inside that folder is the cpp and .h files. Then copy it to your arduinosketchfolder/libraries folder. [[http://www.ladyada.net/library/arduino/libraries.html|See our tutorial for more details. ]] | + | |
- | + | ||
- | + | ||
- | + | ||
- | Restart the Arduino software. You should see a new **example **folder called **HL1606stripPWM** and inside, an example called **colorswirl**. Upload that sketch to your Arduino. You should see the following! | + | |
- | + | ||
- | + | ||
- | + | ||
- | {{ flickrvid>5388068211 }} | + | |
- | + | ||
- | (Our camera's sensor didn't film the PWMing very well, its not that flickery in person) | + | |
- | + | ||
- | This sketch and library is a little more complex than the one before but should be pretty easy to adapt. Change the object instantiation so the first argument is the number of LEDs in the strip | + | |
- | + | ||
- | HL1606stripPWM strip = HL1606stripPWM(32, latchPin); | + | |
- | + | ||
- | You can then set the color LED resolution, hardware SPI interface speed and how long you're willing to spend on PWMing the strip: | + | |
- | + | ||
- | <code C> | + | |
- | // You can customize/control the pulse width modulation and color | + | |
- | // resolution by setting how many bits of PWM you want per LED | + | |
- | // For example, 3 bits is 8 different PWM values per LED and 9 bits, 512 | + | |
- | // values for full color. 4 bits is 16 PWM per LED, 12 bit color with | + | |
- | // 4096 different colors available. | + | |
- | // Increasing the PWMbits by 1 means you need *TWICE* as much CPU !!! | + | |
- | // We suggest starting with 3 and tweaking the other variables to get | + | |
- | // the fastest SPI and maximum CPU. Then try upping this to 4. For short | + | |
- | // strips (like 1 meter) that are ok with SPIdiv of 16, you can try 5 | + | |
- | strip.setPWMbits(3); | + | |
- | + | ||
- | // We use the built-in hardware SPI module. We can change the speed | + | |
- | // of the module to push data out faster. In theory, HL1606's should work with | + | |
- | // the SPI divider set to 16 but we found that this makes some strips | + | |
- | // spaz out. Start with 32 and once it works try reducing it to 16 | + | |
- | // If you're lucky, you can even try 8 | + | |
- | // Valid divider values are: 2, 4, 8, 16, 32, 64, and 128, dont try others! | + | |
- | strip.setSPIdivider(32); | + | |
- | + | ||
- | // all the hard work of running the strip is done in an interrupt | + | |
- | // we can configure the interrupt so that we spend more or less | + | |
- | // time running the strip, letting you do other stuff like sensors | + | |
- | // or an LED or whatever. Set it between 0 and 100, where 100 means | + | |
- | // higher quality colorstrip display but no time for anything else. | + | |
- | strip.setCPUmax(70); // 70% is what we start at | + | |
- | + | ||
- | </code> | + | |
- | + | ||
- | The initial settings are a good place to start. You can then tweak the values as necessary. Although it may seem like 70% CPU is a lot, the vast majority of Arduino projects we have seen use only maybe 10% of the CPU usage, a lot of time is spent waiting for input. | + | {{ :tutorials:products:digitalrgbledstrip:press_t.jpg? |}} |
+ | {{ :tutorials:products:digitalrgbledstrip:separate_t.jpg? |}} | ||
+ | Cut the remaining rubber underneath with scissors | ||
+ | {{ :tutorials:products:digitalrgbledstrip:rubbercut_t.jpg? |}} | ||
- | Updating the SPI divider to be lower (faster) is 'free' so do that first. Then you can change the PWMbits as you'd like, and finally the CPU max to get good refresh performance | + | Thats it! |
+ | {{ :tutorials:products:digitalrgbledstrip:separated_t.jpg? |}} |