- Joined
- Jul 4, 2009
- Messages
- 16,240
- Helped
- 5,140
- Reputation
- 10,309
- Reaction score
- 5,122
- Trophy points
- 1,393
- Location
- Aberdyfi, West Wales, UK
- Activity points
- 137,444
The plan is the transistor fully saturates (= max brightness) when the capacitor has fully charged. If you add additional resistance to limit the base current you put it back in the mode where it dissipates most heat and also increase either the capacitor charge time (with R1) or discharge time (with R2).I suppose a single pot could serve as a btrightness set when the lamp operates. In that case, where shall one put this pot, at the transistor base or at the emitter? (pot power constraint)
It will still work but not properly. The reason is the transistor is brought into conduction by injecting current into it's base. To do that, the base voltage has to be higher than the emitter voltage. With the load in the emitter, the emitter voltage will rise with the current and tend to cut off the voltage creating the bias current. It limits the top current you can achieve and also stops the transistor conducting at all until the base voltage is Vbe + Vf of the LED. You will get slightly better results with the resistor in the collector and LED in the emitter because that keeps the emitter voltage constant as long as you have enough base voltage to make it conduct.I also would like the led ground to be connected at the ground point (body of the lamp, so I will probably try connecting the collector directly to vcc and put the resistor/led on the emitter side, I hope this will be ok.
You will get slightly better results with the resistor in the collector and LED in the emitter because that keeps the emitter voltage constant as long as you have enough base voltage to make it conduct.
Brian.
My very cheap Chinese flashlight has 24 white LEDs connected directly in parallel. There is no current-limiting resistor since the cheap carbon-zinc AAA battery cells limit their current. All the LEDs have the same brightness.
Of course they pay somebody a bowl of rice a day to test, chart and sort millions of LEDs into groups that have exactly the same forward voltage.
I see you have ignored all my advice, so far, so I will keep this short.
- The 3mF cap.. Remove it. If you want a slow turn on there are better ways.... Use a MOSFET.
- The LEDs were not defined. What are they?
- What can possible draw 450mA in this design unless R3 is <20 Ohms.
- The LED series string should add up to more than 9V then use Ohm s law on the difference to set current.
- Vce sat to be low must be biased with 10% of LED current with only one Rb from 12V.
- For zero drive current use and N Channel MOSFET and adjust R pullup * C for 1 second. e.g. 0.1uF * 10M
#include "C:\\projects\\PWMDimmer\\PWMDimmer_Auto.h"
unsigned int Target = 0;
unsigned int Present = 0;
unsigned int ADCValue = 0;
//*******************************************************************************
//
void UserInterrupt()
{
#asmline SETPCLATH UserIntReturn,-1 ; SETPCLATH for interrupt routine
#asmline goto UserIntReturn ; Assembler - go back to interrupt routine
}
//*******************************************************************************
//
void UserInitialise()
{
OSCCON = 0x71;
OPTION_REG |= 0x80;
TMR1H = 0xB1;
TMR1L = 0xE0;
ADCON0 |= (1 << GO_DONE);
}
//*******************************************************************************
//
void UserLoop()
{
if(OnOff == 0) Target = 0;
else Target = ADCValue;
}
//*******************************************************************************
//
void ADCFinished()
{
T1CON &= ~(1 << TMR1ON);
ADCValue = (unsigned int)ADRESH << 8;
ADCValue += (unsigned int) ADRESL;
T1CON |= (1 << TMR1ON);
ADCON0 |= (1 << GO_DONE);
}
//*******************************************************************************
//
void TenMsTick()
{
T1CON &= ~(1 << TMR1ON);
TMR1H = 0xB1;
TMR1L = 0xE0;
T1CON |= (1 << TMR1ON);
if(FastSlow == 1) Present = Target; // fast mode
else
{
if(Present < Target) Present++;
else if(Present > Target) Present--;
}
SetPWM1Volts(Present);
}
Here is the program I tried. Please note it was written and tried in about 10 minutes from start to finish and only done as proof of concept. I'm sure it can be made more efficient and reliable with a little effort. I didn't do any debugging at all.
Brian.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?