Kent, about momentary switch, works very well with ON Interrupt GPIOCHANGE and Select Case.Now it needs to add another operation. When I press the switch more than 2 sec. the leds must go OFF (Case x with PWM duty cycle 0.). I try with ON Interrupt Timer1Overflow and a combination of TIMERO and TIMER1 to increase interrupt time with no results.Would you like to provide a code for this operation for PIC12F683?Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"I noticed something strange at the test. When the led current surpass 1A , the GOTO not > worked..."
This is likely because the values of C1 and R2 are too small to integrate the signal across the Sense resistor into a relatively stable DC voltage. Look at signal with a scope, then try 200n and 5K and check again. A second order filter will provide better response.
Even with that working I believe that this combination of code and circuitry is doomed to failure because of the lack of peak current limiting.
Further to the point:
With an 18V supply the peak current through each LED will exceed the the absolute maximum rating of 150ma regardless of duty cycle. If the supply is limited to 15V then the peak current is reduced to about 145
ma which is slightly below the published absolute maximum and might be ok.
With the upper supply voltage limited to 15V then average current can be limited to 60 ma via feedback from a sense resistor to the ADC, where the software feedback loop maintains a constant 60 ma (RMS) by setting the PWM duty cycle, where duty cycle is 18 percent with a supply of 15 Volts and 100 percent with a supply of 10 volts.
While not a very elegant or very good way way of limiting current/maintaining a constant LED brightness over a range of supply voltages, the above might actually work with good code and the changes I suggested to the low pass filter.
In any case there are serious thermal considerations as total heat dissipation of all the LEDs will be between 6 and 7 watts. So the board will need a lot of copper area and either a fan to move the heat away from the board or a heat sink of some kind (or both).
Last edit: William Roth 2015-04-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
William,I agree with all of your notices.About temperature stability I think that is critical, so I'll make some tests with aluminium PCB that has lower thermal resistance than FR-4 PCB.If it's not enough I'll decrease the average LED current to 55mA or below, because at this current the brightness is almost the same while there is significant decrease of junction temp. of the led's chip.I'll go for the tests.Thanks again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, very useful info, many thanks for support kent.
Kent, about momentary switch, works very well with ON Interrupt GPIOCHANGE and Select Case.Now it needs to add another operation. When I press the switch more than 2 sec. the leds must go OFF (Case x with PWM duty cycle 0.). I try with ON Interrupt Timer1Overflow and a combination of TIMERO and TIMER1 to increase interrupt time with no results.Would you like to provide a code for this operation for PIC12F683?Thanks.
Posted By Basil:
This is likely because the values of C1 and R2 are too small to integrate the signal across the Sense resistor into a relatively stable DC voltage. Look at signal with a scope, then try 200n and 5K and check again. A second order filter will provide better response.
Even with that working I believe that this combination of code and circuitry is doomed to failure because of the lack of peak current limiting.
Further to the point:
With an 18V supply the peak current through each LED will exceed the the absolute maximum rating of 150ma regardless of duty cycle. If the supply is limited to 15V then the peak current is reduced to about 145
ma which is slightly below the published absolute maximum and might be ok.
With the upper supply voltage limited to 15V then average current can be limited to 60 ma via feedback from a sense resistor to the ADC, where the software feedback loop maintains a constant 60 ma (RMS) by setting the PWM duty cycle, where duty cycle is 18 percent with a supply of 15 Volts and 100 percent with a supply of 10 volts.
While not a very elegant or very good way way of limiting current/maintaining a constant LED brightness over a range of supply voltages, the above might actually work with good code and the changes I suggested to the low pass filter.
In any case there are serious thermal considerations as total heat dissipation of all the LEDs will be between 6 and 7 watts. So the board will need a lot of copper area and either a fan to move the heat away from the board or a heat sink of some kind (or both).
Last edit: William Roth 2015-04-26
William,I agree with all of your notices.About temperature stability I think that is critical, so I'll make some tests with aluminium PCB that has lower thermal resistance than FR-4 PCB.If it's not enough I'll decrease the average LED current to 55mA or below, because at this current the brightness is almost the same while there is significant decrease of junction temp. of the led's chip.I'll go for the tests.Thanks again.