Skip to main content
Arduino

Return to Revisions

1 of 3

The figure below illustrates a method of current control. It shows four LEDs in a 2x2 arrangement; one would adapt the number of LEDs in series or parallel in accord with how one's array is wired, what voltages are available, LED current requirements, transistor power limitations, etc.

Each separately-controlled group of LEDs would need one such circuit. Each circuit needs one control voltage (eg, from a DAC or a digital potentiometer voltage divider circuit) and needs one transistor per series chain.

figure 1, cc circuit

Circuit Operation:

Suppose the following conditions hold.

  • Q1 and Q2 are equivalent transistors and Vbe is 0.7 V typ. (one diode drop)
  • D1, D2, D3, D4 are equivalent LEDs
  • Resistors R1, R2 are small and equal (eg 1–30Ω)
  • V1 is some fixed DC voltage, eg about 1 V
  • V > 2*Vf + Vbe + VR where Vf = typical forward voltage of D1...4

Under these conditions, V1 will drive current into the bases of Q1 and Q2, causing transistor-amplified current to flow through R1 and R2 and maintain the condition V1 = Vbe + VR1 = Vbe + VR2.

Here is a concrete example: Suppose we want 23 mA through each LED and that R1=R2=17Ω. VR = IR = 0.023 mA · 17 Ω = 0.391 V. If Vbe is about 0.7 V, then we set V1 = 0.7 + 0.391 V or about 1.09 V to get 23 mA through each LED. More generally, to get current I through the LEDs we solve V1 = Vbe + VR = 0.7 + IR = 0.7 + I·17.

Base current:

The amount of current required from the V1 voltage source depends on transistor hFE or β. Eg, if β is about 100 and ILED is 20 mA then each transistor will need about 20/100 mA or about 200 μA of base drive. This amount of current probably could be delivered by a voltage divider based on an AD5206 (the digital potentiometer chip that's used in the SPIDigitalPot tutorial mentioned in the question).

Power Dissipation:

The AD5206 digital potentiometer datasheet shows an absolute maximum rating for Package Power Dissipation of (TJMAX-TA)/θJA. If ambient TA is 25°C and θJA is 70°C/W (as for a SOIC package) this gives (150-25)/70 = 1.8 W max package power. However, it would be reasonable to limit dissipation to under half a watt. In the 10 KΩ version of the AD5206, that means a little less than 2.9 mA maximum per channel. [I = √(0.5 W /(6 channels * 10000Ω)).] If several low-beta transistors are used to drive several strings of LEDs, 2.8 mA might be marginal.

Voltage-divider Linearity:

Only a small fraction of the current through a voltage divider can be drawn off without upsetting the division ratio. A unity gain buffer amplifier [as in the following figure] can be used to increase linearity of voltage-divider output by providing a high-impedance connection to the divider.

figure 2, unity gain buffer with voltage divider input

PWM with RC filter:

It may be worthwhile to experiment with using a PWM-driven low pass RC filter to supply V1, possible avoiding need for buffer amplifiers and digital potentiometers. See eg "Arduino’s AnalogWrite – Converting PWM to a Voltage" by Scott Daniels at provideyourown.com, and also see the filter-calculation page it refers to. You might need an oscilloscope to verify the design and its quality of results, and might need to use several RC filter stages in a row to adequately filter out ripple, but it can be done, at the cost of slower response to control changes.

AltStyle によって変換されたページ (->オリジナル) /