PWM multi phase / multi output?
RinksCustoms
Posts: 531
in Propeller 1
Does anyone know a snippet or an object or general outline of how to go about PWM on multiple pins, medium frequency, with multiphase?
I have started a project that involves very high power density LED's. These are not your run of the mill bright lights, the RGBW can consume 2A per color and the big white one, a CREE XHP70 can suck down up to 4.8A@4000+Lumens. I have been playing around in AVR land for a few years, a bit rusty at SPIN, but I think the prop will be well suited to help get my prototype off the ground. I'll keep scouring the internet for some kind of example I can implement with the sync.
I have started a project that involves very high power density LED's. These are not your run of the mill bright lights, the RGBW can consume 2A per color and the big white one, a CREE XHP70 can suck down up to 4.8A@4000+Lumens. I have been playing around in AVR land for a few years, a bit rusty at SPIN, but I think the prop will be well suited to help get my prototype off the ground. I'll keep scouring the internet for some kind of example I can implement with the sync.
Comments
8bit would be plenty per color at 4 colors. My idea is to use one 2A power supply and do a trick similar to POV (only the colors move, not the LED)
How to keep similar frequency but fire the LEDS one after another at different duty?
Tried looking in the OBEX-ALL, display all, CTRL+F "pwm".. Took a few minutes for the page to finally load looking for any example of multi-phase pwm.
Or did I just confuse myself?
How many of these are there ?
With lots at this power, you could need local Power switching, and at 5.8V & 4.8A/LED you could have multiple power loops.
One example would be a 34.8V power backbone, and each led has a fixed 1:6 PWM from that
Done with care across 6 LEDS, the backbone has no large current breaks, it always 'sees' a 4.8A load, (167W) and that cuts RFI and greatly reduces cap ripple current.
Another PWM/SMPS regulates the 34.8V level.
Next step from that, is a PWM setting per led, which is done as a % of the drive of a hex-set & total average power is under the backbone SMPS.
A Prop can place edges to 12.5ns granularity, with a minimum edge-edge delay of 10 Sysclk IIRC.
I have two very special prototype "lamps"
each "lamp" has a CREE XHP70 and one Luminus SBM40 RGBW (2 LEDs)
I'm attempting to have 2 constant current supplies per "lamp", 1 for the RGBW @ 2A (each color can do 2A) and another to deal with the XHP70 at 4.8A in 6V config
The CC supplies run off of 13.8V and are linear at this stage in prototyping for easier troubleshooting and less $$, don't care about efficiency, only stability right now as these RGBW LED's are early engineering samples and VERY hard to get ahold of.
The XHP70 PWM channel matters not, it will be on it's own supply
Trying to use one CC supply per RGBW LED using staggered phase PWM (they fire one after another in succession)
..of course if this type of software PWM MultiPhase can be implemented on the prop (which I think is totally possible)
I'm just looking for a kick in the pants as per the right direction the code should go down (a bit rusty with SPIN)
Thanks again for ideas
OUTLINE:
eg:
1024 clocks per cycle
clk 0-255 = duty on RED PIN
clk 256-511 = duty on GRN PIN
clk 512-767 = duty on BLU PIN
clk 768-1023= duty on WHT PIN
rinse and repeat of course with a way to change these duty
- smallest PWM is ~ 4% of full scale @ 256 or 1% at 1024 (still ultrasonic), or 0.5% at 2048 etc
This can be compensated for with additional overall average settings, ie a DAC on the current source value.
The following code generates 4 PWMs with 2500 clockcycles each. This results in 8 kHz loop frequency.
You are aware that such a technik allows only 25% pulsewidth max. for every PWM channel ?
Andy
Ariba , good to see you and the OG's are still around.
The 1024 "clocks" was meant as 100uS.. 1mS.. kind of program clocks does not have to be system clocks
but your structure kind of makes sense to me, but i'm rusty at spin. That is a good starting point for me though, thank you for the great demo to understand. It's like I have a cup of brain and a gallon of knowledge haha.
I was looking for a way to save transistors (and heat) on my prototype light project by cutting the needed 2A constant current channels x8, but as Ariba pointed out effectively a 4 channel PWM object would have the effect of only having 25% duty per channel, per cycle or 1/4 of the total power I could be feeding the LED's.
No way around physics I suppose, power in = power out. There are examples over on the AVR side of logarithmic LUT's for adjusting the brightness curve of LED lighting in an S-shape curve so that the LED's dim nearly linearly to the human eye using traditional PWM. I wonder if a divided PWM would be beneficial in the linearity of LED dimming.. The prop is beyond fast enough for such a trial.
All PWMs can change at the same time, if needed.
You do need to (re) fill the array in columns, with each PWM update - so the ease of playback, comes at some house-keeping cost.
Yes, average powers must balance, but you can do sequential pulse PWM to 4 LEDs, where each has a Max of 25%, fine, if you compensate for that 25% with a higher current source. (and are careful to never drive just one LED )
Another PWM means save power, is to use that sequential PWM, but now ratio to a brightest-led level.
Equal times = equal LED brightness, and as the ON time of one shrinks, the % of that drops.
The Current source is also modulated to set the Peak - this means less current switching when you do not need full brightness on any LED.
This has wide dynamic range, without needing large PWM step counts.
Here is a link to one of my posts.
My gripes with the prop are more than a few, it's a niche product that was pretty cool when it came out but parallax just seems to be behind the curve with keeping up with tech. :sad:
Edit: seems that prop 2 should be arriving maybe by Xmas 2016, that is not a date! But seems like they're finalizing the design and ironing out the the last of the kinks. Looks like a very competitive and modern Prop 2 indeed with the smart pins. UART,SPI,SERIAL, 13b ADC, DAC...