Shop OBEX P1 Docs P2 Docs Learn Events
LED multi colour wall washing phasin' changin' funkyness — Parallax Forums

LED multi colour wall washing phasin' changin' funkyness

Paul CPaul C Posts: 2
edited 2005-06-25 16:51 in BASIC Stamp
Rewind to January.. I bought 200 LEDs.. 50 each of red, green, blue, and white. I also bought a BS kit and had a bit of a dabble playing with the WAM book/kit. So far so good. My intention from day one has been to build some kind of colour changing wall washing light.. a bit like those LightTro's from Color Kinetics? The idea is to light up a wall with LED colour that gradually changes over time - maybe quickly/perceptibly or maybe over many minutes so you can't see the change as it's happening but do see it over time.

Now back in my days of attending highschool in the UK (aha! that's why he spelt color wrong!) I took GCSE electronics (like a high school electronics course?) but it's fair to say I'm pretty rusty. I've done some basic sums and worked out voltages, resistors etc to suss out the best set up for the LEDs, giving me the brightest output without frying the LEDs.

Here we are in May and I've not played with this stuff in ages. I'm keen to get cracking and make a start on my stalled project but could do with some advice from the collective gurus here.. Allow me to think out loud a bit then maybe you can offer some advice and/or point me in the right direction.

The basics: You can vary the brightness of an LED using PWM. The BS2 can do PWM but only on one channel at a time and you need to keep calling the PWM function in a loop (plus have some external buffering - a capacitor?). There's that piggy back module that'll give me 4 channels of PWM, offloading the BS2, requiring just a serial line to control it. Due to current limitations, I'm going to need some kind of transistor setup to run all my LEDs.

The advanced stuff: I'm cool with programming my BS2 and aim to start off simple, just cycling through varying levels of different colours. In the future I might add some kind of control or program selection to vary the colours, speeds etc. I was browsing online the other night and came across a guy who'd done something similar with a small number of LEDs using a shift register and a 555 timer (for external clocking of the shift register). I guess that's an option too?

I guess my main areas of confusion right now are sussing out how to do PWM on 3 or 4 channels easily/programmatically, then working out what kind of transistors I need to drive all these LEDs. All help/advice/pointers gratefully received.
«1

Comments

  • Shawn LoweShawn Lowe Posts: 635
    edited 2005-05-12 21:20
    Paul-
    You will probably need a PWM generator. Parallax sells one, so does Al Williams

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    Remember - No matter where you go
    There you are.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-12 22:08
    multi-channel PWM is possible but not with native functions provided by PBasic as you have surmised. It requires an infinite loop with a counter which is compared with the duty cycle of each channel, when the counter value exceeds the duty cycle value of a channel it is switched off, when the counter overflows all channels are turned on and the process is repeated. The only issue I see that may be a problem is there is a window of PWM cycle lengths that LEDs like to be operated at, if the cycle is too short the LED is not as bright as the duty cycle dictates, if the cycle is too long flickering of the LED is observable. Since stamps perform ~2000 instructions per second you may run into the flickering problem.

    Or just get a PWM controller to do it for you as Shawn suggests.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-05-12 22:17
    I have the Parallax and the Al Williams PWM controllers...they both work well. You are limited to 4 channels on the PWM Pal (the 'cradle' that Parallax sells)- Al has different size 'solutions'-

    *Both work well*

    I used them both for servo control (together with BS2)- it makes writing the BS2 code kind of 'set it and forget it' like. Pretty easy.

    Ryan
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-12 22:43
    Oh yeah, and Jon williams released an SX/B program for an 8 channel PWM. You could possibly convince an SXer to program an SX with the program for you.
  • BeanBean Posts: 8,129
    edited 2005-05-12 23:18
    Actually the SX running at 50 MHz could provide 16 channels of PWM quite easily.
    Let's see, interrupt every 10uS gives us 500 intrstructions per interrupt. With a PWM period of 10*256uSec = 2.56mSec or 390Hz.
    If there is any interest I will attempt to "code-it-up".
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video Display Module" Available Now.

    www.sxvm.com

    "Great people talk about great things, average people talk about average things, small people talk about other people."
    ·
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-05-13 19:11
    Bean (Hitt Consulting) said...
    Actually the SX running at 50 MHz could provide 16 channels of PWM quite easily.
    Let's see, interrupt every 10uS gives us 500 intrstructions per interrupt. With a PWM period of 10*256uSec = 2.56mSec or 390Hz.
    If there is any interest I will attempt to "code-it-up".
    Bean.

    Hey Bean, I would like to see it if you have time. I always learn from looking at the code you guys post. That's how I started with the SX, and how I continue to learn...

    Ryan
  • StarManStarMan Posts: 306
    edited 2005-05-13 23:20
    I have not yet ventured to the SX.· I still feel that I have too much to learn with the BS2.· But I would certainly be interested in having a look.· Perhaps a posting in the projects forum?

    I started a thread in the Sandbox a while back concerning control of Luxeon brightness.· I got some very interesting responses there.· Unfortunately, I won't have the bandwidth to work on that project for a while.



    Chris Isaacson
  • BeanBean Posts: 8,129
    edited 2005-05-14 11:02
    Yes it's true...I DO have too much time on my hands [noparse];)[/noparse]
    I coded up the 16 channel PWM controller and posted it in the "Project" forum.
    Check it out.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video Display Module" Available Now.

    www.sxvm.com

    "Great people talk about great things, average people talk about average things, small people talk about other people."
    ·
  • jdoleckijdolecki Posts: 726
    edited 2005-05-14 17:31
    Bean your just like me you do just to see if you can do it not because you have to much time.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-05-17 15:48
    Thanks Bean!

    Ryan
  • Paul CPaul C Posts: 2
    edited 2005-05-26 06:59
    Wow! Just like that eh?! *impressed*

    So.. I could take my BS2 kit and do serial comms to an appropriately programmed SX and have 16 channels of PWM? Gives me all sorts of thoughts/ideas of colour washing that changes in bands, not just a solid wall of colour smile.gif

    I could still do with some advice/pointers on how to actually drive lots of LEDs - should I be using transistors (multiple? once I've done my maths on current draw etc?) or some kind of LED driver IC (that commonly referenced one that's used for driving 4 or 8 digits of 8 segments?).

    My current thinking is that I can probably do what I want to with a BS2 and either the Parallax PWM buddy module, or be adventurous and go with an SX for PWM and a BS2 for control, or just jump right in over my head and go with an SX type device and do the whole shebang? Probably a bit of a steep learning curve though... thoughts?
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-26 12:41
    Im actually playing with full color LEDs and Bean's PWM code to produce color shifting, it works pretty well. Im now trying to design a Color Description Markup Language so that a user can dowloaded a script describing the manipulation of the color channels.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • StarManStarMan Posts: 306
    edited 2005-05-27 04:31
    Paul,

    Are you using a BS2 or SX?



    Chris I.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-27 05:29
    Sx

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • BeanBean Posts: 8,129
    edited 2005-05-27 10:47
    Paul,
    Glad to hear that you are using the PWM code.
    So you just modified the PWM program to do the control also (no serial comm) ?
    Or are you using one SX for control and another for the PWM ?
    Just curious.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-27 12:31
    Its a single chip SX project, all the serial com stuff has been removed, token commands will be stored in program memory and will provide the equivalent to the serial com. Im just trying to decide which level of abstraction the token code will be, Ill likely start with low level (specify constant value or ramp rate) then move to a higher level (swap channel values, shift channels, invert channel, associate channels etc).

    The intent is to create a glove with an RGB LED on each fingertip and the ability to write custom programs for it, the idea came from watching a group of raver kids play with thier LED toys.

    Post Edited (Paul Baker) : 5/27/2005 12:36:11 PM GMT
  • BeanBean Posts: 8,129
    edited 2005-05-27 13:29
    Paul,
    Maybe you could add an EEPROM and use serial from a PC to get the token's into the SX and have the SX store them in the EEPROM, then you wouldn't have to reprogram it every time ?

    Or how about an accelerometer in the glove to change the patterns. That would look cool.

    Just a thought.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-27 14:32
    Yeah, thats a future feature (and a button to switch between programs and a sound activated input which can be used to alter the program dynamically) The accelerometer idea is pretty cool, I hadn't thought of that as a potential input. Wow gloves that react to sound and motion, sweet (I see cool "red shift" effects possible). Now that has potential for being a product people would buy (it was always sortof a gimmicky idea in my mind).

    Post Edited (Paul Baker) : 5/27/2005 2:37:26 PM GMT
  • BeanBean Posts: 8,129
    edited 2005-05-27 14:59
    Paul, Hey if you sell it don't forget where you got the idea [noparse];)[/noparse]
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • StarManStarMan Posts: 306
    edited 2005-05-27 16:13
    I just purchased 50 RGB LEDs on ebay for $40.00.· Free shipping to boot.· These are the four lead type for individual color control. ·I'll let you know how they work when I receive them.

    http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&category=26207&item=7518355287

    Just a couple years ago four lead·RGB LEDs were selling for $15.00 each.· Amazing.



    Chris I.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-05-27 16:31
    I've been looking at those. You can get them with common cathode or common anode correct?

    You could (in theory) use PWM on the different colors to 'mix' and 'fade' colors, correct?

    Ryan
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-27 17:11
    Yes that is exactly what Im doing, the ones I have are here. My major gripe? They project the 3 distinct colors as seperate dots as shown at the bottom of this page (though mine form a triangle).·When looking at the LED, its color would look different depending on the angle you look at it (One of the three colors dominates). It frustrated me to the point of taking an emory board and filing the surface until it was a diffused lens, the colors now mix much better though there still is some color seperation. Starman, I would be interested if you find your batch to have good color mixing properties. I think that maybe a 120 degree lens might have better results since there should be more diffusion of the colors, though I would suspect that the edges would still be a ring of primary colors.
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-05-27 17:35
    I've had several ideas for 'color washing' projects for quite some time (just haven't gotten around to it with all my other projects I'm working on)-

    I like the idea of diffusing the lens by filing it~ it seems like the color separation would only be a problem if you are viewing the LEDs directly-

    The idea of the accelerometer is really neat also....I'm thinking about a device that changes color based on temp. - kind of like an ambient orb device for passing info based on color shifts...I also have an idea to mix colors based on outputs of a theremin...

    Ryan
  • BeanBean Posts: 8,129
    edited 2005-05-27 18:03
    You guys must have read my mind, I was just going to ask about recommendations for RGB LEDs.
    Thanks guys.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • StarManStarMan Posts: 306
    edited 2005-06-21 19:37
    I just received my RGB LEDs.

    A quick check shows that the red is much less bright than the blue and the blue is somewhat less bright than the green.

    No data sheets came in the package.· I will do some further evaluation and report back.



    BTW I recently purchased a BS2SX kit from the Parallax ebay auction.· A real bargain.· Will I be able to use this for multiple channels of PWM.


    Chris I.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-06-21 19:51
    Starman, whats the mixing quality of the LEDs? Do the three colors stay in a tight pattern or do they diverge into 3 colored spots when projected on a wall a foot or two away?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2005-06-21 20:21
    Yes, I saw the source you purchased from on eBay (the one from HK, right?) And am curious as to the quality of the product, as well as how the transaction went (shipping, communication, etc)

    Ryan
  • StarManStarMan Posts: 306
    edited 2005-06-23 07:42
    Ok, my findings are contained in the attachment.



    And.... I'm going to have a little contest a la Sid (Newzed).· At approximately 9:30 AM (6/23/05) I'll pose a question.· The first correct answer wins 10 RGB LEDs.· Post your answers in the forum.· I'll announce the winner as soon as I can.

    After that I'll ask another question.· Winner gets 5 RGB LEDs.

    The questions may be technical or trivial.· They won't have anything to do with electronics or programming.· I couldn't get away with that around here.· I'll pay for postage in North America.



    Chris I.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-06-23 16:33
    Very nice write up Chris, thanks for spending the time to compile the information. I agree, the red component is somewhat disapointing, I find the non-uniformity of the color patch the most problematic. The green appearing brighter than the foot-candle meter shows is perfectly natural. Because of human psychovisual perception, our visual system is most sensitive to green light and tapers off in both directions with the blue direction tapering off more quickly, so we are more sensitive to red light than blue. Here is a page explaining the color sensitivity of the various cones in our eye, if you do a summation under the curves you'll see the sensitivity peaks in the green regions due to the overlap of sensitivities of the three different types of cones in our eyes.

    Post Edited (Paul Baker) : 6/23/2005 4:38:07 PM GMT
  • StarManStarMan Posts: 306
    edited 2005-06-23 16:33
    I must apologize.· It was very late for me and I wasn't thinking straight.· I would like to postpone my question·to give others a chance to read this thread.· Plus I didn't indicate a time zone.

    Question time will be 6:00 PM PST today (6/23/05)



    Thanks for your patience.

    Chris I.
Sign In or Register to comment.