Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Changing brightness of 4 high-power LEDs using digital pot MCP4151 - absolute beginner

Not open for further replies.


New Member
Hi Guys, I am learning electronics from scratch and I am only just beginning my journey - by trade I am a software developer, I am 35, and been working as such for the past 15 years. I am stuck on a simple circuit that I need to amend. I am hoping that someone here will be able to amend the diagram for me and explain to me why and how it works (even in most simple terms so I know what to read / learn next).

Basic idea is such that I want to drive 4 infrared LEDs with MCP4151 digital pot (I need to have a programmatical control over the LEDs brightness – no knobs). I have used this schematic as a starting point: Original article

I have amended it to drive 4 LEDs instead of a one, but then of course I have hit issues. Main one being that the pot in question can only output max 25 mA (each of my LEDs can output 70 mA). I had some help on one of the Facebook groups but that only went so far.

Here is my first working circuit (that works fine with SMD LEDs that use very small power):


I have been told that the problem can be solved by using transistor and/or op-amp – completely new concepts to me.

I’ve been learning about transistors and at the moment I feel like I bit more than I can chew – its clear that it will take me a while to understand all this, and at the moment I have hit a wall again due to lack of understanding.

Firstly, let me answer why I have to use digital pot. I work on a research project primarily as a software researcher / developer. We are working on a precise tracking system using a slew of sensors and Intel RealSense Depth cameras. The four (infrared) LEDs will be in a constellation and will act as a calibration target for the Intel cameras. We need to be able to control the brightness of them digitally so it can be controlled through a software application. The variable brightness is needed to accommodate various lighting conditions in the environments our system will be working at.

The calibration jig and the sensors are connected to the microcontroller through SPI interface.

But going back to the problem at hand, here is where I am and I am hoping that one of you will help me while I continue to learn:

  1. By reading about led driver circuits I am assuming I will need a separate power source / circuit for my LEDs.
  2. Each of the LEDs I am trying to drive is rated at 70 mA (datasheet: IR Emitter Datasheet)
  3. I have tried to calculate
    1. a. What transistor I will need (I looked at the datasheet for the NPN 2N2222A and I concluded that it would work with my LEDs based on the max mA it can sustain)
    2. b. What resistor I need for the base of the transistor (could not figure that out)
  4. When it came to building the circuit, I drew a blank, I am struggling to understand how to couple the two circuits (the one that powers the pot and the one that is a separate power source for the LEDs) using the transistor and how to make it all work – or even if I am on the right track. I am learning fast and I enrolled on an electronics course but it might be some time before I get the required understanding to solve this circuit myself.

The latest suggestion I received form a very helpful fellow on one of the facebook groups was to use transistor and op-amp, below I post his diagram. Problem is that I do not understand (even on a most basic level) why this is a good solution. He suggests using four of those mini-circuits to drive each LED individually.

I feel like this forum might be a better place to ask those questions than a Facebook group that was conceived for something else.

At this stage I am desperate for a solution so my work can continue while I take my electronics course. I could really use a helping hand right now so I can continue working while I learn. Again, thank you for your help!


Well-Known Member
Most Helpful Member
the principle used in the example circuit you give is OK, but the exact arrangement is not ideal.

Move the LED from the emitter / ground side to the collecto (5V) connection. The collector current will then start at zero with zero voltage from the pot.

If all LEDs should change brightness together, connect a low value resistor in series with each, eg. something around 47 Ohms, then connect all four LED+ resistor circuits in parallel between the transistor collector and power.

The value of the emitter resistor will define the current, in proportion to the pot output voltage; eg. if it were 100 Ohms, the current through it with 1V from the pot would be 10mA; 22 Ohms would give near 50mA at 1V.

With only 5V supply, you may need to divide down the pot output voltage with more than around 1V to the opamp, otherwise there will not be enough headroom to drive the LEDs.

Edit - that should say "divide down the pot output voltage with no more than around 1V to the opamp..."
Last edited:


New Member
Hi rjenkinsgb!

Thanks for the reply, I will do my best to redesign my circuit with the hints given and will report back in few days for any feedback!

Thank you again!
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips