Author Topic: Domestic Led Lighting project.  (Read 20141 times)

0 Members and 1 Guest are viewing this topic.

Offline Psi

  • Super Contributor
  • ***
  • Posts: 7728
  • Country: nz
Re: Domestic Led Lighting project.
« Reply #25 on: June 05, 2012, 01:28:29 am »
I've not read the entire thread, by why do you want ~250khz PWM for leds?

Seems really excessive.
My led room lighting PWM is running at 1khz.


EDIT: ah, i see, you want to make a constant current switchmode system with the pwm, not drive the leds directly with it.
« Last Edit: June 05, 2012, 01:30:36 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #26 on: June 05, 2012, 01:49:00 am »
Hi Psi

I guess it has got to do with whether you are running as a buck converter in mainly continuous mode, or as a buck converter in discontinuous mode or without the inductor as a chopper.
My idea being that the advantages of inductor being in continuous mode being less noise and less stress on the leds, and possibly greater efficiency.
The advantages of the chopper being simpler, no resistive losses in the inductor therefore possibly greater efficiency.
Running at low speed means you are more often running in discontinuous mode, for the same sized inductor, and If you go for a bigger inductor then you have more cost and more losses.

Also bear in mind I want dimming.
It is very hard to weigh these up without just making something and testing.
Whatever frequency I choose I am going to try to stay away from those that may cause problems for other equipment.

I should probably give low frequency a try.
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #27 on: June 15, 2012, 01:54:42 pm »
Quote
Now, what I would do to improve the design is to redesign the application to be ground-referenced. This will help the ADC to produce more accurate results and, thus, a more stable output.
A Hellene said this and I don't doubt it, but I was wondering why it would be better ground referenced? If I am using differential inputs and separate analogue power inputs.

The reason my topology is not ground referenced is so I can use a low side n-channel fet and have current sense without an op-amp.



Another thing I was wondering about is Gate Drive bjt selection.
A Hellene suggested BC639/BC640 matched pair, and I was looking at BC807/bc817 and also zxtn2040/zxtp2041 but I am going to lay it out as sot23 and try a few. It probably doesn't matter too much as the fet is probably going to be around  30nC gate and I am not going at very high speed so I think an collector current of 500ma will be good enough.

The NPN: PBSS4560 PNP: PBSS5560 were unsuitable.
 

Offline A Hellene

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: gr
Re: Domestic Led Lighting project.
« Reply #28 on: June 15, 2012, 05:28:11 pm »
The ADC analog inputs are more linear near the ground potential than near their positive power rails, because of their internal bias circuitry topology. Even if when using differential inputs for the ADC, where a complex network of internal switches and capacitors moves charges from the differential inputs to the ground-referenced input comparators of the SAR ADCs, most of the microcontrollers have.

As I wrote above, there will be no problem at all to monitor a ground-referenced shunt resistor that exists between the power MOSFET source pin and the ground. For example, a 10 milliohm shunt resistor will have a 55mV voltage drop at a MOSFET peak current of 5.5A; this 55mV voltage drop multiplied by a factor of 20x will give a full 10-bit resolution ADC output that has as a reference the internal 1100 mV generator; on the other hand, this 55mV voltage drop will not really interfere with the ~4.3V MOSFET gate drive that a complementary emitter-follower stage driven by the 5.0V PWM output will provide.

I recommended the BC639/BC640 pair because these medium-power transistors have 1.5A maximum collector current. The low Vce saturation, 2.0A peak collector current ZXTN2040F/ZXTP2041F transistor pair is even better for that purpose. Now, why do you need a >1A peak gate driver with a signal period of 2*7.8ns (= 1/64MHz)? Try doing the math of transferring a 25nC gate charge in a less than 2ns time window, in order to catch up with the 64MHz PWM AVR output pin rise and fall times...

This is a (*draft*) schematic of a 5.0V AVR LED driver circuit, able of working in both the Buck or the Buck-Boost topologies:



-George
« Last Edit: June 15, 2012, 06:14:37 pm by A Hellene »
Hi! This is George; and I am three and a half years old!
(This was one of my latest realisations, now in my early fifties!...)
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #29 on: June 16, 2012, 12:49:57 am »
Thanks a lot George I really appreciate the comments and the corresponding effort.
Quote
The ADC analog inputs are more linear near the ground potential than near their positive power rails, because of their internal bias circuitry topology. Even if when using differential inputs for the ADC, where a complex network of internal switches and capacitors moves charges from the differential inputs to the ground-referenced input comparators of the SAR ADCs, most of the microcontrollers have.
I knew you had your reasoning, and so I am glad to hear it.

Quote
As I wrote above, there will be no problem at all to monitor a ground-referenced shunt resistor that exists between the power MOSFET source pin and the ground. For example, a 10 milliohm shunt resistor will have a 55mV voltage drop at a MOSFET peak current of 5.5A; this 55mV voltage drop multiplied by a factor of 20x will give a full 10-bit resolution ADC output that has as a reference the internal 1100 mV generator; on the other hand, this 55mV voltage drop will not really interfere with the ~4.3V MOSFET gate drive that a complementary emitter-follower stage driven by the 5.0V PWM output will provide.

thanks again George I'm sorry you had to spell it out again via the diagram, the current sensing looks perfect, I guess I had it locked into my head that I should be sensing current only directly in series with the leds.

Quote
Try doing the math of transferring a 25nC gate charge in a less than 2ns time window, in order to catch up with the 64MHz PWM AVR output pin rise and fall times...
I am not sure why but I was basing my calculations on 256khz rather than the actual rise and fall times? Then assuming I was so far under requirements that I didn't actually calculate the current needed.
So I will go with the ZXTN2040F/ZXTP2041F transistor pair.

I will post a schematic again soon, similar to yours but with an extra voltage level transistor and a non logic level fet.
For this project efficiency is the most important factor.

Jon.


 

Offline A Hellene

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: gr
Re: Domestic Led Lighting project.
« Reply #30 on: June 16, 2012, 01:14:31 am »
You are welcome, Jon.


-George
Hi! This is George; and I am three and a half years old!
(This was one of my latest realisations, now in my early fifties!...)
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #31 on: June 16, 2012, 01:33:22 am »
Revised output stage of circuit.

Also I have to generate the 12 volts and the 5 volts for the Vcc and also probably a separate voltage for the Analogue Vcc.
I plan to do this in parts 24-48 -> 12 via a tiny switched mode -> then 12->Vcc via a regulator. and 12 ->Vcc analogue via a regulator.
The switched mode I think I will use is the black 2 transistor regulator http://www.romanblack.com/smps/smps.htm, as I only have a small current draw.
« Last Edit: June 16, 2012, 01:43:22 am by HackedFridgeMagnet »
 

Uncle Vernon

  • Guest
Re: Domestic Led Lighting project.
« Reply #32 on: June 16, 2012, 02:18:43 am »
In Australia we can go to 50Vdc before the wiring needs to be done by a sparky. So I want to keep under this.

Wrong!  Nanny state legislation says any FIXED installation requires a cablers certificate! (a useless piece of government/union/insurance industry inspired piece of bureaucracy) Conroy's bungling ACMA at it's peak.  You are correct that LV and above wiring requires a licensed electrician.

 

Offline A Hellene

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: gr
Re: Domestic Led Lighting project.
« Reply #33 on: June 16, 2012, 02:41:44 am »
Quote
Also I have to generate the 12 volts and the 5 volts for the Vcc and also probably a separate voltage for the Analogue Vcc.
I plan to do this in parts 24-48 -> 12 via a tiny switched mode -> then 12->Vcc via a regulator. and 12 ->Vcc analogue via a regulator.
Jon, for the AVR power requirements you will only need a single 2.7V .. 5.0V supply.

If you are using the t25/t45/t85 you are good, since there is no special analog supply line for this family.
If you are using the t261/t461/t861 connect the analog supply line (AVcc) to the digital supply line (Vcc) through an additional filter consisted of a 10 µH inductor (between Vcc and AVcc) and a 100 nF decoupling capacitor (between AVcc and GND), as recommended by ATMEL.

In both the cases above, the AVR power supply should be as clean as possible.

Additionally, use Kelvin connections for the ADC differential inputs and shield them by using guard lines connected to the analog ground (1 LSB represents 53.7 µV, in the previous example of the 55 mV full scale); and a star grounding scheme for the PCB layout (a technique in which all the partial subsystem ground planes and ground lines connect to the system ground at a single point, making a 'star' pattern).


-George
Hi! This is George; and I am three and a half years old!
(This was one of my latest realisations, now in my early fifties!...)
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #34 on: June 16, 2012, 02:48:13 am »
Quote
Wrong!  Nanny state legislation says any FIXED installation requires a cablers certificate! (a useless piece of government/union/insurance industry inspired piece of bureaucracy) Conroy's bungling ACMA at it's peak.  You are correct that LV and above wiring requires a licensed electrician.

When did that come in? I guess I should read up on that.
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #35 on: June 16, 2012, 03:29:24 am »
I plan on using the tinyx61a series. at Vcc = 5 volts.

I was going to use a separate analogue supply derived from a voltage regulator as I wanted to keep them really separate.

Probably I should just follow the data sheet and use the inductor and the cap.
But shouldn't I keep the Analogue Vin one volt less than Vcc. for an tinyx61a?

Quote
In both the cases above, the AVR power supply should be as clean as possible.
That is why I want to use a regulator from 12 down to 5 volts.
Quote
Additionally, use Kelvin connections for the ADC differential inputs and shield them by using guard lines connected to the analog ground (1 LSB represents 53.7 µV, in the previous example of the 55 mV full scale);

I guess guard lines follow the input tracks. I will have to look this up.


Quote
and a star grounding scheme for the PCB layout (a technique in which all the partial subsystem ground planes and ground lines connect to the system ground at a single point, making a 'star' pattern).
I am familiar with this, I will do it this way.

I have another question George,
Because three of my differential inputs are attached to ground, I should be able to share the input pin for these inputs, as long as I only join them near the pin itself. Is this a reasonable strategy?

Also, every time I switch between the differential inputs for the 3 channels I must always wait for the change to settle. I can do this by either waiting longer or by throwing away the first reading after a change.  So if I want to take a series of readings to average them I might want to do it like this.
Sequentially

channel 1: take 6 readings but only count the last 5 toward the average.
channel 1 : adjust output
channel 2: take 6 readings but only count the last 5 toward the average.
channel 2 : adjust output
channel 3: take 6 readings but only count the last 5 toward the average.
channel 3 : adjust output

Or
for(int i=0; i<5; i++)// in assembler of course and probably done as interrupts
{
     channel 1: take 2 readings but only count the last 1 toward the average.
     channel 2: take 2 readings but only count the last 1 toward the average.
     channel 3: take 2 readings but only count the last 1 toward the average.
}
channel 1 : adjust output
channel 2 : adjust output
channel 3 : adjust output

or don't bother with taking averages .
channel 1: take 2 readings but only use the second.
channel 1 : adjust output
channel 2: take 2 readings but only use the second.
channel 2 : adjust output
channel 3: take 2 readings but only use the second.
channel 3 : adjust output
 

Offline A Hellene

  • Frequent Contributor
  • **
  • Posts: 601
  • Country: gr
Re: Domestic Led Lighting project.
« Reply #36 on: June 16, 2012, 04:54:45 am »
Quote
But shouldn't I keep the Analogue Vin one volt less than Vcc. for an tinyx61a?
This limitation applies only to the AREF (the external voltage reference) input:
Quote from: ATtinyX61A datasheets rev.C, p.156
It is not recommended to use an external AREF higher than (VCC - 1V) for channels with differential gain, as this will affect ADC accuracy.
At the electrical characteristics section is stated that: AVcc = Vcc ± 0.3V.

Quote
Also, every time I switch between the differential inputs for the 3 channels I must always wait for the change to settle. I can do this by either waiting longer or by throwing away the first reading after a change.
I have never done that (meaning, switching between differential channels with this particular chip), so I do not know and I would certainly experiment with it.

According to the datasheets:
Quote from: ATtinyX61A datasheets rev.C, p.156
Special care should be taken when changing differential channels. Once a differential channel has been selected the input stage may take a while to stabilize. It is therefore recommended to force the ADC to perform a long conversion when changing multiplexer or voltage reference settings. This can be done by first turning off the ADC, then changing reference settings and then turn on the ADC. Alternatively, the first conversion results after changing reference settings should be discarded.
Also:
Quote from: ATtinyX61A datasheets rev.C, p.147
In Free Running mode, always select the channel before starting the first conversion. The channel selection may be changed one ADC clock cycle after writing one to ADSC. However, the simplest method is to wait for the first conversion to complete, and then change the channel selection. Since the next conversion has already started automatically, the next result will reflect the previous channel selection. Subsequent conversions will reflect the new channel selection.

The reasonable way to do it is to initially start the ADC in free-running mode and in every ADC ISR:
1. to count the conversion results and discard the first sample after a differential channel change,
2. to set the desired channel after getting a valid ADC sample, and
3. to adjust the PWM output accordingly to the ADC current reading.
All the above can easily be done within the ADC ISR. Of course, discarding every second ADC result costs in sampling speed by reducing it in half, something that might affect the output stability.

Now, since the current averaging has already been done in hardware (at the very slow RC filter stage of -3dB at 159Hz, which is a typical value that will certainly need recalculation), there is no need for any further processing. You just scale the 10-bit ADC result (in the case of using a PWM resolution lower that 10-bit) and adjust the PWM output accordingly, increasing or decreasing the output value by 1 LSB after every ADC valid result.


-George
Hi! This is George; and I am three and a half years old!
(This was one of my latest realisations, now in my early fifties!...)
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #37 on: June 16, 2012, 06:44:38 am »
Thanks that sounds good for the ADC firmware.
Quote
At the electrical characteristics section is stated that: AVcc = Vcc ± 0.3V.
Sorry I was confused between the Aref and the AVcc


 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #38 on: June 16, 2012, 11:47:47 am »
Pin assignment for attinyX61a, I am looking for 3 independent channels. The previous version of this circuit used Single sided adc and therefore had no internal gain.
I seem to have enough pins for the differential inputs if I share a few ground pins.
From the datasheet I have the corresponding mux codes.
I am using 1 x gain for the dimmers, and 20/32 x gain for the current sense.
After a bit of shuffling I can use 32x gain for the current sense inputs.

Edit: moved dimmer channel 2 (green) to adc3 because it will interfere with _Reset.
« Last Edit: June 18, 2012, 11:03:23 am by HackedFridgeMagnet »
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #39 on: June 22, 2012, 02:20:40 pm »
Finally finished a schematic.

Anyone is welcome to give constructive criticism, or ask questions.
It should work.

One improvement, I think r5 could live on the output of the regulator. Probably don't need it anyway, as the Micro is an always connected load, but I wanted pads there just in case.

The 12v is low power and just for the gate drive  and input to the 5v regulator.


« Last Edit: June 23, 2012, 10:32:28 am by HackedFridgeMagnet »
 

Offline arclight

  • Contributor
  • Posts: 15
  • Country: us
Re: Domestic Led Lighting project.
« Reply #40 on: June 26, 2012, 02:52:43 pm »
I'm surprised nobody has mentioned it, but have you looked at using Anderson Power Poles? These are available in several current levels (the 15A and 30A interchange) and there are wall socket kits for them as well. Have a look at:

www.powerwerx.com/anderson-powerpoles/

Spec sheet is here:

http://www.powerwerx.com/techdata/PP15.pdf

We use these a bunch for ham radio and on our search & rescue team for things requiring DC power.

Arclight
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #41 on: June 26, 2012, 11:52:31 pm »
Hi arclight

I have looked at them on the web about a year a go for a different project but never actually touched one.
I guess I dont get the way you join the multiple poles together, can you do it so that it is mechanically strong like an extension lead?
But I am wondering how they would go for extension leads, wall sockets, and pcb mount connectors.
They probably cant do all of that but probably could do some of that.
Do you think they could be used in any of the above roles at less than 10 A?

I might have a short flying lead on each light at say 48 volts 3 amps max. It would go up into the roof cavity, where I can just clip a power lead into it coming from the dc power supply. The Anderson power pole may suit this. Very few insertions, I assume they lock.

I should probably just get some and so I am familiar with their capabilities.

Thanks for the reminder.




 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #42 on: July 06, 2012, 11:17:12 am »
Three channels fitted onto a Seeed Studio 10x10 cm board so I went with them. So cheap.
I almost put the inductor footprints upside down, they are vertical toroids. That would've been a bit of a disaster. 811-1216-nd from Digikey.
I hope ADC on the current sense is ok, basically I have mimicked the ADC inputs on the differential negative inputs which are connected to ground, but not so there is any significant current flowing through them.
I had to share the negative differential input between channel 1 and 2.


« Last Edit: July 06, 2012, 12:41:05 pm by HackedFridgeMagnet »
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 15429
  • Country: za
Re: Domestic Led Lighting project.
« Reply #43 on: July 06, 2012, 03:12:43 pm »
Anderson connectors themselves are non locking, but you get covers for certain pin combinations that are either locking, waterproof or both.
 

Offline sarfata

  • Contributor
  • Posts: 28
Re: Domestic Led Lighting project.
« Reply #44 on: September 01, 2012, 05:11:45 am »
Hi HackFridge!

I had a wow moment when I saw your design and realized that the PWM from the Attiny was to regulate the current.

Have you built it? Does it work?
What is your current total BOM cost?

I was also wondering how you intend to get the dimming to work. Will you apply a lower frequency PWM to the "fast" PWM that regulates the current? Or will you lower the target current-sense voltage?
I believe the first option would give better color rendering as the LED would always get the same current but of course the dimming PWM must be slow enough to let the current-PWM do the regulation properly.

My design which you saw in another post with an LT3518 is too expensive. I am trying to cut costs down and I believe your schematic is by far the cheapest switching solution. Linear regulation with a mosfet and a transistor is also very cheap but complicated heat-wise.

thomas

EDIT: I see that you have RC-filters on the dimmer input so I am guessing it's PWM that you are translating to analog readings. Why not use the "PWM-state" of those pins in a "AND" test in your current-PWM loop? You could alsto stop adjusting the current PWM when the dimmer input is low.
« Last Edit: September 01, 2012, 05:31:57 am by sarfata »
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #45 on: September 01, 2012, 12:34:21 pm »
Hi Sarfata

If I remember rightly you were also doing your own 3 channel Led Driver, and I posted a link back to here.

Yes I have built 4 of them, I only made one major mistake on the PCB, a transistor backwards, which was a shame but fixable, the error is actually on the schematic I posted, but I have 4 boards working.

I haven't calculated the BOM price properly, A lot of the BOM cost is inductors and connectors. I could even forgo the connectors as I am going to integrate it into the light fitting. For me the issue wasn't really about Led Driver price but about efficiency. I think I am roughly about 93%. Nothing feels hot except the Led MCPCBs.
Quote
EDIT: I see that you have RC-filters on the dimmer input so I am guessing it's PWM that you are translating to analog readings. Why not use the "PWM-state" of those pins in a "AND" test in your current-PWM loop? You could alsto stop adjusting the current PWM when the dimmer input is low.

the dimmers can either take pwm in or just a pot.
Another way would be to use serial control( RS232 or SPI ) but I would have to flip the pins around a bit.

I do have an instability at low pwm settings it flickers, but I know a good work around for this.

My real problem is making the light fittings, and making them look nice enough to use in a house, my level of craftsmanship is at the opposite end to Robenz's.
I have some good diffusing glass but it is flat and looks a bit like a flouro fitting.
I have been stalled here for about 3 weeks.

My test installation shows the leds looking their best when shined up at a white roof. So I may drop the diffuser and go strip lighting on the wall, facing up.

Quote
My design which you saw in another post with an LT3518 is too expensive. I am trying to cut costs down and I believe your schematic is by far the cheapest switching solution.

I am not sure how much cost you will save as there is a fair bit of labour in the extra transistors. The Led Driver is only a small fraction of what I envisage as the total cost of installing a light fitting. Something like $300 installed for something that looks good. Saving $5 for me is not the priority. I just have had no success with the integrated drivers, that is why I like the ATTiny. I guess I do like the gazillion switching BJTs too. Nice to check the waveforms.

I am happy with the electronics though, it's all running very cool. A lot of the cost is in the LEDS, I did my own MCPCB and mount the leds myself, they are working well and run at about 50 Celsius without extra heat sinking (around 400mA Cree XTE)

Quote
Linear regulation with a mosfet and a transistor is also very cheap but complicated heat-wise
You are right, unless your doing a flash light You need PWM or PFM definitely. One other option is  linear control as opposed to micro control. I like the microcontrollers as they give a lot of integration possibilities, which from memory you are interested in too.



 

Offline sarfata

  • Contributor
  • Posts: 28
Re: Domestic Led Lighting project.
« Reply #46 on: September 02, 2012, 09:34:00 pm »
Hi,

I have been running simulations in LTSpice but I am reaching to the limits of my analog electronic skills and I will have to work on that more ...

Just one quick question, you said you built your own MCPCB, how did you do that? Did you order them from someone? If you did that, why not put all the parts on this board and have just one board ?

thomas
 

Offline sarfata

  • Contributor
  • Posts: 28
Re: Domestic Led Lighting project.
« Reply #47 on: September 02, 2012, 10:57:32 pm »
Hi again,

Yes - you are absolutely right about my project.  Thanks for telling me about yours and sharing the link to this thread. It has been very interesting reading your exchanges!


So I have re-designed the circuit in LTSpice, starting with AHellene design because I would like to minimize the number of components and I will not have the two rails like you do. Also, I would like to understand each steps ;)

I have a first basic question about LTSpice: If I set the duty cycle of the PWM to 100%, why is the current limited to 8 amp? This seems to be a characteristic of the LED (changes if I choose another one) but I dont really understand where it is coming from. It seemed to me that in the simulation, the current should be infinite and in real life the LED would blow up in a few uSec. I would love to understand that...



My second question is about measuring the current. Assuming 100mOhm, the voltage on R1 will be equal to 1/10th of the current going through the LED when the switch is On. However, when the switch is Off, the current is 0. So the filtered voltage on Rsense will vary with the current and the switching frequency. Do you take that into account in your software?
It would probably be (in a very simplistic way): Iled = Vrsense / 0.1 * D?

This seems a little too simple, have you used something more advanced to get Iled?



thanks!

thomas
« Last Edit: September 02, 2012, 11:00:13 pm by sarfata »
 

Offline HackedFridgeMagnet

  • Super Contributor
  • ***
  • Posts: 1985
  • Country: au
Re: Domestic Led Lighting project.
« Reply #48 on: September 02, 2012, 11:59:32 pm »
Quote
My second question is about measuring the current. Assuming 100mOhm, the voltage on R1 will be equal to 1/10th of the current going through the LED when the switch is On. However, when the switch is Off, the current is 0. So the filtered voltage on Rsense will vary with the current and the switching frequency. Do you take that into account in your software?
It would probably be (in a very simplistic way): Iled = Vrsense / 0.1 * D?

Good question, I think it took me longer than you to realise that this is the case.
Effectively you are measuring the (Led current) - (the current in the shottky diode) whereas we really just want to measure just the led current.

This is one disadvantage of this topology, but unless you need a linear response (dimmer posistion -> current) it doesn't seem to matter.
One day down the track I may try to linearise things but the light output of the leds themselves is only roughly proportional to current anyway.
currently It dims down to zero and dims up to full on with a reasonably sensible manner. So as an issue it is at the bottom of the list.
The only thing really worth worrying about is the max led current, so you will have to consider the shottky diodes current for this.
Because I generally run with as many leds as possible in a string and only about 1/3 max current, my top duty cycle is always 100% therefore there is no current in the shottky diode. I run like this to get more efficiency and to moderate the heat in the leds.

Here is a link to my MCPCB thread
https://www.eevblog.com/forum/manufacturing-assembly/metal-core-pcbs-from-zhejiang-zapon-electronic/

Quote
I have a first basic question about LTSpice: If I set the duty cycle of the PWM to 100%, why is the current limited to 8 amp? This seems to be a characteristic of the LED (changes if I choose another one) but I dont really understand where it is coming from. It seemed to me that in the simulation, the current should be infinite and in real life the LED would blow up in a few uSec. I would love to understand that...
Nothing blows up in LT Spice, unfortunately, because in real life things do blow up. This is why when in development (firmware or hardware) I always fuse my leds, I learnt this the hard way.
As far as LTSpice is concered the LED is just a non linear resisitor and it is in series with an inductor, so effectively your model of this branch of the circuit is
In Series:
an Ideal inductor,
 an Ideal diode ,
some linear series resistance,
some forward voltage drop
and probably some other non linear effect that models the exponential current/voltage relationship. I = Is * (exp (V/(n*k*T/q)) –1)

the series resistance combined with the exponential relationship will limit the current after the transient effects have worn off.
 

Offline sarfata

  • Contributor
  • Posts: 28
Re: Domestic Led Lighting project.
« Reply #49 on: September 12, 2012, 05:11:29 am »
Hey HackFridgeMagnet, thanks for your replies.
- MPCB => Thanks for sharing this. It is really useful! If I can fit my design on a one-side PCB, it would be really nice to have only one PCB for both the controller and the LED.
- LED current control => I will try to run at the nominal current all the time. We will see how close I can get without burning the LED...
One thing on the todo list is also to dim the light by PWM-ing a constant current, not reducing the current. It should improve the color rendering a lot.


This is my new schematics that I will prototype tomorrow if the UPS-god is good to me.


(LTSpice file attached to this post)

I have adapted both HFM and A Hellene schema:
- Input voltage is 9V (final voltage still to-be-defined)
- Each "string" is just one LED with an approximate forward voltage drop of 4V

Any feedback on my choice of components is much welcomed. I have worked from what was posted before but I am guessing I might be able to find a better mosfet that I could "saturate" better because my requirements are smaller than those of HackFridgeMagnet.

thomas
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf