- Joined
- Jul 4, 2009
- Messages
- 16,264
- Helped
- 5,140
- Reputation
- 10,309
- Reaction score
- 5,127
- Trophy points
- 1,393
- Location
- Aberdyfi, West Wales, UK
- Activity points
- 137,646
Not very complicated! The two inputs are either connected to ground or +5V. If you use a LED you should also add a resistor to limit the current to the LEDs maximum rating. If you need more than 5V for the LEDs, stabilize the voltage to the PIC at 5V (a Zener will do, it only draws about 1mA) and increase the voltage at the top of the load. There will be a limit to how high you can go if you use a MOSFET unless you use a logic level type or add an additional driver transistor to lift the gate voltage to nearer the drain voltage.
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.
Brian.