Author Options:

arduino control of digital potentiometer Answered

Is it possible to use my new Ardy board to control a 1-wire potentiometer that will, in turn, control the pwm output for a high-power LED?
The POT is here.
The lights are REBELS @ 700mA.
THe POT will be run in "non-parasitic" layout.



9 years ago

The arduino should be able to talk to the one-wire interface and set the digital pots with no problems (I think there is even a one-wire library that already exists.) But I'm not clear how you plan to have the digital pots control the PWM'ed LEDs...

Since I am new to all this, please excuse my ignorance. Can a POT itself control the brightness by controlling the wiper? Can LEDS only be dimmed via PWM?

Hi Tweac-it,

I see what your underlying intent here is, and while it's a laudable one (the reduction of lots and lots of wiring) I think you need to have firm understanding
of some fundamentals in electronics.

1.) Too much current can and will kill your components.

2.) Too much voltage can and will kill your components.

3.) Resistors are your friends, learn the Ohms law triangle and become fluent
with finding values with it, using an ohm's law calculator (there are tons of apps for this purpose) will help you in this regard.

4.) Learn to use transistors and many of your hurdles will disappear, NPNs are your friends.

Now to answer your question:

Your LED's draw a TON of current, indeed they have to to this to attain the brightness you're probably going for, that's all well and good but know this....

Current = amps which in electronics is usually expressed in milliamps, 1000 miliamps == 1 AMP, for an electronic device not designed to handle that (cough, MOSFET, or heavy duty BJT, etc.. cough) 1 AMP means certain death for an IC.

Those digipots are designed and intended to control the behavior of OTHER ICS, and what that means is... They're designed to modulate a 555's output i.e. By swapping the digipot for 'R2' of a 555's typical setup for frequency generation OR the behavior of some other IC which uses variable resistance to change it's behavior.

OK? That means a digipot is a sensitive and 'fragile' device intended to control the behavior of other sensitive and 'fragile' devices.

You're trying to use a digipot (read it's practical meaning immediately above) to control a HIGH POWERED LED, and what that amounts to is trying to control the braking of a Chevy Suburban SUV by pressing your sneaker-clad foot onto the surface of it's spinning wheels... Very soon, your sneaker will be torn up and not long after that your foot will be injured beyond recovery....

In this analogy the digipot is your sneaker-clad foot...

See what I mean?

To control the LEDs using a 1 wire (which is really an implementation of something called 'I2C'  pronouced " I Squared C " ) daisychain of digipots you'd have to wire up an additional component per LED, an NPN transistor aka a BJT type of transistor. MOSFETS would be overkill here, so just stick with an NPN transistor, you'll have to check the current rating of the NPNs you source, since your LEDs pull 700ma, you'll want to find an NPN BJT with at least 1 AMP current capacity from the emitter (negative voltage wire goes in) to the collector (negative voltage wire comes out and it's path through the BJT is altered in a controlled manner based on the stimulation or positive voltage at the 'base' using the digipot as a programmable resistor between +5v or VCC and the 'base' of the NPN BJT)

So you see, what you're trying to do is quite complex, simply as a design goal in and of itself...

You want to use an I2C daisychain of "n amount" of programmable devices to then alter the voltage on the bases of an equal "n amount" of NPN BJTs which will then and only then allow the emitter to collector current flow through their N terminals (Negative Positive Negative i.e. NPN).

So "FOR EACH LED" you will need:

1 Digipot or other i2C programmable IC which can control the base of an NPN BJT
(I bet you could find the appropriate PWM ics if you searched for "I2C compatible PWM ics")

1 NPN BJT transistor.

A few jumpers to hook up all of the short wiring you'll need to configure per LED...

So as you can see, PWM is not inherently hard or limited, it is the very high level of functioning that you want that is elevating the complexity of your project.

It sounds like a fun little excercise to embark upon, and I use the term 'embark' for good reason, this sounds like a 3 week project if taken up as a part-time project.

Good luck, and may the force be with you.

This is three years old ! I don't think the author of the original question has been back since

Obviously this page will come up upon searches for 'digipot' and other related terms. In that case the reply is quite helpful to anonymous readers, and the points raised in the reply are solid ones at that.

OK...here is a ad-hoc drawing. Finally started to play with EAGLE...LOL R1 to R12 are resistors R13 to R24 are the digi pots (I forgot to include the communications lead for the 1-wire controller) I am not sure what else I missed...but it is just a beginners scheme :) Any suggestions?


9 years ago

I'm a little fuzzy on your goals...

The Arduino itself will do the PWM, yes? (the REBEL light I see don't have built-in PWM.) What is the digital POT for? (That digital pot takes a digital input info to set the POT's output, not the other way around.)

If you're intending to use a POT as a control to set the PWM, then why not just read an analog POT with the Arduino's ADC?

But perhaps I misunderstand where you're going with this...

I guess I may have been too vague in describing my needs/plans :) The idea of using a digi POT to control the PWM for an LED was from an article that I had read (can't remember which site). But maybe I am looking at all this wrong. ( I am new to the electronics hobby...this is my first project) So here is a better description of what I am trying to do: 1) Have a series of high power REBELS. (maybe 2 series) 2) Each individual LED fully controllable/fully independent 3) Hot-swappable (Is that possible?) 4) Expandable (add extra LEDs when needed. Is it possible? Or am I out to lunch?!

By it's nature, PWM control doesn't alter voltage--pulse width modulation works by varying the width of a pulse, rather than changing it's voltage--which a POT (as a voltage divider) would do...

For LED brightness, PWM itself is preferable to using a POT. I'd say you're trying to achieve a single goal by trying two different solutions at once... (it's possible to mix the two methods, but it'll be no more effective, and more complex to boot.)

Westfw is the Arduino guy here, so I'll let him help you from here on...

Thanks for the info gmoon. Are you saying that using the digi pot would be able to control the brightness of an LED?

The digital POT (or any POT) wouldn't work as well as PWM. Digital POTs are inherently cool gadgets, but probably not the best choice here. Plus it's added expense/complexity. Unless there are some other components used, in the original article...

Could you please explain why the POT would not work for this design? My reason for wanting to use the 1-wire control is to save on alot of excessive wiring. I read some articles about extending the number of PWM outs on an Ardy board....but then each PWM out needs to go to a specific LED...12 LEDS will mean 11 more wires compared to the 1-wire option. I am very open to suggestions :)

Well, you tell me--how are you planning to control 12 LED modules with one tiny digital POT?

"Rebel" LED modules, 12 total, 3.15V @ 700mA = 8.4 Amps = ~25 watts total.

A normal POT wattage rating is 1/4 to 1/2 watt. Only high-current "rheostats" can handle that type of wattage. The digital POT you reference has a very low voltage rating, it can't handle much current. The datasheet doesn't show wattage, but you can infer it by the max voltage (11V) and the minimum step (100K / 256 = ~380 ohms per step.) ... it works out to about 1/3 watt rating.

Hence my comment:
Unless there are some other components used, in the original article...

Like transistors (one or several), together with the POT to control current. But PWM outputs can control transistors just as handily.

And if one POT can be used to control a high-wattage transistor for a string of LED modules, one PWM output can also control the transistor...

Actually, I was hoping to be able to use 1 digi POT with each LED module. Again...I am not up to speed on the bizaar and complex math equations... Would it work to have 1 digi POT/LED module? With the 1-wire controller, it would be possible to address and control each LED independently with only 1 wire as to 12 wires....And since I can't find "1-wire pwm" modules, I started to think about the digi POT as being an option.

Oh, my bad--I didn't notice you wanted "independent control."

But you still can't reliably control a 2+ watt module with a 1/3 watt POT. You'll probably need a couple transistors per LED module. Or a voltage regulator and a transistor, per module.

Here's a nice instructable; it has some "constant current" LED drivers. You'll have to modify them to be variable current (they are controlled by resistor values.)

But if you don't grok the simpler electronic math ( Ohm's Law isn't that complex or bizarre) , then it won't be trivial to redesign the driver.