I want to control 16 leds using a 328n which will receive a command via com1 indicating which led should be on. Each output will be connected to a darlington driver.
High brightness leds are required as the project is used outdoors, however brightness of leds in different colours does tend to vary both in mcd rating measurement terms and perception, and it would be useful if there was a master briughtness control
Across the 16 leds there will be 4 colours so potentially 4 different briughtness settings required.
Is there a creatiuve way using PWM or similar to achieve control of brightness across the led bank ?
Controlling led brightness on multiple channels
Controlling led brightness on multiple channels
> ... increasing/decreasing the frequency of the PWM it will
increase/decrease the brightness of the LED.
You mean duty cycle. Frequency change will affect apparent LED
intensity very little. LEDs are a predominantly-resistive load.
While frequency change on an inductive load like a pump motor can change
torque and speed, duty cycle is more effective at speed - and intensity
- control.
Tom
increase/decrease the brightness of the LED.
You mean duty cycle. Frequency change will affect apparent LED
intensity very little. LEDs are a predominantly-resistive load.
While frequency change on an inductive load like a pump motor can change
torque and speed, duty cycle is more effective at speed - and intensity
- control.
Tom
Tom
I would probably use current limiting resistors to tune the individual LEDs, and then use a single channel of PWM to feed the Darlington array for your global brightness control. Depending on the total current requirement of the LED display, you may need to use another Darlington array channel for the PWM itself, as the PWM output might not provide sufficient current.
-Don
-Don
The hardware-generated PWM is only available on certain pins. On the mega328 the 16-bit PWM outputs are B.1 and B.2. If you don't use the SW UART, 8-bit PWM is also available on pins B.3 and D.3 (both features use Timer2 and therefore are mutually exclusive).FFMan wrote:I assume I can't have pwm going on every pin can I ?
You can also implement PWM in software on any number of pins. The general strategy is to configure a timer to generate an interrupt at a multiple of the desired base frequency. The Interrupt Service Routine code determines at each interrupt if it is time to change the state for each SW PWM output. There will be some jitter introduced by several sources including execution time differences for various paths through the ISR, frequency and duration of other ISRs, etc.
Last edited by dkinzer on 12 September 2015, 19:10 PM, edited 1 time in total.
- Don Kinzer
But fortunately this won't be an issue for PWM'd LEDs.There will be some jitter
The other option, of course, is to use one of the many LED controller chips available these days.
I still have a bin full of Darlington transistors on my bench, but I haven't used one in quite a while. I've generally switched to NFets, with their improved efficiency over the older Darlingtons.
JC