LED Light Strip - Individually Adressable
JBWolf
Posts: 405
I bought an RGB LED strip with individually adressable LED's... but did not get a controller with them because I wanted to make my own color routines with the propeller.
I am unfamiliar with exactly how these work for adressing, can someone give me a starting place? I would like to learn how to trigger each LED color independently.
Says each LED has an WS2811 IC built in.
Thanks!
J
I am unfamiliar with exactly how these work for adressing, can someone give me a starting place? I would like to learn how to trigger each LED color independently.
Says each LED has an WS2811 IC built in.
Thanks!
J
Comments
Here's my WS2812 "NeoPixel" project.
There's a driver in the OBEX by JonnyMac (which I used in my project). Let me know if you need help finding it.
BTW, I found the NeoPixels very sensitive to noisy power supplies. If I had nice clean power, I could use 3.3V logic with the NeoPixels but if I used a switching regulator I had to use a logic level shifter. Someone else in the forum had a similar issue with the switching regulator on the PropBOE.
had to search for WS2812
I need to figure out how I'm going to use them.
Any number at all over 32 and it runs for about 3-5sec then the prop chip locks up.
Johnny, you there by chance?
What demo are you using to test the code?
I'll take a look at it. I'd like to help if I can to save JonnyMac the trouble (so he has time to write other cool drivers).
I'll download a fresh copy of the driver from the OBEX incase it has the demo you're using.
First in the Demo object change:
To:
or
The first option will ensure you don't overflow the buffer is you forget to change MAX_LEDS. Though now that I think about it, the code limits the number of LEDs in the Start menu to MAX_LEDS so I'm not sure why you had the Prop freeze on you.
You'll need to change the MAX_LEDS in the driver from 64 to 72.
IIRC, there isn't a limit to how many LEDs can be chained together. The update rate just keeps getting slower the more LEDs there are.
I am running 40 LEDs on the Adafruit 8x5 shield connected to a Propeller ASC. All 40 LEDs light up and I've written several little demos for a friend that is playing with that combo -- including a very small version of Conway's Game of Life (that changes color each time through).
The attached photo isn't great, but clearly shows 40 lit WS2812 LEDs.
I'll try to post a video, but it always locks up the prop just a few sec after beginning... cannot use the reset button either.
If I remove the color chase at the beginning, it runs fine
Use a separate power source for your Prop until you're sure it's not the power supply causing the trouble (which I bet it is).
If you can't even reset the Prop, it's not software.
Like this:
BTW... I just created a WS2801 QuickStart "shield" for a client last week and used an LM1084 (5A) regulator.
The processor stops responding and I have tried it on 2 completely different boards.
The lockup happens on any of the rainbow or color chase methods... only single color fading is stable.
I suppose fading from single colors only required 1/3rd of max current draw.
I found this LM1084IT on digikey, a bit expensive but I will give it a try
I probably should put a heatsink on that!
BTW anyone who goes through a lot of high power TO220 regulators might be interested in this:
100x TO220 Heatsink
-- http://forums.parallax.com/showthread.php/150675-For-League-of-Legend-and-Wes-Borland-(Limp-Bizkit)-Fans
That said, I'm no exploring switching power supplies. We're drawing a lot of current in this project and went so far as to overheat things. If you watch the video very closely you'll see a small pack on the back of Wes's belt; that's the controller (QuickStart plus shield I made). The dark square you see is a muffin fan to keep the electronics cool while the LEDs are running.
As I mentioned earlier, I had to use level shifters between the Prop and LEDs when I used the switching regulator. IMO, it's worth the bother of adding a level shifter in order to use a switching regulator. A switching regulator should not get nearly as hot as a linear regulator. Your project will run on less power with a switching regulator compared with a linear regulator which can be a big deal if you're using batteries to power the LEDs.
How many LEDs are you planning on using?
I agree, and alway use them (favorite is the TC4427) with my client projects.
I'm using led strips from ebay which have either 72 or 144 leds per meter.
Right now Im testing with a single 72/m strip, but I will need to control up to 4x that on a single prop chip.
I believe I have that exact LM2596 board... you just dialed that to 5v, connected to LED's and bridged the ground into the prop correct?
I dont know about level shifters yet... I see it is just a mosfet, but how are you using it?
What does a level shifter do?
For example, I would like to start by learning how to edit the rainbow cycle... all I am trying to figure out is how to turn the led's off in reverse order. So the final effect would be the rainbow cycle writes colors to the end of the 'max led', then turns them off in reverse order.
here is the rainbow cycle method:
Here is what I tried to do:
But it just goes through the normal rainbow cycle and sits there.. I have tried everything from using $000000 to strip.set(ch, (strip.color(0,0,0)))
I just cannot figure this out. I thought the color values were $RRGGBB... so why cant I use strip.set(ch, $RRGGBB).
So for example turning off the first LED: strip.set(1, $000000).... then the 2nd with strip.set(2, $000000).
For the LED adressing, it looks like this is simply counting them from 0 to maxled and storing in variable ch. so to manipulate led #10, ch would equal 10.
but for the color values, I'm just not getting it.
What does the "& $FF" do? I get that FF is 255, the max value for a single color, but why is it there after the rest?
I have tried declaring a variable as byte in var, then giving it a value of 000000, but that still doesnt work.
I have also tried strip#black, strip.color(0,0,0), strip.colorx(0,0,0,0) without results
Levels shifters do what their name suggests: they take a signal from one level to another. In this case, the 3.3v output from the Propeller to 5v that is used by the WS28xx. In the costume project there is about three feet of wire between the controller and the LED strings. In order to ensure a good signal at the start of the LED chain I use a TC4427. Yes, it is a dual MOSFET device; in fact, it's primarily used to drive the gate of high-power MOSFETs. I use it to provide a very stiff 5v or ground output on the clock and data lines
I'll make sure and include some TC4427 devices in my next Digi-Key order.
Make sure and look through the various methods in Jon's object. There are methods to do a lot of the things you ask about.
See page 164 of the Propeller manual to learn about the bitwise and operator (&). Use windows calculator in programmer mode to see what $FF is in binary.
You're skipping over an important detail in that code: it creates a color using the wheel() method. The & $FF truncates a value to eight bits. The wheel method takes an 8-bit value (0..255) and converts it into a 24-bit color for the LED string.
When your input to wheel() is 0, the color output is $FF_00_00 (pure red). When your input to wheel() is 85, the color output is $00_FF_00 (pure green). Values between 0 and 85 will be a mix of red and green. If your input to wheel() is 170, the output is $00_00_FF (pure blue). Input values between 85 and 170 will be a mix of green and blue. Finally, values between 170 and 255 will be a mix of blue and red.
By cycling through the 256 values you get a rainbow effect.
I have found them to be really useful, especially as you can specify the output voltage with the chip's VDD pin, and it can go up to 18v. A friend of mine had to drive a couple servos on the end of a 20 foot line, and the 3.3v output from the Propeller just wasn't cutting it (I think it was mostly the capacitive load fouling the pulse). We put a TT4427 in the circuit and set its VDD to 5.5 volts -- boom!, servos worked perfectly.