Digital RGB LED Strip - Communications

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
jdubrow
 
Posts: 32
Joined: Tue Dec 21, 2010 1:49 pm

Re: Digital RGB LED Strip - Communications

Post by jdubrow »

Cool, that is what I get for stocking up with a boat load of Mega's when I started doing microcontroller work again. :wink: Since I have them working on non-PWM mode I'll wait until I take them off the tree to debug further.

barrycuck
 
Posts: 4
Joined: Sat Dec 25, 2010 2:46 am

Re: Digital RGB LED Strip - Communications

Post by barrycuck »

Ok, so I've been fighting this for a minute myself. The first mistake I made was assuming the wires and connector were on the correct end of the LED strip. What I got was the tail end of the RGB strip with the lead to connect to the next strip. The way I discovered this was that nothing I did made any leds light up except when I accidently ran my finger across the open end (the one without the leads attached) of the strip when powered. My finger toggled some leds in the strip and since latch didn't get toggled, they stayed on. Messing with it more turned on more LEDS and changed some colors. Close inspection reveals the labels are different on each end with the input end having "i" and the output "o" (Di VS Do). Again, poor assumption on my part.

After I figured that out I was able to get the basic pattern to work. I still don't have the PWM pattern working. I used and Uno, but I've got a mega 2560 and a tiny. Once I get some more stuff working I'll post again today. I also changed the pins to 2,3,4,5 rather than 11,13, 10. I ran into the same issue where it may be clear what pins are assigned to what by everyone else, I looked for hours and didn't see a clear definition in the PWM code (yes i know it says 11,13 or 51,53). A lot of seraching led me to Bliptronics. These guys sell the same strip and had some code posted. http://bliptronics.com/support/ledstripspec.aspx
Again, they have it in the sketch defined as:
// Set which pins you will use to connect to the LED strip, you need 4 digital pins.
#define SIPIN 2
#define DIPIN 3
#define CLKPIN 4
#define LATCHPIN 5

#define LEDS 20 //Set this to the number of LEDs in your strip (should be 32 for 1m from Adafruit)
#define CLOCK_DELAY (LEDS * 250)/1000 //This is the required delay between sending a bit and the clock line being fired.
//You can tweak this value lower until you find LEDs on the end of your chain misbehaving
//In fact, if you are running less than a few hundred LEDs you can get away with zero here.

Also note that you need to download all the sketches from them and the ones from Adafruit since you need to put HL1606strip.cpp and HL1606strip.h (from Adafruit) in the same folder as each of the *.pde files. Bliptronics didn't include them in thier downloads. Open the sketch (pde) in Arduino, it will have the tabs loaded for all 3 files. Upload and enjoy. Some if this may be basic, but I didn't get it, and I'm not the only one.

mtbf0
 
Posts: 1645
Joined: Sat Nov 10, 2007 12:59 am

Re: Digital RGB LED Strip - Communications

Post by mtbf0 »

there is an important difference between the two adafruit libraries and it's not clear, from the discussion, that everyone understands it. the simple library, (and the bliptronics code), uses software spi so any pin on the arduino can be connected to any of the leads on the led strip. the pwm library uses the arduino's hardware spi interface and so pin 11 must be used for di and pin 13 must be used for the clock. the pwm library does not use the hardware fading capability on the led strip so no pin is assigned to si. with the pwm library it should be possible to use any pin except 11, 12 or 13 for the latch. pin 12 is the master in pin for hardware spi and is not used with the led strip. (you might be able to connect it to the do pin at the output end to figure out the strip's length).

may finally get around to playing with mine this afternoon once the xmas pizza has been consumed.

barrycuck
 
Posts: 4
Joined: Sat Dec 25, 2010 2:46 am

Re: Digital RGB LED Strip - Communications

Post by barrycuck »

Thanks for the great response on this. I'm still at a loss why I didn't get PWM to work so I'll try again.

barrycuck
 
Posts: 4
Joined: Sat Dec 25, 2010 2:46 am

Re: Digital RGB LED Strip - Communications

Post by barrycuck »

Ok, so using an Uno setting the latch to pin 10, 11 for DI, and 13, for CI, it kinda worked. I've found the value for number of LEDs needs to be set to 1? According to the way I read the documentation in the sketch, it's supposed to be 32 with my 1 meter strip, but when doing that all the leds light up near full white with a very minor variation of color change-mostly red and blue, but never green. Also, I'm using a conservative 4 bit depth and 16 divider but tried the stock 32 spi setting too.

At LEDs 1, the whole strip colorswirls as I assume it's supposed to. While typing this, I found values of 1-4 leds work ok, when using SPI 16 and 5 bit depth for a very even color change. (1 meter strip).

The pulse one works with LEDs at 32, just not what i thought it would look like. The strip lights all LEDs blue, then sends a white pulse chase down the strip. Changing the various values didn't change the effect, although LEDS 1 makes the whole strip strobe as expected.

User avatar
schenkl
 
Posts: 6
Joined: Mon Nov 01, 2010 9:42 am

Re: Digital RGB LED Strip - Communications

Post by schenkl »

Greetings and Happy New Year:

I'm having the same problems with the LEDs. I have a full strip with 160 LEDs. I can not get any of the software to work correctly, either the bliptronics or adafruits code. I have tried using a Mega and Duemilanove. Again it is unclear to me what the SI pin is used for, except in the bliptronic code. If I set the LED_number to 160 nothing seems to work.

I agree that the code is confusing, but maybe that's just me. bliptronics code used no libraries, and is not using anything fancy, just bit banging the data, which of course will be much slower, adafruits code is much more slick, if only I could get it to work!

Any suggestions?

Many thanks!

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Digital RGB LED Strip - Communications

Post by adafruit »

first try to get the 'basic' library up and running, does that not work? dont forget you need A LOT OF power for 160 LEDs, and share the ground pins!

User avatar
schenkl
 
Posts: 6
Joined: Mon Nov 01, 2010 9:42 am

Re: Digital RGB LED Strip - Communications

Post by schenkl »

adafruit:

Yes, Ive tried both library's with the same results. I'm using a 10 amp 5V power supply, which I calculated should handle the load.

I've played with the parameters in both programs, but I can't seem to get things to work. I keep thinking that I must be missing something, but I have not "found it" yet.

Any suggestions as to where to go from here? Does adafruit's library's use the S_I pin in any of their programs?

Thanks,
schenkl

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Digital RGB LED Strip - Communications

Post by adafruit »

we dont use SI, you can ground it.
try the nonPWM first, and the original code (since we know its good) and a 'classic' Arduino duemilanove or uno etc.

maybe post a photo of your setup?

User avatar
schenkl
 
Posts: 6
Joined: Mon Nov 01, 2010 9:42 am

Re: Digital RGB LED Strip - Communications

Post by schenkl »

Finally got things running with the basic program. I made one mistake, which I report so that it might help someone else in this situation. As I was using two different power supplies, I forgot to tie the grounds together. Once I realized that, everything worked.

I haven't gotten the pwm program working yet, any suggestions there?

Thanks
schenkl

rgm
 
Posts: 35
Joined: Thu Jan 22, 2009 12:31 pm

Re: Digital RGB LED Strip - Communications

Post by rgm »

There is now an excellent Digital RGB LED Strip tutorial located here:
http://www.ladyada.net/products/digital ... index.html

However, the diagram for wiring up the power does not actually show the external supply feeding the Arduino. I think this may just be due to Fritzing's old model of the Arduino. Attached are the changes that I believe need to be made to make this diagram more accurate.
Arduino with external power connected to "Vin", which is incorrectly labeled 9V.
Arduino with external power connected to "Vin", which is incorrectly labeled 9V.
digital-LED-strip.png (32.64 KiB) Viewed 4250 times

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Digital RGB LED Strip - Communications

Post by adafruit »

no, we really do mean what we wrote :) you want to keep the supplies separate

rgm
 
Posts: 35
Joined: Thu Jan 22, 2009 12:31 pm

Re: Digital RGB LED Strip - Communications

Post by rgm »

adafruit wrote:no, we really do mean what we wrote :) you want to keep the supplies separate
Interesting -- I didn't know that it was safe to power the Arduino from something like the USB port while also tying the ground to an external power supply. After all, the USB port might be from a laptop that isn't even plugged into the wall, so the two grounds could be at different potentials causing a current to flow.

Why is it better to have different power supplies for the uC and the light strip? Is it to protect against browning out the uC?

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Digital RGB LED Strip - Communications

Post by adafruit »

1. it is extremely unlikely that you have two plug-in supplies with different grounds that are earth references but at different potentials.
2. yes

User avatar
kyle.l.marsh
 
Posts: 5
Joined: Fri May 06, 2011 4:45 pm

Re: Digital RGB LED Strip - Communications

Post by kyle.l.marsh »

Hmm. I've got a length of the H1606 strips, and gotten them to play nicely using the PWM libraries on an Arduino Duemilanove. However, I bought them for a wearable electronics project and I was planning to drive them with a LilyPad Arduino Simple board (sparkfun:http://www.sparkfun.com/products/10274). However I just realized that the LilyPad may not be able to do the hardware SPI that the PWM library needs, and I don't know enough myself about the arduino's internals to know what to look for. Thus my questions:
  • What do I need to look for to check whether the LilyPad is capable of making use of the PWM libraries?
  • The LilyPads are pretty bare; if they don't have some hardware necessary to use the PWM library, will SparkFun's pro mini work? (http://www.sparkfun.com/products/9218)
  • I was planning to power this using a 3.7v LiPo battery running through a 5v boost converter with the output from the converter powering both the strip and the arduino; is the danger of unclean power due to the PWMing great enough that I should look for a separate supply for the arduino? Space, weight, and power are at a premium. I've had success so far powering the arduino and lights all from the 5v rail of an ATX supply, but I realize that the ATX is incredibly beefy and likely capable of supplying much cleaner juice than a little boost converter coming off a LiPo.
On a somewhat related note, if I need slightly more current than the boost converter can supply, is it at all safe to attach a single LiPo to 2 converters? The converts max out at 600mA and a 2000mAh LiPo can be discharged at a rate up to 4A, I thnk, so I feel like it's safe, but don't care to take chances with Lithium batteries strapped to my ankles. I like my ankles unburned.
Edit: I looked a bit closer and from the schematic (https://docs.google.com/viewer?url=http ... le-v22.pdf) it looks like the LilyPad Simple board pulls out the ATmega's pin 17 for the normal Arduino status LED built in to pin 13, but it doesn't actually break that out into a usable pad. Unless I can get at that somehow, I'm guessing this means I can't use hardware SPI with this board.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”