1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Electronics PICs, Luxeons, PWM ...n00b in need of some advice!

Discussion in 'Modding' started by H2O-G33K, 11 Apr 2004.

  1. H2O-G33K

    H2O-G33K What's a Dremel?

    Joined:
    25 Jan 2003
    Posts:
    240
    Likes Received:
    0
    Well, here it is - my mark 1 'Hyperlight'. Red, Green, and Blue Luxeon PIC Uber poi :cool:


    [​IMG]
    [​IMG] [​IMG]

    More images with the Luxeons running here. The photo's really don't do these things justice - they're practically blinding!
     
  2. TheAnimus

    TheAnimus Banned

    Joined:
    25 Dec 2003
    Posts:
    3,214
    Likes Received:
    8
    need some delayed exposure pictures, or better yet videos!
     
  3. H2O-G33K

    H2O-G33K What's a Dremel?

    Joined:
    25 Jan 2003
    Posts:
    240
    Likes Received:
    0
    I'm going to make a cone of fabric to attatch the the top so that I can swing them round later today. I'll get some decent long exposure shots once I've done that :)
     
  4. H2O-G33K

    H2O-G33K What's a Dremel?

    Joined:
    25 Jan 2003
    Posts:
    240
    Likes Received:
    0
    I got some long exposures of a couple of funky sequences I've written. First, a slow colour fade through all available colours:

    [​IMG]

    Second, a sequence I've dubbed a 'Stutter Fade':

    [​IMG] [​IMG]

    I've also got a simple strobe function which just strobes a single colour at a given rate. I was thinking I might try and write some sort of pseudo-random function to make a kind of fire effect and to pick colours at random.

    Anyone got any more ideas.. ? :idea:
     
  5. TheAnimus

    TheAnimus Banned

    Joined:
    25 Dec 2003
    Posts:
    3,214
    Likes Received:
    8
    sweet.

    how about getting a ball tilt sensor, this could be used to detect when its moving, might make on n off smoother.

    if you make a simple instruction set for it, ie
    first byte, R intensity
    second byte G intensity
    3rd byte B intensity
    4th byte duration.

    then you could add a lot of very cool effects using the program memory + data table.

    you can even do sound sensing, its very easy to use a mic to detect certain frequencies with a PIC (no nasty FFT required).
     
  6. H2O-G33K

    H2O-G33K What's a Dremel?

    Joined:
    25 Jan 2003
    Posts:
    240
    Likes Received:
    0
    An instruction set is quite high on my list of stuff to toy with. Still trying to work out how best to store the information and what to store to get the maximum possible variety. I think once I've got a few more bits together, I'll get an EEPROM to add to this lot so that I can write new entries from the PIC. I like the idea of being able to add more sequences etc. from a PC, or another unit via infra-red.

    I've got an accelerometer which will also work as a tilt sensor. I think the one I've got may be too sensitive though. A little 'back of the envelope' work suggested that these units pull 12+g. Sadly, my accelerometers will only read up to +/- 10g. Need to test things a little further to confirm that though.

    How would you go about sound sensing? Can it be done without the ADC on the PIC? All three CCP modules are being usd to produce the PWM to drive the LEDs :(

    Sound sensing might also provide a good way to do fire effects - more speed = more sound = brighter / faster 'flames' :naughty:
     
  7. TheAnimus

    TheAnimus Banned

    Joined:
    25 Dec 2003
    Posts:
    3,214
    Likes Received:
    8
    What PIC are you using, if its got oodles of memory, and can write to itself (program memory this is) just use that, as a datatable.

    if you've got plenty of CPU time, use a comparitor giving u a digital on / off, might need an external op-amp, mabye just a signal transistor. piclist should have some examples.

    could have repeat, and delta in ur instruction set too :)

    always fun instrcution setsies.
     
  8. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    The 16F7X7 doesn't have enhanced flash memory, so cannot write data tables by itself, neither does it have any EEPROM so you'll require some other form of storing/writing data such as an external EEPROM like you suggest.

    Looks good from the pictures. How many of the 1024 different brightness levels per colour are you using?
     
  9. H2O-G33K

    H2O-G33K What's a Dremel?

    Joined:
    25 Jan 2003
    Posts:
    240
    Likes Received:
    0
    Yeah, Stevey's right, no enhanced eeprom unfortunately. I'm using a 16F737, but may move up to the 16F747 soon. I think one of the 18F series has 5 :eeek: PWM channels and the enhanced stuff, but that's kinda overkill ;)

    I'm using all but the two lsb's in those pics, so effectively 8 bits. I haven't got a very smooth fade though yet. I suspect that after smoothing I'd have maybe 64-128 levels or so.
     
  10. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    For best results you'd want some kind of look up table to account for the non-linearity of the LEDs. If you can use all 10 bits using two lookup tables you should be able to get a good number (128+) of brightness levels.

    It may help if you run your luxeons 100mA below recommended, as the last 100mA or so has very little effect on the light output.
     
  11. TheAnimus

    TheAnimus Banned

    Joined:
    25 Dec 2003
    Posts:
    3,214
    Likes Received:
    8
    whilst it wasn't luxons, just regular LEDs i found them perfect LOG.

    so a 10bit PWM will give you a perfect 10 log levels (can use a transistor or 3 per channel and some resistors to increase that a bit :))

    the problem i found was balancing the colour levels so that all on 100% duty, was white, some POTs and about 15 minuites of am i going insane, and one sun spot on my eye later, had some balance.
     
  12. ConKbot of Doom

    ConKbot of Doom Minimodder

    Joined:
    2 Jul 2003
    Posts:
    2,160
    Likes Received:
    6
    Very nice work. Ive been working on my MASM skills and some PWM stuff and ive had ideas brewing for a while now. Those certinly look sweet. Good job. I hope when I get my things done, whatever they turn out to be, they look as nice as that. The fade in the first pic looks really good.

    Ive seen little LED siticks (not familiar with the correct name...) that rapidly flash red green and blue in sequence, they look white when held still, but when you move them, they leave red green and blue trails. But rather than handheld, I want to make a strobe for the whole room. Everything holding still is white, everything moving is colors. :D Hello ceiling fan...

    Now I just need to dig up some cash for 3 luxeons... (probably 3w versions if I want it to be really bright... )

    These Luxeons certainly make for fun toys don't they? :D
     
  13. H2O-G33K

    H2O-G33K What's a Dremel?

    Joined:
    25 Jan 2003
    Posts:
    240
    Likes Received:
    0
    Things have been progressing quite nicely, but I now face a decision which will mean going down one of (at least) two paths. I'm starting to think about current sources and have found two possible solutions.

    Option 1 is to use a device from Micrel (I think that's their name). This is a simple current source using an inductor, some caps and a resistor or two. It'd be dead easy to implement and has PWM input for dimming the output. It's a nice simple solution... but I recently found some rgb Luxeon LEDs which have a common cathode. The problem with using the Micrel is that there's no way I can use three seperate current sources because of the LEDs location in the circuit!

    Option 2 is to use a device from Linear Technologies (the LT1618) which will do the same job, but is a little more complicated to set up. It does mean I can use a common cathode, but the circuit will be more complicated. To adjust the brightness, you have to apply a voltage to one of the pins. If the voltage goes over 1.6v, the device will turn off. In between 0-1.6v, the output will scale to the input voltage. So some sort of RC filter to convert the PWM sginal to a DC voltage. As well as that, I'll need to use some sort of voltage reference to provide the 1.6v or I'll have the same problems with dropping voltages as I would've done without the current source! Since the PIC I'm using will output the PWM signal at whatever the input voltage of the chip is, I'd have to use a Transistor or something to switch the output of the 1.6v source on and off.

    Now, if I go with option 1, the circuitry is considerably more simple but I need seperate Luxeons which basically triples the price. If I go with option 2, the solution is much more complex and just feels a bit crude to me.

    So what d'you guys think? Which option should I go for? Is there a better way around this?

    Comments, suggestions and critisism all welcome...
     
  14. TheAnimus

    TheAnimus Banned

    Joined:
    25 Dec 2003
    Posts:
    3,214
    Likes Received:
    8
    You can use the Vref part of a voltage comparitor of a PIC to help make voltages.

    Hmm, This is a toughie, how dim can u let the luxon go? Myself i'd look at driving it as a current source, using a luxon nock off i found there to be little brightness differnce in 100ma as oposed to 300ma.

    how long do you need the batteries to last for? 4 * 1.2V 2300mAh batteries enough?
     
  15. H2O-G33K

    H2O-G33K What's a Dremel?

    Joined:
    25 Jan 2003
    Posts:
    240
    Likes Received:
    0
    I'd not spotted the on-chip Vref part, although skimming the docs suggests it's just a programmable resistor ladder connected to Vdd. If that's the case, surely it's still going to be suseptable (sp?) to the voltage of my batteries dropping? Maybe I mis-understood the docs.. ?

    When you say 'how dim' I'm guessing you mean what's the minimum acceptable maximum brightness? Well, ideally I'd like them to be as bright as possible. I've not tried eperimenting much with dropping the current down at all. I was thinking I might get some serial comms going so I could dynamically tell the devices how bright to set everythnig - should make these investigations much quicker!

    With either of the options I mentioned above, I wanted to drive the Luxeons from a constant current driver (which is what the two options I mentioned earlier were about). The two chips I was talking about are the LT1618 and the MIC2287

    As for how long they last, I'm thinking either the 1x1800mAh Li-Ion battery I have, or 3xAA 2500mAh NiMh batteries. They give roughly the same voltage and take a relatively small amount of space. I'm edging towards the NiMh on the grounds their easier to come by and you can use pretty standard chargers with them.
     
  16. ConKbot of Doom

    ConKbot of Doom Minimodder

    Joined:
    2 Jul 2003
    Posts:
    2,160
    Likes Received:
    6
    Rather than converting PWM into analog and dealing with all of that, why not build a DAC? you only need 8 values. You could simply use a 3-8 line decoder, some resistors, and some transistors/fets get varied ouputs, and then buffer and scale it down with an op-amp with fractional gain.

    I threw this together to show the idea.
    http://server3.uploadit.org/files/ConKbotofDoom-dac.jpg

    If you did high side switching with a single pull down resistor, you would have an easier time getting resistor values, but with low side switching, you can use something like one of the ULN darlington arrays.
    With this, you would only need 9 IO pins to control the brighness levels of all the LEDs, and it would reduce a lot of overhead in the code.

    As for a reference voltage, see if you can find a programmable voltage reference. Or even an adjustable LDO regulator that you can use.
     
  17. theshadow27

    theshadow27 What's a Dremel?

    Joined:
    23 Sep 2004
    Posts:
    616
    Likes Received:
    2
    serial-parallal shift regester, that is 1 data, 1 clock, and 1 oE, and you can have as many cascaded as you want... just a thought
     
  18. H2O-G33K

    H2O-G33K What's a Dremel?

    Joined:
    25 Jan 2003
    Posts:
    240
    Likes Received:
    0
    Okay, I think I see what you mean in that diagram. Looks quite complicated though (I'm a big fan of plug and play electronics design ;)). Does the circuit you produced there limit the current? Can it cope with supplying ~350mA? Any idea how efficient it might be?

    There's very little code overhead as the PIC I'm using (a 16F737) has 3 hardware PWM channels! :eeek: :hip:

    I've found a few potential voltage references now too - ta.

    I spoke to my old man earlier about this and after a bit of discussion, we may have another solution. He reckons that on the grounds that the (LT1618) device I was looking at operates at > 1Mhz, running a 10Khz PWM signal into the 'EN' pin won't be a problem. This could be pretty good if I ran the pic off a reasonably precise Voltage reference. I could then use a little potential divider circuit to get exactly 1.6v (or slightly over just to be sure) which would mean I could directly use the PWM signal. Should be quite a neat solution if it works! *crosses fingers*
     
  19. ConKbot of Doom

    ConKbot of Doom Minimodder

    Joined:
    2 Jul 2003
    Posts:
    2,160
    Likes Received:
    6
    I was talking about using that to supply the varying voltage into the LT1618. But if you want plug and play, go with a serial DAC. Use that and let the LT1618 do all the PWM work. One thing to consider before you start PWMing the EN pin, how long does it take for the circuit to get to normal operation? Turning it on and off 10k times a second could make it so that it barely gets a chance to get into normal operation. But then again it could. so just look over the datasheet and see if you can find that.

    As for efficiency... the resistors wouldnt be very efficient at all... but it is only providing a few µA at most to the op-amp.

    Like theshadow said, if you use a shift register you could do unlimited with 3 lines... you could use a 12F or maybe even a 10F instead of a 16F737. The LT1618 is a SMD device so I assume that you are ok with a SMD project. If you went with a 12F with 3 SPI or I2C DACs, and 3 LT1618's you could make something pretty small.
     
  20. H2O-G33K

    H2O-G33K What's a Dremel?

    Joined:
    25 Jan 2003
    Posts:
    240
    Likes Received:
    0
    Aaaahhhh... I understand now. I thought you were suggesting the circuit there was replacing the LT1618! Oops :) Right, I'm with you now and that looks like quite a sensible way to go about things. I'll have to give it a go - so many options, so little time!

    Thanks again!
     

Share This Page