# Variable Current Sense Resistor

#### Bwinter

##### New Member
My project uses 3 AL8861 LED constant current drivers (to drive an RGB LED). The data sheet provides a chart that defines what resistor to use for a defined constant current (all <1 Ohm).

My design requires three of these drivers, which will always have the same current requirement. However, I would like to have one PCB where I can easily swap/adjust the three resistors (depending on the requirement of the LED I’m driving).

Originally, I thought I could use a socketable resistor array, to provide the three current sense resistors. However, resistor array/busses don’t go below 1 Ohm (and I need a selection of resistors below that).

How do I go about designing a PCB where I can simply swap/adjust these resistors (that are <1 Ohm)?

#### Visitor

##### Active Member
You could have several resistors in parallel with solder jumpers to include them in the circuit. Make one resistor the biggest value you'd want; paralleling additional resistors reduces the value.

#### ronsimpson

##### Well-Known Member
I would like to have one PCB where I can easily swap/adjust the three resistors (depending on the requirement of the LED I’m driving).
I like to encourage every one to read the data sheet. There are several places where this topic comes up.

If the Vset pin is below 0.3V the current is zero. If the Vset pin is from 2.5V to 6V (no more) the current if full on. From 0.3 to 2.5V the current is a fraction of what it could be.
In the picture R3 could be 0 ohms but 1.2k gives you close to 0.3V. There is a pot with 2.5V on the top end. Set the pot to mid point to get 1/2 current.
You need a regulated 2.5V so you could use a TL431 to get 2.5V.  #### Bwinter

##### New Member
Thanks, I did spend time reviewing the datasheet, but not always fully able to understand.

My application is using the Vset pin for a PWM signal. Since my plan was to have a PCB that could drive difference LEDs, that would have different Vforward and max current ratings. I was hoping that the Vsense resistor would be the only component change that I would have needed

#### crutschow

##### Well-Known Member
You could put the resistors in series with the total equaling the highest value you want, and use a switch or jumper to select which point in the series string is selected for the sense voltage to the Isense input.
(It should not adversely affect the circuit operation if all the current for the high current setting goes through all the resistors.)
For example if you want 0.1Ω, 0.15Ω and 0.3Ω, you would put a 0.1Ω, 0.05Ω, and 0.15Ω resistor in series.
To use only 0.1Ω resistors, use two in parallel for 0.05Ω, and one in series with two in parallel for 0.15Ω
That avoids any switch resistance affecting the measurement.

Be sure and use a fat (wide) trace between each of the resistors with the resistors close together to minimize the effect of trace resistance.

#### rjenkinsgb

##### Well-Known Member
Or how about feeding the PWM signal through a divider that uses a pluggable resistor pack?
(or jumperable resistor set).

That should allow the Vset "high" voltage to be easily redefined, so changing the current without touching any high current / low value components?

• ronsimpson

#### Bwinter

##### New Member
Or how about feeding the PWM signal through a divider that uses a pluggable resistor pack?
(or jumperable resistor set).

That should allow the Vset "high" voltage to be easily redefined, so changing the current without touching any high current / low value components?
I've been studying what you're saying, and I think I'm starting to understand--but I'm not 100% sure how to execute. I'm using a PWM off a WS2811, and NPN resistor (as shown, albeit abbreviated/simplified). I don't fully understand how/why the NPN (Q1)/resistor (R1) was chosen (it was copied from another design). Are you suggesting that I could modify this section (R1) to redefine the PWM into the AL8861 Vset, and that would allow me to have control of the constant-current setting that would be required?

My understanding of the AL8861 data sheet is that I use R6/0.33Ohm to fix the constant-current output (although it also suggests that this can also be modified further with analog dimming--but I didn't think that applied to my, since I'm using PWM).

I wouldn't even know where/how to begin doing that... Could you point me in a direction, or provide more information? Last edited:

#### rjenkinsgb

##### Well-Known Member
From +5V to the transistor collector and between pins 3 and 2.

That would act as a potential divider and set the voltage on pin 3 when the transistor is off (= current enabled).
Changing one or the other resistor value, preferably the one to ground, would change the high voltage on pin 3 and change the LED current.

The internal current source to pin 3 is only 8uA so using external values that pass eg. 0.5 to 1mA or so should override that with little error.
eg. used 4k7 from pin 3 / collector to +5V then 4K7 and lower values between pin 3 and ground.
Or both fixed at 4k7 and add parallel resistors from 3 to ground to reduce the current from the maximum.

For ones that need maximum current you can omit the resistor to ground and leave the one to power in circuit - it would work the same as now.

Or you could use a 4k7 preset wired as a variable resistor between 3 and ground, so you can calibrate each unit without changing components. (Or eg. 3k3 preset and 2k2 fixed, so you can go from around 100% to 40% but not all the way to zero - it depends on what range you need).

With both resistors fitted, the voltage on the set pin is:

5V divided by the sum of both resistors, then multiplied by the value of the one from 3 to ground.

4k7 + 4k7 is exactly half supply, so 2.5V, maximum brightness. The resistor to ground can be left out and give the same result.

4k7 and 4k3 = 5V / 9, * 4.3 = 2.39V
4k7 and 3k9 = 5V / 8.6, * 3.9 = 2.67V
4k7 and 3k3 = 5V / 8, * 3.3 = 2.06V
4k7 and 2k7 = 5V / 7.4, * 2.7 = 1.82V
4k7 and 2k2 = 5V / 6.9, * 2.2 = 1.59V
4k7 and 1k8 = 5V / 6.5, * 1.8 = 1.38V
etc.
You can see the relative current each voltage gives in the chart from the data sheet that Ron posted earlier.

#### Bwinter

##### New Member
Thanks—I think I see it now.

instead of using the Rs to adjust the output-current, I should use a fixed value that will provide the range I need (based on the chart above, from the datasheet).

I should then use a voltage-divider (as you describe) to generate the appropriate Vset that will give me the appropriate Iout. And that can easily be adjusted with a swappable resistor.

• ronsimpson and rjenkinsgb

#### ChrisP58

##### Well-Known Member
Thanks—I think I see it now.

instead of using the Rs to adjust the output-current, I should use a fixed value that will provide the range I need (based on the chart above, from the datasheet).

I should then use a voltage-divider (as you describe) to generate the appropriate Vset that will give me the appropriate Iout. And that can easily be adjusted with a swappable resistor.
You could also use a pot. Though I would add a fixed resistor at one end of the pot to limit the range of adjustment.

#### gophert

##### Well-Known Member
I think you are making this too complicated - read the datasheet and use the right data feed into the ws2811 (on-board programmable pwm).

#### Bwinter

##### New Member
I think you are making this too complicated - read the datasheet and use the right data feed into the ws2811 (on-board programmable pwm).

Could you clarify? How would I alter the data-in to the WS2811? And what would that do?

#### gophert

##### Well-Known Member
Could you clarify? How would I alter the data-in to the WS2811? And what would that do?
I would follow the datasheet and just use the on-board current limiting and on-board PWM to control brightness.

Your microcontroller is used to send the current brightness level to the strip of ws8211 chips. Use the recommended RR and R1 values. The resistor values (33 ohms) is only used for the string of ws8211 to communicate with each other as your microcontroller sends to the first one and the remaining ws8211s cascade the instructions down the chain.

Look up neopixel and you'll see how they connect the ws8211 into strips (adafruit).

#### Bwinter

##### New Member
I don’t think the WS2811 can provide the current limiting capabilities (up to 1.5A), for medium-powered LEDs (10-100W). 