Simple RGB LED strip control in Spin or C on Propeller Activity Board
dmagnus
Posts: 271
I'm putting this in the General Discussion forum for now because it isn't actually a project - yet.
Somewhat inspired by xanadu's "Propeller RGB VU Meter" project, I decided to embark on a small project to learn about RGB LEDs.
Eventually, I would like to help a friend make some light displays for his three piece band that are relatively inexpensive, yet somewhat interesting in that they produce random flashing colors in response to each individual instrument.
But that's a long way off. I have been looking at Brilldea's Instructable for his panels and that is similar to what I want to do. First, I have to crawl before I walk.
I'm a total novice at this stuff, have some understanding of C and Spin. I plan to use a Propeller Activity Board initially to learn on.
I bought a reel of 150 RGB LEDs on Amazon for $20 and they seem to be adequate for what I want to do. They came from LED Wholesalers. Unfortunately, they didn't include a spec sheet or anything. Some of the specs on the package:
LED: 150 x 5050 SMD
Input voltage: 12v DC
Power: 36 watt
5M roll, 2086RGB
They have four leads marked +12V, B, R, G. I think this means it is a "Common Anode" string?
I have tried them with a 12v wall wart and they work fine. Plugging the +12v into the positive side of the supply and one or more of the other three provides whatever color or combination is plugged in.
What I want to do initially is hook them up to my PAB and control them with Spin (or C).
I plan to cut 10 or 15 off of the string so I have something that is easy to work with and doesn't require a lot of power. Which brings up my first question:
The full string has a connector on the end that looks like a female connector for stringing more LEDs, But, is there some kind of termination in there? I doubt it because I think the three color leads are the "ground" for the circuit - right?
The big question is can I hook the + lead to +5 on the PAB and then the other three to, say p0, p1, p2 on the breadboard through resistors?
What value of resistors should I use?
If the whole string of 150 LEDs uses 36 watts (3 amps?), then each LED should use about .02 amps (20 milliamps?). If I use 15 in a short string, that would be .3A or 1/10th of the total. Is my math right?
Not sure how to calculate the resistor value or what the pins on the PAB can handle.
Then I need to figure out how to control them. If someone could steer me to a thread or something with some simple code I would appreciate it. I have looked around on the Forum and everything seems to be way more than what I am looking for right now. I'll keep looking.
The main thing I am looking for now is the electrical stuff - can I hook this thing to a PAB and, if so, how to do it safely.
Thanks in advance
Somewhat inspired by xanadu's "Propeller RGB VU Meter" project, I decided to embark on a small project to learn about RGB LEDs.
Eventually, I would like to help a friend make some light displays for his three piece band that are relatively inexpensive, yet somewhat interesting in that they produce random flashing colors in response to each individual instrument.
But that's a long way off. I have been looking at Brilldea's Instructable for his panels and that is similar to what I want to do. First, I have to crawl before I walk.
I'm a total novice at this stuff, have some understanding of C and Spin. I plan to use a Propeller Activity Board initially to learn on.
I bought a reel of 150 RGB LEDs on Amazon for $20 and they seem to be adequate for what I want to do. They came from LED Wholesalers. Unfortunately, they didn't include a spec sheet or anything. Some of the specs on the package:
LED: 150 x 5050 SMD
Input voltage: 12v DC
Power: 36 watt
5M roll, 2086RGB
They have four leads marked +12V, B, R, G. I think this means it is a "Common Anode" string?
I have tried them with a 12v wall wart and they work fine. Plugging the +12v into the positive side of the supply and one or more of the other three provides whatever color or combination is plugged in.
What I want to do initially is hook them up to my PAB and control them with Spin (or C).
I plan to cut 10 or 15 off of the string so I have something that is easy to work with and doesn't require a lot of power. Which brings up my first question:
The full string has a connector on the end that looks like a female connector for stringing more LEDs, But, is there some kind of termination in there? I doubt it because I think the three color leads are the "ground" for the circuit - right?
The big question is can I hook the + lead to +5 on the PAB and then the other three to, say p0, p1, p2 on the breadboard through resistors?
What value of resistors should I use?
If the whole string of 150 LEDs uses 36 watts (3 amps?), then each LED should use about .02 amps (20 milliamps?). If I use 15 in a short string, that would be .3A or 1/10th of the total. Is my math right?
Not sure how to calculate the resistor value or what the pins on the PAB can handle.
Then I need to figure out how to control them. If someone could steer me to a thread or something with some simple code I would appreciate it. I have looked around on the Forum and everything seems to be way more than what I am looking for right now. I'll keep looking.
The main thing I am looking for now is the electrical stuff - can I hook this thing to a PAB and, if so, how to do it safely.
Thanks in advance
Comments
I've got pulse_out in C lighting them up, but that's not working for varying anything. I just get full on for all three colors...
Can you post a picture of the strip showing at least 6 LEDs?
You're going to need a bunch of power to do this. No way you can connect it to any microcontroller directly.
The best thing to do is to get an accurate reading on how much power each color on the strip uses at full brightness. To do that I use my bench power supply, if you have a multimeter with current reading in the AMP range you can put it in series with the strip.
Once you know what each color draws at max intensity, add another 33% (per color, not the entire strip) to that and we should be able to find you a good FET to power them with.
That's a great way to start, make sure you use a transistor to power the LED. It doesn't matter how little current one LED draws, it's not worth toasting an IO pin over adding a resistor and transistor.
You don't want to sink current directly with a Propeller I/O pin from these LEDs running off of 5V or higher.
You could use extenal ICs to control LEDs. In my RGB LED array project, I'm using additional chips to both drive the anodes and control the cathodes. The Prop just controls the logic to these chips it doesn't provide or sink the LED current directly.
IMO, the easiest way to deal with RGB LEDs is to use the specialty chips available to drive RGB LEDs. I've used both the WS2801 chips and the WS2811 chip (which is built in to the LED) to drive RGB LEDs. The LEDs with the WS2811 chip built in are called WS2812 LEDs aka NeoPixel.
Another way to add RGB LEDs to a project is to hack the RGB Christmas lights (LEDS).
I'll add links to these various projects in a bit.
Edit: I hadn't seen Xanadu's warnings about driving the LEDs directly. I see we agree about this.
BLED = LED pin
Don't forget to define and init the IO pin for the LED
I have Brilldea's LED Painter II-8 on order, which I think I'll use as a driver for the "big" project - probably need a couple of them eventually but, as I said, that's a ways off. They will be controlled with the Propeller.
I put some pictures of the short length of the strip in my Albums under RGB Strip.
I'm not up on the MOSFETs, etc. so I will probably wait now for the Brilldea stuff.
Meanwhile, I'm going to continue to experiment with my RS LEDs - I'm learning as I go. I have managed to get one hooked up, resistor values calculated and turning on and off and fading from one color to the other.
The LED Painter II-8 individual channels can only handle up to 150ma each. That is a stretch for even a single segment, 3 RGB LEDs, 3 LEDs each, that is 9 LEDs, divided by 150ma gets you 16ma per color per RGB LED. That would definitely limit you to one 3 RGB LED segment per LED Painter II-8 channel, and even then it is still a bit under powered because that doesn't add the heat dissipation of the resistors either.. I think it would shorten the life of your LED painter.
I probably shouldn't say anything else until you say how you want to use the LEDs. PM me a diagram if needed.
EDIT: I guess you could use one channel per one color per strip on the painter in which case that would be fine, I was thinking one channel per strip, but you could use more than one channel per strip. Maybe someone with better experience with the LED painter could chime in here...
I hooked the short strip of 12 LEDs up to an adjustable power supply set at 12v. I used an ammeter in line with the 12v and measured each color. Green was 86mA, Blue and Red were 82mA each.
As soon as I can find my solder station (short story - 40 something daughter moved in and my Man Cave is gone) I will reattach the short strip and check the full roll of 150.
One thing I have learned - working with this stuff on a TV table in the living room is not optimal. I want my Man Cave back!
I think, for the application we have in mind, we will need at least three LP II-8 and probably individual power supplies for each of the three panels.
It will be similar to Brilldea's Demo on the Instructable.
Just wondering if you have progressed further on this?
I bought a 5m strip RGB WS2812B controller LED strip on eBay. I cut it into 5 individual strips serially connected.
It basically is like a 30 x 5 matrix since each 1m has 30 LEDs.
I am writing to each RGB LED to create a scrolling message with Arduino Uno.
Now that I have a P8X32 QuickStart board, I am hoping to do the same thing.
The code is ugly, but it runs this:
https://www.youtube.com/watch?v=cwO17EsPX-M
If you need any help to make sense of it, feel free to ask.
That is pretty cool!
Thanks!